[Mono-dev] floating point arithmetic on ARMv4t (arm920t)

Dennis Krzyzaniak dkml at conworx.com
Thu Jun 7 07:13:57 UTC 2012

Hi all,


I am still working to get Mono running on an ARM920t (ARMv4t). Currently I
am hitting a problem with broken floating point arithmetic on my device.
Using this little test app:


namespace foobar {

   public class foo {

      public static void Main(string[] args) {

         int i = 0;

         float fa = 1.0001F;

         float fb = 0.0001F;

         float fs = 0;

         for (i=0; i<5; i++)


            fs = fs * fa + fb;

            Console.WriteLine("float loop {0} {1}", i, fs);






Gives the result:


/host/bin # ./mono hello_world.exe

float loop 0 -3.513059E-06

float loop 1 -3.513059E-06

float loop 2 -3.513059E-06

float loop 3 -3.513059E-06

float loop 4 -3.513059E-06


The processor has no FPU so I used the soft float configuration. I also
tried little and big endian build with the same behavior.

I described my configuration settings in this post:
http://lists.ximian.com/pipermail/mono-devel-list/2012-June/038922.html .
The only new thing is that I am using CFLAGS now to avoid the default
optimization level O2 which also breaks my runtime.

I am completely new to Mono and need some help to find the correct place
where the error could result from. I guess it is somewhere in
method-to-ir.c? Can you point me to the source code places where maybe some
adaptions could be needed that I can test a little bit? I think it is
something related to my ARM architecture but I am not sure.



Best regards,

Dennis Krzyzaniak


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120607/760fc9ed/attachment.html>

More information about the Mono-devel-list mailing list