Bug 54230 - Rounding a float produces incorrect result on Android
Summary: Rounding a float produces incorrect result on Android
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-29 16:46 UTC by softlion
Modified: 2017-09-01 07:12 UTC (History)
4 users (show)

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


Description softlion 2017-03-29 16:46:43 UTC
Start an android xamarin project on an android simulator on Wîndows, set a breakpoint anywhere and write in the immediate window:

Result is 132 instead of 131

Do the same with a windows test project.
Result is 131

This also happen when the calculation is put directly in Android code, thus is not a problem with the debugger.
Comment 1 Prashant [MSFT] 2017-03-30 06:16:35 UTC
Non-engineering team preliminary quick review
(See https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/ for general reference.)

## Suspected to be a regression or a problem with a new feature?
Uncertain. The issue is reported for the first time

## Specific to one particular project, development computer, or target mobile device?
I am able to reproduce this issue on Mono on Mac, and with Android project on Windows. 
Note that this is affected only in `Immediate` Windows, the values correct when running within the app

## Includes clear steps to reproduce the problem?

## Considers the relevant log files for the part(s) of the process where something goes wrong (IDE editing, MSBuild building, deploying, launching, attaching the debugger, an in-app error, or something else), and has them attached?
No, but bug description is good enough to reproduce the issue

## Already took up time for many users?
Unclear. This is the only report I have seen for this issue and no other users are on the cc list for this bug report. 

## Makes development (a) difficult, impossible, or potentially hazardous, (b) moderately inconvenient, or (c) mildly inconvenient for users?
I would say (c) based on the description

## Version Information
=== Xamarin Studio Enterprise ===

Version 6.2.1 (build 3)
Installation UUID: 31e31e77-8008-415b-a88b-44a133744a1b
	Mono 4.8.0 (mono-4.8.0-branch/8f6d0f6) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000520

=== NuGet ===


=== Xamarin.Profiler ===

Version: 1.2.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin Inspector ===

Version: 1.2.0
Hash: 62c17e6
Branch: d15-1
Build date: Mon, 20 Mar 2017 02:36:23 GMT

=== Apple Developer Tools ===

Xcode 8.3 (12169)
Build 8E162

=== Xamarin.Mac ===

Version: (Visual Studio Enterprise)

=== Xamarin.Android ===

Version: (Visual Studio Enterprise)
Android SDK: /Users/prashantvc/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)
		7.0 (API level 24)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Not Installed

=== Xamarin.iOS ===

Version: (Visual Studio Enterprise)
Hash: e66c6f19
Branch: xcode8.3
Build date: 2017-03-28 00:48:33-0400

=== Build Information ===

Release ID: 602010003
Git revision: 5217903c99e9d9c5d3caa2498fd66d607debac29
Build date: 2017-03-23 12:36:46-04
Xamarin addins: 2c96d252b353fce2e8b8fd20884eee70c16c7f32
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.4
Darwin Prashant-MBP.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
Comment 2 softlion 2017-03-30 06:29:58 UTC
I also haven incorrect values in both the running app
And the debugger.

Using Math.Floor works as expected.

Tested on android simulator 5.1 (x86) and an android device 
(32 bit Samsung s3 on android 7.1.1).
Comment 3 Prashant [MSFT] 2017-03-30 14:54:52 UTC
(In reply to softlion from comment #2)

> Tested on android simulator 5.1 (x86) and an android device 
> (32 bit Samsung s3 on android 7.1.1).

Could you share the version information from Xamarin/Visual Studio? It will help us to debug this issue. You can find instructions here https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/version-logs/#Version_information
Comment 4 softlion 2017-03-30 21:25:08 UTC
Ok happens only in the debugger.
Comment 5 softlion 2017-09-01 07:12:08 UTC
Well no it happens in both debugger and app.

Xamarin Android

Note You need to log in before you can comment on or make changes to this bug.