[Mono-dev] Floating Point Errors w/ hard FPU

Scott Flynn kulidan at gmail.com
Tue Jul 12 09:59:18 EDT 2011


I am trying to cross compile Mono to run on a MeeGo Harmattan system.
 The compilation and running basic applications went fine however I was
noticing some really strange floating point errors so I wrote a very simple
test:

public class FloatTest
{
        static public void Main()
        {
                double a = 9;
                float b = 9;
                int c = 9;

                Console.WriteLine("Test(double): " + (a%4) );
                Console.WriteLine("Test(float): " + (b%4) );
                Console.WriteLine("Test(int): " + (c%4) );
        }
}

Which when run on hardware outputs:

Test(double): 4.73034682349269E-314
Test(float): 0
Test(int): 1

The flags I used to compile:

-D__ARM_EABI__ -DARM_FPU_VFP=1  -march=armv7-a -mtune=cortex-a8 -mfpu=vfp
-mfloat-abi=hard

However I have tried a whole slew of combinations and nothing makes any
difference.  Does jit properly understand '-mfloat-abi=hard'? All the system
libs for this system were built using hard so I cannot use 'softfp'.  Any
insight would be greatly appreciated.

In case it helps, here is the output of /proc/cpuinfo

Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 298.32
Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2

Thanks,
- Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110712/695da1a0/attachment.html 


More information about the Mono-devel-list mailing list