Skip to main content

floating point issues on phoneME Feature

3 replies [Last post]
vdjurovic
Offline
Joined: 2008-01-21

I built phoneME feature, which runs on ARM/Linux target platform. I'm currently writing some apps for this platfrom, but I ran into some troubles using floating point numbers.
Consider this code:

float f = 1.0f;
System.out.println(f);

It prints 3.6675282 !!!!
Also, when using method Float.intBitsToFloat(), i get the same number, no matter what argument I supply.
I built CLDC with ENABLE_FLOAT = true, so i guess floating point support should be enabled? I can't figure out what's the problem with this, so if anyone has an idea, please let me know.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
danila
Offline
Joined: 2006-09-25

This is a known problem.
The issue is that some code in phoneME Feature VM is not compatible with gcc strict aliasing optimization. So a quick workaround would be to add -fno-strict-aliasing to the compiler flags.
See CPP_OPT_FLAGS and CC_OPT_FLAGS in cldc/build/share/jvm.make

danila
Offline
Joined: 2006-09-25

This is a known problem.
The issue is that some code in phoneME Feature VM is not compatible with gcc strict aliasing optimization. So a quick workaround would be to add -fno-strict-aliasing to the compiler flags.
See CPP_OPT_FLAGS and CC_OPT_FLAGS in cldc/build/share/jvm.make

vdjurovic
Offline
Joined: 2008-01-21

Yes, that solved it.
Thanks a lot, man :-)