Compiler Bug?

MudMud USMember ✭✭
edited July 2017 in General

I'm stuck on a bizarre bug.

First, can we agree that 0.7125 * 160 == 114?

Cool. Because my Xamarin Forms app running in the Android X86 emulator seems to think 0.7125 * 160 == 113.

This is me stepping through code in the debugger:

Note that there are are lot of insane, seemingly redundant conditionals and assertions. That's because what the code is doing makes no freakin' sense and I'm just driving the point home.

value is 0.7125 and XR18QuantizeValue is 160. Multiplying them produces 113. Multiplying those same values as constants on the very next line produces 114. Multiplying those variables in the watch window produces 114.

Note the two equality tests in the watch window, one of which produces true and the other false. When those same equality tests are run in the code (in the assertions) and produce true. If I hover over b and result in that fourth assertion, it shows clearly different values on the left and right of the equality operator, yet the assertion passes.

And this is not just debugger glitch. This function actually produces 113 for those values, as seen in the control the result is bound to.

I haven't seen a glitch this low level in at least a decade. I have no idea if it's in Xamarin, Mono, or something else, as I'm totally new to this toolchain/platform.

Anybody ever seen anything like this? Any clue how I can fix it?

Sign In or Register to comment.