Hi all,
set the numberformat to "0.00000"
put (36-34.2)*100 into temp
put temp & cr & trunc(temp) & cr & trunc(180)
Result:
180.00000
179.00000
180.00000
Difficult to name this a man's bug ;-)
Le 8 oct. 05 à 03:41, Richard Gaskin a écrit :
Alex Tweedly wrote:
Lynch, Jonathan wrote:
But still...
Answer trunc((36-34.2)*100) should return 180, not 179.
No it shouldn't.
I mean, the
underlying code should work to return an accurate value.
It does.
Perhaps it is just a matter of opinion, but to me, if the
software returns a wrong value in a calculation, it is a bug.
It's not a matter of opinion, and it's not a wrong answer - it's a
correct answer. The binary double precision representation of 34.2
is inexact, and hence the binary double precision representation
of 36-34.2 is similarly inexact - so instead of exactly 180, it's
about 1x2**-40 less than that.
And then when you use trunc() it does what you ask.
It's NOT a Rev bug - it's an artifact of double precision binary
arithmetic (or, if you like, an artifact of the IEEE format used
by Intel (and everyone else)).
One man's "artifact" is another man's "bug". :)
The original poster never specified that it was a Rev bug, and
you've shown that the anomaly lies outside of Rev.
Computers are the servants of humans, not the other way around.
In human logic, this:
trunc((36-34.2)*100)
...is evaluated in three steps:
1. 36-34.2 = 1.8
2. 1.8 * 100 = 180
3. truncate 180 = 180
Math is a human tool devised for the benefit of humans.
Parentheses have a specific meaning which breaks down operations
into an explicit order of operations.
If a computer system is designed in such a way that it no longer
serves its masters faithfully by honoring things like the explicit
order of exectution, it's commonly called a "bug", and it's usually
up to another human to come in an fix it.
Whether the fault lies with Rev or the microprocessor, the anwer of
179 is logically incorrect. It may be understandable, but
understanding why it's giving an incorrect answer doesn't change
the answer. :)
--
Richard Gaskin
Managing Editor, revJournal
Best Regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
Free plugins and tutorials on my website
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email [EMAIL PROTECTED]/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution