Created
November 6, 2013 10:53
-
-
Save kabergstrom/7334198 to your computer and use it in GitHub Desktop.
Building with Visual Studio 2012 for .NET 4.0 x86 in release mode, the results differ between running on Microsoft's .NET and mono 3.3.0 (master/6cd4ddc) on Windows with an i7 3820
If a Console.WriteLine call is inserted after the Math.Atan2 call, printing direction, the results no longer differ.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
namespace floattest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
float currentX = -0.91290748f; | |
float currentY = 0.408166558f; | |
float direction = (float)Math.Atan2(currentY, currentX); | |
direction -= 1f / 30f; | |
float dirY = (float)Math.Sin(direction); | |
Console.WriteLine(dirY.ToString("G9", System.Globalization.CultureInfo.InvariantCulture)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment