Thread: Opinion on Hauser's SoftFloat IEC/IEEE Floating-point Arithmetic Package

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    4,183

    Opinion on Hauser's SoftFloat IEC/IEEE Floating-point Arithmetic Package

    I need to support/create a Floating-point library on a embedded system that already has Binary32 Floating-point (IEEE 754 the 32-bit base 2).
    But, it needs one with more bits in the Significand than 24 bit precision.
    Based on the current info it likely needs 30 bit precision.

    I have decided to try to support Binary64 Floating-point (IEEE 754 the 64-bit base 2). And, the best source code for my needs seem to be Hauser's SoftFloat IEC/IEEE Floating-point Arithmetic Package. This is found on SoftFloat and TestFloat.

    The reason I like it over the other packages/libraries I look at include.
    1. Uses makefile build (without configure)
    2. Has a test package for it.
    3. The license is permitted in commercial application.
    4. The code looks easy enough for me to understand.
    5. While it claims to not be easy to port to other system; the code I have read implies it will be easier than others I looked at.

    My target embedded system is NOT a ANSI C compiler; but, a C-like compiler called Rabbit Dynamic C version 10. I am likely to need to edit the code a lot to get it to work. For this reason, I did not like the ones with a lot of source code files or the ones using configure/make builds.

    Anyone, with opinion on porting Hauser's SoftFloat package to an embedded C platform?

    Thanks for any feedback on Hauser's SoftFloat package.
    Or on the names of any other Floating-point Arithmetic Packages that work on ANSI C compilers.

    If you know of Floating-point Arithmetic Packages that work Rabbit Dynamic C version 10, I would really like to know about them.

    Thank you for reading my message.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by stahta01 View Post
    My target embedded system is NOT a ANSI C compiler; but, a C-like compiler called Rabbit Dynamic C version 10
    So basically what you're asking is how to port a certain C program to this Pigeon C then, right?

    Seriously, you really should be using a processor with better (ANSI-compliant) tool support...
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Sebastiani View Post
    So basically what you're asking is how to port a certain C program to this Pigeon C then, right?

    Seriously, you really should be using a processor with better (ANSI-compliant) tool support...
    No, I am asking is this package easy to port to an ANSI C Compiler on embedded system; because as I stated the Author said it may not be easy to port to other systems. But, after reading his code the code looks easy to port to any ANSI C compiler that supports the basic c types up to size 32 bit. Sometimes the best hardware choice in one way is not the best choice from a programmers view point. Are you really an embedded C programmer?

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Does "Rabbit Dynamic C 10" support real headers and linking?

    [Edit]
    I have to ask because from what I understood series 10 was still not strong ISO C compiler.

    If it is, then I agree, you should not have a bit of trouble porting this code; it looks highly manageable.

    But if series 10 is still as off as I recall, you will probably make a lot more process faster searching for a library already compatible with series 10.
    [/Edit]

    [Edit]
    ^_^v

    I just realized that you are the probably the one who told me about the problems with the current version of "Rabbit Dynamic C".
    [/Edit]

    Anyway, I don't recall using "Hauser's SoftFloat", but I did take a look. There is a lot of weirdness in the style and implementation, but the code looks "top notch" if you ask me. I'm not pretending I checked for bugs or anything like that, but I actually "wowed" a little from the care and consistency the developer has taken in every single line of code.

    *shrug*

    Maybe it is just me being silly, but I'd bet on code that looks of that kind of quality as being of very high quality.

    Soma
    Last edited by phantomotap; 06-29-2013 at 02:34 PM.
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Does "Rabbit Dynamic C 10" support real headers and linking?
    The most recent dot release of "Rabbit Dynamic C 10" supports real headers; but, it still does not do linking.

    Thanks, phantomotap, I was thinking the code looked good. I am hoping I can figure out how to get it to work under "Rabbit Dynamic C 10".

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    I have gotten it to Compile and run a very simple program that uses the library on the Rabbit RCM6750 board.

    Other than porting to Dynamic C changes had two significant issues.
    1. My board has int size of 16 bits; I believe this requires me to add UL to the ends of 32 bit constants.
    2. Turns out Rabbit Dynamic C 10.72 does NOT like a function call in a return statement returning a 64 bit structure called float64.
    I likely will need to add local vars for all the places calling the packFloat64 function in a return statement.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IEEE 754 floating point numbers
    By Mr.Lnx in forum C Programming
    Replies: 32
    Last Post: 04-07-2012, 04:22 AM
  2. IEEE floating point armithmetic
    By PuddleOfShane in forum C Programming
    Replies: 12
    Last Post: 03-08-2012, 12:04 AM
  3. Floating Point Bit Level Arithmetic
    By DanV2 in forum C Programming
    Replies: 15
    Last Post: 10-26-2010, 01:50 PM
  4. Basic floating point arithmetic not working...
    By zodiacWarrior in forum C++ Programming
    Replies: 2
    Last Post: 08-11-2008, 10:16 AM
  5. Reading 64 bit IEEE floating point from a file
    By rcobb in forum C Programming
    Replies: 1
    Last Post: 04-23-2003, 07:28 PM