(1) Why are there extra digits at the end?
(A1.1) Because floating-point arithmetic is imprecise.
(A1.2) Because the default behaviour is to show answers quite precisely.
Because (A1.1) and, aiming at (A1.2), the default behavior was to
show more digits than IEEE arithmetic ensures to be correct.
(Note: it is IMPORTANT to be able to write out a floating point
number, read it back, and get the *SAME* number you started with.
At one time Quintus Prolog got that wrong, VERY embarrassing.
The Scheme standards actually require write/read round-tripping.)
Yes, true. Indeed, the ISO Prolog standard requires that if the
quoted(true) write-option is effective.
(2) Why are the extra digits at the end DIFFERENT from what one gets from
C?
(A2.1) Idunno, why ARE they different?
Because printf is not used to generate and print the result.
--
+--------------------------------------------------------------------------+
|Manuel Carro -- Facultad de Informática -- U. Politécnica de Madrid (UPM) |
|mcarro_at_fi_dot_upm_dot_es --- Ph: +34-91336-7455 --- FAX: +34-91336-7412|
|
http://lml.ls.fi.upm.es/~boris ---
http://clip.dia.fi.upm.es/Software/Ciao%7C
==============================================================================
Message: Address: Action:
help majordomo(a)clip.dia.fi.upm.es Info. on useful commands
subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list
unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list
<whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list
-----------------------------------------------------------------------------
Archived messages:
http://www.clip.dia.fi.upm.es/Mail/ciao-users/
-----------------------------------------------------------------------------