Your skill will accomplishwhat the force of many cannot PerlMonks

### Re: numeric values acting funny

by VSarkiss (Monsignor)
 on Dec 11, 2004 at 02:03 UTC ( #414046=note: print w/replies, xml ) Need Help??

in reply to numeric values acting funny

Your problem isn't in Perl, but in how numbers are represented.

There's an old rule in numerical analysis:

Never subtract very close values from each other
The problem, in very basic terms, is that your variables are the value you want, plus or minus some small "epsilon". If you subtract two very close values, all you end up with is ε1 ± ε2; in other words, garbage.

Your best bet is to restructure the formulas so the subtraction isn't necessary.

Replies are listed 'Best First'.
Re^2: numeric values acting funny
by tachyon (Chancellor) on Dec 11, 2004 at 02:09 UTC

Your best bet is to restructure the formulas so the subtraction isn't necessary.

This is I believe impossible given that the task rotates around money and spending some quantum of the available. Using integer math is probably a more practical solution. Math::Currency provides a nice transparent implementation that simulates dollars and cents, pounds and pence.....

cheers

tachyon

Create A New User
Node Status?
node history
Node Type: note [id://414046]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2018-08-14 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Asked to put a square peg in a round hole, I would:

Results (150 votes). Check out past polls.

Notices?