Skip to content

Instantly share code, notes, and snippets.

@pgsin
Created August 26, 2017 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgsin/76b8e028bc4cefdedfbab8fcb232ddb7 to your computer and use it in GitHub Desktop.
Save pgsin/76b8e028bc4cefdedfbab8fcb232ddb7 to your computer and use it in GitHub Desktop.
using System;
namespace FloatFloatTest {
class Program {
static void Main() {
float first = BitConverter.ToSingle(BitConverter.GetBytes(0x4540FDA8), 0);
float second = BitConverter.ToSingle(BitConverter.GetBytes(0x3E19A9C4), 0);
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(first)) + " | " + first);
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(second)) + " | " + second);
double result0 = first * second;
double result1 = first / second;
double result2 = first + second;
double result3 = first - second;
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(result0)) + " | " + result0);
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(result1)) + " | " + result1);
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(result2)) + " | " + result2);
Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(result3)) + " | " + result3);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment