TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: GEORGE WHITE
from: ALAN CLIFFORD
date: 1998-02-24 21:46:00
subject: What`S Happening Here?

Hello George
Replying to a message of George White to Neil Heller:
 NH>>    result1 = longint1 * longint2 * multiplier;   /* 37 */
 GW> Fine, the float result is 37.07384 before the cast back to long.
 NH>>    result2 = longint1 * longint2 * multiplier + 0.9999F;   /* 38 */
 GW> Again fine, as the float result is 38.07375 before the cast back to
 GW> long.
 GW> According to the rules the two longs should be promoted to float
 GW> before the calculation, the calculation made and then the result cast
 GW> back to long (which discards any fractional part).
Aren't the two longs multiplied first before the result is promoted?  
Promoted to what?  The two manuals I've got disagree.  Mix Power C says 
floats are promoted to double.  Turbo C manual says that float stays float.
Alan
"Computers do bite"
--- FleetStreet 1.14 NR
---------------
* Origin: Alan's Point on Donor/2 (2:440/4.6)

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