Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Fix floats like you do in your head

by tachyon (Chancellor)
on Dec 24, 2002 at 02:24 UTC ( [id://222013]=CUFP: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        approx(dsin(30))
        approx(dcos(30))
    
  2. or download this
        approx($num, 7);  # will return 0.5 for 0.500000001 but 0.50000001
    + if
                          # that is passed as it only has 6 zeros.
    
  3. or download this
    sub approx {
        my ( $num, $dp ) = @_;
    ...
            return $num;
        }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://222013]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-07-15 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

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