Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: number comparison with a twist

by Anonymous Monk
on Mar 02, 2020 at 23:56 UTC ( #11113674=note: print w/replies, xml ) Need Help??

in reply to number comparison with a twist

Since the "authoritative" source of information is in cents ... which is wise ... I think that I would first convert the string to a floating point number, then multiply by 100, then simply truncate to an integer. If the difference is 1 cent, accept the answer.   Part of the problem here is that you have no way to know or of course to control exactly what the other side is doing, what libraries they might be using to talk to you, and so on. I predict that most of the time you actually will get an exact match. When you do not, rounding-error can throw the result off by no more than one cent. "The bane of accountants everywhere."

Replies are listed 'Best First'.
Re^2: number comparison with a twist
by LanX (Cardinal) on Mar 03, 2020 at 00:45 UTC
    > If the difference is 1 cent, accept the answer.

    By far the worst answer yet.

    Very sundial'ish: ignorant, entitled and plain dangerous...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2020-10-25 05:44 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.