TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: John Poltorak
from: Ronald Van Iwaarden
date: 1995-04-07 23:13:48
subject: scanf

John Poltorak said to Peter Fitzsimmons:

 JP> Wednesday March 29 1995, Peter Fitzsimmons writes to John
 JP> Poltorak: 

 PF> Please post code -- IEEE floating point rounding errors are common when
 PF> you are not aware of them.

 JP> I did get a few results when using 'double' which were
 JP> inconsistant with shown examples. Somehow, I cannot
 JP> reproduce those values now, so it may have been something to
 JP> do with my installation or configuration,

You should be aware that the Intel x86 chips are not, by default, in IEEE
mode.  They actually use more bits of precision than are specified by the
IEEE spec.  For example, in the EMX compiler, there is the call

...

    PC_24   24-bit mantissa

    PC_53   53-bit mantissa

    PC_64   64-bit mantissa (default)

    Only addition, subtraction, multiplication, division, and sqrt()
    are affected by the precision-control bits.  Note that IEEE 754
    requires PC_53, which is not the default setting.


So, one needs to explicitly force the CPU to conform to IEEE specifications...

TTYL,

=--Ron  TeamOS2

Fidonet:  Ronald Van Iwaarden 1:104/338{at}fidonet.org
OS2net:   Ronald Van Iwaarden 81:313/1{at}os2net.ftn
Internet: rvaniwaa{at}carbon.denver.colorado.edu
--- timEd/2-B9
* Origin: The OS/2 Source BBS [303]744-0373 (1:104/338)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 104/338 730 1 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.