Just found this languishing in my starred email folder. The fundamental issue here is that we've got libfp.a in msp430-libc attempting to replace internal softfloat routines from libgcc (which is part of gcc, and comes with the base compiler). In current mspgcc toolchains, -lfp is *not* required in order to support (32-bit) floating point numbers: softfloat is part of gcc.
I believe the floating point comparison and arithmetic implementation in libgcc is correct. That's the one that gets tested by what few floating point checks are done by the mspgcc toolchain test suite and by every other GCC target that lacks floating point hardware. As far as I can tell, the cmpsf.c module and the other routines in msp430-libc will only be present if you explicitly request it by adding -lfp to the command line. I expect adding -lfp does decrease the size of programs that use floating point, but I'm equally sure it isn't as correct as the libgcc implementation, despite the significant effort for IEEE754 support contributed by Diane Gagne. As a maintainer I don't like libfp, since I don't know what correctness assumptions are being made by other libgcc support functions that depend on routines that are being replaced by it, and I don't have the sort of test suite that would give me warm fuzzies about it: msp430-libc has no business rooting about in gcc's knickers. Since it won't break anything unless you specifically ask for it, and people would probably get upset if I removed it and their programs got bigger, it'll have to stay. But I don't plan to add the suggested check or do anything that intentionally changes existing behavior, unless somebody wants to provide a test suite along with the patches. If you do, please use the test430 infrastructure. Everybody should be aware that if you add -lfp to your link commands, you're entering the twilight zone. Consider libfp.a to be essentially user-contributed and otherwise unsupported code, bundled into msp430-libc only for historical reasons. I've added a warning to this effect to msp430-libc's README for future releases. Peter On Mon, Jun 20, 2011 at 7:33 AM, Volker Schindler <vol...@designschindler.com> wrote: > > Hello floating point lib users: > > there is a BUG in file cmpsf.c: > > The return code 0 for equal floats is returned only if these two floats > a1, and a2 are 0. In this case, both float zeros, i.e. +0 and -0 are be > equal to each other. > > If two equal floats are not 0, then either code 1 or code -1 is > returned, depending on the sign of these (equal) floats. This is > obviously wrong, since return code 0 has to used in this case. > > The BUG can be resolved by adding this code at line 40 to cmpsf.c: > > if (a1==a2) return 0; > > Add this code to cmpsf.c e.g. at line 40, which is empty now. > > Must be added before line 41 that checks for both arguments less than > 0: if(a1<0 && a2<0) .... > > File with BUG resolved was tested in application and works proper now. > > Best regards, Volker Schindler. > > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users