The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Astro::Units - Astronomical unit conversion with high precision and large number support

VERSION

version 1.00

SYNOPSIS

Astro::Units can capable of converting the astrological units into mile or kilometers with the added support of conversion from astrological to light year and vice-versa

# Raw number input will be truncated by Perl hence need to use
# either bignum in the script or single quotes to pass large number to methods

 use Astro::Units;
 use bignum;
 my $astro =  new Astouniuts();
 print $astro->get_astronomical_units(19999); #use bigint
 
           OR
 
 use Astro::Units;
 my $astro =  new Astouniuts();
 print $astro->get_astronomical_units('19999'); #single quote
 

DESCRIPTION

Astro::Units,

Features include:

  • High Precision

  • Support for very large number range

  • Fast

  • Imperial as well as SI unit system support

Astro::Units is useful for performing the astrological conversion and calculation till n'th digit with precision. Without worrying about result getting truncated.

IMPORTANT LINKS

ACKNOWLEDGEMENTS

Conversion Values were taken from

http://www.kylesconverter.com/length/

https://www.calculateme.com/astronomy

Module internally uses

https://perldoc.perl.org/bignum.html

https://perldoc.perl.org/Math/BigFloat.html

CONSTRUCTOR AND STARTUP

new()

Creates and returns a new Astro::Units object.

my $astro = Astro::Units->new()

Astro::Units supports unit option

new() set metric system

my $astro = Astro::Units->new(unit => 'mile')
                    or 
my $astro = Astro::Units->new(unit => 'kilometer')

supported unit input

Default is Kilometers

mile
mi
m  
anything starting will m will be considered as miles
kilometers
kl
k
anything starting will k will be considered as kilometers

Methods available

#Astrologocal units to mi/km
get_astronomical_units
get_light_years
get_light_week 
get_light_days
get_light_hours
get_light_minutes
get_light_seconds
get_light_parsecs

#reverse function mi/km to Astrologocal units
convert_to_astronomical_units
convert_to_light_years
convert_to_light_weeks
convert_to_light_days
convert_to_light_hours
convert_to_light_minutes
convert_to_light_seconds
convert_to_light_parsec

#Astrologocal units to light units mi/km not applicable
au_to_light_years
au_to_light_weeks
au_to_light_days
au_to_light_hours
au_to_light_minutes
au_to_light_seconds
au_to_light_parsecs

#light units to astronomical units mi/km not applicable
light_years_to_au
light_weeks_to_au
light_days_to_au
light_hours_to_au
light_minutes_to_au
light_seconds_to_au
light_parsecs_to_au

To convert the user astrological units to kilometers or miles as per the setting in object.

$astro->get_astronomical_units('1234567899.123456789')

Returns equivalent mi/km for given astronomical_units (au)

$astro->get_light_years('1234567899.123456789Kilometer')

Returns equivalent mi/km for given light-years (ly)

$astro->get_light_week('12,34,567,899.123,456,789')

Returns equivalent mi/km for given light-week (lw)

$astro->get_light_days('12_34_567,899.123,456,789')

Returns equivalent mi/km for given light-days (ld)

$astro->get_light_hours('12_34_567,899.123,456,789m')

Returns equivalent mi/km for given light-hours (lh)

$astro->get_light_minutes('12_34_567,899.123,456')

Returns equivalent mi/km for given light-minutes (lm)

$astro->get_light_seconds(1)

Returns equivalent mi/km for given light-seconds (ls)

$astro->get_light_parsecs($number)

Returns equivalent mi/km for given parsecs (ps)

$astro->convert_to_astronomical_units('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_years('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_weeks('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_days('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_hours('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_minutes('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_seconds('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

$astro->convert_to_light_parsec('12_34_567,899.123,456')

Returns equivalent Mi/Km for given astrological-unit

Following methods will not follow metric system for obvious reason

$astro->au_to_light_years()

Returns equivalent light years for given Astronomical units (AU)

$astro->au_to_light_weeks()

Returns equivalent light weeks for given Astronomical units (AU)

$astro->au_to_light_days()

Returns equivalent light days for given Astronomical units (AU)

$astro->au_to_light_hours()

Returns equivalent light hours for given Astronomical units (AU)

$astro->au_to_light_minutes()

Returns equivalent light minutes for given Astronomical units (AU)

$astro->au_to_light_seconds()

Returns equivalent light seconds for given Astronomical units (AU)

$astro->au_to_light_parsecs()

Returns equivelent parsecs for given Astronomical units (AU)

Following methods will not follow metric system for obvious reason

$astro->light_years_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_weeks_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_days_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_hours_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_minutes_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_seconds_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

$astro->light_parsecs_to_au()

Returns equivalent Atronomical units for given Astrologocal unit

AUTHOR

Sushrut Pajai <sushrutpajai at gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Sushrut Pajai

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.