TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: AUKE REITSMA
from: CHRISTIAN FELDE
date: 1997-11-13 18:00: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
Yes.. well... useing float pi; and not double pi; was the error. Thanx 
yway.
         __ __ __ __ _  _
        /_ // / // ///\//      email: cfelde@online.no
_ _ __ __//_ /_//_//_///    homepage: http://home.sol.no/~cfelde/
--- BBBS/L v3.33 How
---------------
* Origin: Fluxpod Information eXchange, telnet://fix.no (2:210/30)

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