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

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

by Zteven (Initiate)
on Sep 02, 2001 at 11:08 UTC ( [id://109718]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Thank you for your explanation. How do I circumvent this problem? I have a little perl-program that pulls these numbers from a file and it has to round them correctly. Isn't there some way to store a number exactly?

Replies are listed 'Best First'.
Re: Re: Re: Re: Using (s)printf()
by Iphigenie (Initiate) on Oct 09, 2001 at 10:39 UTC

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://109718]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.