Hello,
I'm checking out some trivial floating-point stuff and get weird behaviour. Feeling like an idiot, could s.o. pls help?
A)
In Emulator (3rd Ed FP1 SDK), the code at the end outputs
1.1
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
0.0
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?
B)
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?
Thanks,
Tobias
================
#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>
#endif
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";
}
else
{
std::cout << "HAL says that we have a VFP unit\n";
}
std::cout << "Press a character to exit!";
getchar ();
return 0;
}



