Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!rosevax!ems!umn-cs!hyper!dean From: dean@hyper.UUCP (Dean Gahlon) Newsgroups: comp.sys.cbm Subject: Re: C Power 128 floating point to integer conversion bug Message-ID: <613@hyper.UUCP> Date: Mon, 2-Nov-87 11:07:11 EST Article-I.D.: hyper.613 Posted: Mon Nov 2 11:07:11 1987 Date-Received: Sat, 7-Nov-87 16:54:50 EST References: <5365@rutgers.rutgers.edu> Organization: Network Systems Corp., Mpls. MN Lines: 31 Summary: Are you sure that's all? In article <5365@rutgers.rutgers.edu>, prindle@NADC.ARPA writes: > > 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. > 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. Are you sure that that's all of the problem? I discovered this particular problem some time ago (by the way, it's caused, I think, by the fact that the name in the C-128 Programmer's Reference refers to the routine that's called incorrectly as "GIVAYF", leading one to the wrong impression that it returns its results in the AY pair), but didn't post any results at that time because I still seem to have problems using floating point. Granted, it works much better with the change to float1.obj, but there still seems to be something wrong. Maybe tonight I'll try again; my earlier problems could have been due in part to some lack of familiarity with C. On a different note, has anybody gotten the scanf %x or %o functions to work correctly with C-power 128? Dean C. Gahlon ...ihnp4!umn-cs!hyper!dean