Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: Re: Using (s)printf()

by Iphigenie (Initiate)
on Oct 09, 2001 at 14:39 UTC ( #117689=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Using (s)printf()
in thread Using (s)printf()

What if you want to chop a number but not round it? printf just *wants* to round, no option to tell it not to :(

I needed something that would chop the extra digits (price calculataions) without rounding.

quick fox was to compare the sprintf result with the original and if it was larger remove 0.01 - yuk!...

I ended up using split and substr... - not pretty either

There must be a better way!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://117689]
help
Chatterbox?
[Corion]: Heh. The JSON link for Strawberry releases gives me the idea that I should provide an RSS proxy so people can get notified when a new release is there...
[Corion]: In other RSS news, I've updated my photo stream with images from Lanzarote
[choroba]: Corion Nice

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-02-27 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (377 votes). Check out past polls.