Bug 39443 - nfloat.Epsilon equals zero on device
Summary: nfloat.Epsilon equals zero on device
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 9.4 (iOS 9.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2016-03-08 11:28 UTC by Kyle
Modified: 2016-04-07 14:56 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Immediate window (36.18 KB, image/png)
2016-04-07 13:06 UTC, Kyle

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kyle 2016-03-08 11:28:54 UTC
float.Epsilon prints 1.401298E-45
nfloat.Epsilon prints 0

var a = 0f;
a < nfloat.Epsilon prints false

Built in ARMv7 arch.
Xamarin.iOS is Version:
Comment 1 Zoltan Varga 2016-03-08 16:56:00 UTC
This is a hardware limitation on arm.

*** This bug has been marked as a duplicate of bug 15802 ***
Comment 2 Sebastien Pouliot 2016-03-08 17:03:36 UTC
@Zoltan, is that the same ?

On a 32bits ARMv7 `nfloat == float` so `float.Epsilon` should be identical to `nfloat.Epsilon`, right ?
Comment 3 Zoltan Varga 2016-03-08 20:10:44 UTC
Its a different issue.
Comment 4 Zoltan Varga 2016-03-17 16:16:01 UTC
On an iphone6, both float.Epsilon and nfloat.Epsilon print 0 for me.
Comment 5 Sebastien Pouliot 2016-03-23 21:03:23 UTC
@Kyle, can you let us know which iOS device you were using ? from that we can try to reproduce using the same device (or same CPU). Thanks!
Comment 6 Kyle 2016-04-04 15:53:19 UTC
iPad Air and iPad Pro.
Comment 7 Sebastien Pouliot 2016-04-05 13:06:37 UTC
Console.WriteLine (float.Epsilon);
Console.WriteLine (nfloat.Epsilon);
Console.WriteLine (double.Epsilon);

An ARMv7 binary running my iPad Pro shows:

2016-04-05 08:53:35.957 link sdk[564:1388527] 0
2016-04-05 08:53:35.958 link sdk[564:1388527] 0
2016-04-05 08:53:35.958 link sdk[564:1388527] 4.94065645841247E-324

The LLVM backend also produce the same output:

Apr  5 08:57:34 Sebastiens-iPad link sdk[571] <Warning>: 0
Apr  5 08:57:34 Sebastiens-iPad link sdk[571] <Warning>: 0
Apr  5 08:57:34 Sebastiens-iPad link sdk[571] <Warning>: 4.94065645841247E-324

which is expected (see link in comment #1) and consistent between the 32bits floats types.

It's not clear how you got those different results. If you use custom options in your project then please attach a self-contained test case to the bug report and we'll try it again.
Comment 8 Sebastien Pouliot 2016-04-05 13:55:55 UTC
QA: maccore/master 0b1930ff46e229abc207a241b6809318c5178ca5 adds a unit test (named after the bug number) to cover this.

If it fails on any bots/config please re-open the bug and include the hardware model and all other data. Thanks!
Comment 9 Kyle 2016-04-07 13:05:35 UTC
Version: (Enterprise Edition)
Hash: d7cac50
Branch: master
Build date: 2016-03-21 20:13:04-0400

Same behavior @ iPad Air.
Comment 10 Kyle 2016-04-07 13:06:10 UTC
Created attachment 15641 [details]
Immediate window