Skip to main content
sima
Associate III
March 20, 2009
Question

flaoting point math in Ride7?

  • March 20, 2009
  • 5 replies
  • 817 views
Posted on March 20, 2009 at 08:42

flaoting point math in Ride7?

    This topic has been closed for replies.

    5 replies

    guyvo67
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:06

    Hi,

    I did the test also and you're right.

    I get something 1.1E-38 for the multiplication. (viewed in the simulator)

    Maybe there must be some float library be added. But I can't find in the linker config tab.

    Be careful tough that you must be aware of compiler optimizations. Better to write volatile in front of your float than you're sure. But I tested it without optimizations on and gave the same wrong result.

    So indeed we are missing something here.

    PS

    It's not needed to do any include normally to work with a float type. But it can be necessary to link with some dedicated float library for the target. ( It's the same with AVR targets based on gcc dists)

    brunoalltest
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:06

    Although it should not be necessary, Try

    #include

    sima
    simaAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:06

    Why don’t simple floating point operations work in my compiled code? I'm using Ride7.

    Or must I have to activate floating point math somehow?

    Try this for example:

    float x, y;

    x = 1000.0;

    y = x * 2.0; // Works

    y = x * 0.5; // Error

    y = x / 2.0; // Error

    Insane results. :o

    guyvo67
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:06

    Ok thx for letting me know.

    Maybe you can post this bug to the ride7 people.

    sima
    simaAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:06

    Hello again, the problem is solved.

    I have located the floating point bug to Ride7's internal simulator.

    When I tried the same code in hardware it debuggs ok.