Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!bloom-beacon!mit-eddie!rutgers!daemon From: prindle@NADC.ARPA Newsgroups: comp.sys.cbm Subject: C Power 128 floating point to integer conversion bug Message-ID: <5365@rutgers.rutgers.edu> Date: Thu, 29-Oct-87 20:51:41 EST Article-I.D.: rutgers.5365 Posted: Thu Oct 29 20:51:41 1987 Date-Received: Wed, 4-Nov-87 03:38:31 EST Sender: daemon@rutgers.rutgers.edu Lines: 23 From: prindle@nadc.arpa (Frank Prindle) I have finally figured out what causes C Power 128 to incorrectly convert floating point values to integers (signed), and this bug could easily explain all kinds of miscellaneous problems with floating point when using this compiler. The problem is in library file "float1.obj". It revolves around a BASIC ROM routine used to do the conversion; the library assumes this BASIC routine returns it's values in the A and Y registers, but it doesn't; rather it returns them in the floating point accumulator in bank 0. Furthermore, even when the return value is fetched from the correct place, the routine only operates correctly if the floating point number has first had it's fractional part removed (BASIC INT function) by truncating toward -infinity. When I get a chance, I will post both the fixed source and the object code for "float1.obj". The source can be assembled by the Rinfret/Zarling C Power assembler. In any case, once you have replaced "float1.obj" on a copy of your library, conversions from float to (signed) integer will work much, much better. Remember, this relates to C Power *128* only, not the 64 version. The 64 version works correctly because a different BASIC ROM routine is used. Sincerely, Frank Prindle Prindle@NADC.arpa