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

Re: Want to Truncate A Number... NOT round it

by metadoktor (Hermit)
on Feb 11, 2004 at 20:34 UTC ( [id://328376]=note: print w/replies, xml ) Need Help??


in reply to Want to Truncate A Number... NOT round it

#!/usr/local/bin/perl -w use strict; my $n = 34.57889; my $d = 4; # Num of right hand digits to grab my ($lhs,$rhs) = split /\./,sprintf("%f",$n),2; $n = join '.',$lhs,substr($rhs,0,$d); print "$n\n";

metadoktor

"The doktor is in."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://328376]
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-03-29 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found