delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/06/05:46:33

From: Spider <hmspider AT hotmail DOT com DOT no DOT spam>
Newsgroups: comp.os.msdos.djgpp
Subject: poor fp precision
Date: Mon, 06 Apr 1998 09:11:48 +0000
Organization: Chaos, Unlimited
Lines: 40
Message-ID: <35289C54.7FED@hotmail.com.no.spam>
Reply-To: hmspider AT hotmail DOT com DOT no DOT spam
NNTP-Posting-Host: sbas1-p20.telepac.pt
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A simple (in this newbie's HO) thing like

float
for (i=2.15; i<=2.40; i+=.02)
   printf("\f\t\f"; i, 100*i);

results on 
2.150000        215.000010
2.170000        217.000008
2.190000        219.000006
2.210000        221.000004
2.230000        223.000002
2.250000        225.000000
2.270000        226.999998
2.290000        228.999996
2.310000        230.999994
2.330000        232.999992
2.350000        234.999990
2.370000        236.999989
2.390000        238.999987  
                ^^^^^^^^^^
Isnīt this very poor????? I mean, if floats have a 6 decimals precision,
one would expect an error less than exp(-6), right?? My myenv.txt goes
like 

GO32=ansi driver c:/djgpp/drivers/VESA_S3.grn 

no fp emulation (I use a i486DX2)!!! Is fp calculation that bad with
djgpp? Doesn't it implement arithmetics with a (double) cast? 

Thanks in advance for any hint!

Helder

- Raw text -


  webmaster     delorie software   privacy  
  Copyright Đ 2019   by DJ Delorie     Updated Jul 2019