- Perl ›
- here
Handling of numbers in Perl
I will explain how to handle numbers in Perl. Explains four arithmetic operations, trigonometric functions, base conversion, and handling of random numbers.
Numerical basics
- Numeric literals - Representation of numbers in source code
- Binary, octal, and hexadecimal numerical representations
Operators for numerical calculations
Numbers and strings
- Automatic conversion of numbers and strings
- Determine if the string represents an integer
- Judge whether it is a numerical value looks_like_number
Numerical values and errors
- Numerical values and errors
- Compare floating point
- Round off
- Extract the integer part int
- Round up the fractional part - ceil function
- Round down the fractional part - floor function
Mathematical functions
Trigonometric function
Exponential function/logarithmic function
Base conversion
I will explain how to perform "base conversion" in Perl. Introduces how to "convert to decimal", "octal", "binary", and "convert to arbitrary base".
Random numbers
I will explain how to generate "random numbers" in Perl.
Calculation of large numbers of significant digits
You can use "Math::BigInt" to calculate integers with a large number of digits, and "Math::BigFloat" to calculate floating point numbers with a large number of significant digits.
See Math::BigInt Math::BigFloat for calculating large figures.