in reply to Re: Fix floats like you do in your head
in thread Fix floats like you do in your head
Great links. As you say this is not a ceil() or a round() function which behaves in strict mathematical terms, nor does it attempt to solve any of the problems associated with doing decimal fp arithmetic in binary.
The beauty/purpose of it is that is does what a human tends to do. I see 0.9999999 and think 1 or 0.00999999 and think 0.01 which is what you get with the approx() function. I did call it approx() rather than exact(), actually() or really() ;-). I had it in mind for simple display functions not anything serious.
It also only works on the decimal fraction but could be extended to work on the integer component so 999999.9 or 1000000.1 would become 1,000,000.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Fix floats like you do in your head
by mojotoad (Monsignor) on Dec 25, 2002 at 01:07 UTC | |
by tachyon (Chancellor) on Dec 25, 2002 at 09:48 UTC | |
by mojotoad (Monsignor) on Dec 25, 2002 at 10:27 UTC | |
by tachyon (Chancellor) on Dec 25, 2002 at 15:10 UTC |