Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Rounding to a Given Number of Significant Figures Rather Than Decimal Places

by aging acolyte (Pilgrim)
on Jan 13, 2003 at 14:03 UTC ( [id://226457]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $number = 0.9999;
    printf "number = %.2f \n", $number;
    
  2. or download this
    
    my $number = 0.9999;
    $rounded = sprintf "%.2f", $number;
    print "rounded = $number\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-24 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found