diff options
-rw-r--r-- | pod/perlfaq4.pod | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index 069340dabd..87fd66a777 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -39,6 +39,11 @@ arbitrary-precision decimal numbers with the Math::BigFloat module (part of the standard Perl distribution), but mathematical operations are consequently slower. +If precision is important, such as when dealing with money, its good +to work with integers and then divide at the last possible moment. +For example, work in pennies (1995) instead of dollars and cents +(19.95) and divide by 100 at the end. + To get rid of the superfluous digits, just use a format (eg, C<printf("%.2f", 19.95)>) to get the required precision. See L<perlop/"Floating-point Arithmetic">. |