TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTIAN FELDE
from: AUKE REITSMA
date: 1997-11-05 21:39:00
subject: What`s wrong?

Hi Christian,
On 03 Nov 97, 21:52, you wrote to All
 CF> void main()
int main( void ) // not the problem though
 CF>         float pi;
...
 CF>         if (pi != 3.142)
 CF>                 cout << "\nI said 3.142!\n\n";
Floating point comparisons are seldom exact. I don't remember the exact 
number of significant digits in a float, but try:
             if( pi < 3.1419 && 3.1421 < pi )
                    cout << "I said something like 3.142! You did: " << pi
Greetings from
 _____
 /_|__|  Auke Reitsma, Delft, The Netherlands.
/  | \  --------------------------------------
--- GEcho 1.00
---------------
* Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20)

SOURCE: echomail via exec-pc

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™.