Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Aug 2008

    floating-point support


    I'm checking out some trivial floating-point stuff and get weird behaviour. Feeling like an idiot, could s.o. pls help?


    In Emulator (3rd Ed FP1 SDK), the code at the end outputs

    HAL says that we do NOT have a VFP unit

    Both I did expect.

    Ok. Now, if I change the initial assignment of var "a" to

    double a = .0;

    the output changes to

    HAL says that we do NOT have a VFP unit

    wtf? I did expect 1.0 !

    Now, if I change type to

    float a = .0;

    the output gets 1.0 as expected.

    The same behaviour on E51 device.

    Whats going on?

    Could it be, that some SW emulation layer for floating point
    isn't working with "double"?

    I rechecked the behaviour multiple times, since I can't
    believe .. or am I fooling myself somehow?

    Since the E51 is built on a Freescale MXC300-30 SoC which
    seems to have an ARM1136JF-S core (where the F stands for
    VFP hardware floating-point), I did expect the HAL:Get to
    indicate support for hardware floating point.

    However, it does not. Why?

    I also compiled everything both with and without the

    armfpu vfpv2

    in the MMP - does that even apply to GCCE?



    #include <iostream>
    #include <hal.h>

    // This is a GCCE toolchain workaround needed when compiling with GCCE
    // and using main() entry point
    #ifdef __GCCE__
    #include <staticlibinit_gcce.h>

    int main ()
    double a = .1;
    for (int i = 0; i < 10; ++i) a += .1;

    std::cout << a << std::endl;

    // adapted from: http://www.symbian.com/developer/tec...ort.guide.html

    TInt supportedFp;

    TInt HalVfp = HAL::Get(HALData::EHardwareFloatingPoint, supportedFp);
    if (HalVfp == KErrNotSupported || supportedFp == EFpTypeNone)
    std::cout << "HAL says that we do NOT have a VFP unit\n";
    std::cout << "HAL says that we have a VFP unit\n";

    std::cout << "Press a character to exit!";
    getchar ();

    return 0;

  2. #2
    Registered User
    Join Date
    Dec 2006

    Re: floating-point support


    Ignore HAL, that will just be returning a constant which may or may not have been set correctly on any given platform.

    In the emulator floating point is used as normal (and by default), so it is purely the compiler that is determining your results.

    Code for the target hardware is compiled without VFP support and is software emulated (very slow for floats and doubles). It is possible to force the compiler and it will work on appropriate hardware - if you search the discussion boards you'll find a very detailed post with the solution (I'm pretty sure the poster is called storsjo although they didn't start the thread, but just searching for FPU or floating point should find it).


  3. #3
    Registered User
    Join Date
    Aug 2008

    Re: floating-point support

    Thx! I've found the thread:

    If I set

    VFP2MODE_OPTION=-mfloat-abi=softfp -mfpu=vfp

    in gcce.mk and activate HW FPU in MMP

    ARMFPU VFPV2, the app won't even install.

    If I set

    SOFTVFPMODE_OPTION=-mfloat-abi=softfp -mfpu=vfp

    without modifying MMP, the app will install, but will crash on startup with:


    (Y-Task:Crash Monitor says the same ..)

    This exception is even documented under

    "Note, however, that binaries generated with VFP specific code do not work on devices without a VFP unit - any call to VFP specific code results in a KERN-EXEC 3 panic."

    So on E51, it seems to be impossible to use HW FPU.
    Last edited by oberstet; 2008-11-17 at 13:12.

Similar Threads

  1. Entering floating point numbers
    By rihoe in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-08-26, 12:14
  2. Why gcce didn't support hardware float point?
    By codeshu in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2006-09-14, 16:24
  3. Nokia 3650 & floating point numbers
    By hoyuka in forum Symbian
    Replies: 1
    Last Post: 2004-09-30, 19:23
  4. Floating point numbers / Angle between points
    By Pandaemonium in forum Mobile Java General
    Replies: 8
    Last Post: 2004-03-10, 16:02
  5. Floating point calculations
    By shahzad73 in forum Mobile Java General
    Replies: 6
    Last Post: 2003-08-17, 23:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts