Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed issue where evaluating tagged bools always returned NaN.

  • Loading branch information...
commit 161945d28f0e396d11d3687251511a2130ddf1a4 1 parent 7b8fd39
@otac0n otac0n authored
View
10 Src/IronJS.Runtime/TaggedBools.cs
@@ -17,5 +17,15 @@ public static double ToTagged(bool value)
{
return value ? True : False;
}
+
+ internal static bool IsTrue(double d)
+ {
+ return double.IsNaN(d) && (BitConverter.DoubleToInt64Bits(d) == TrueBitPattern);
+ }
+
+ internal static bool IsFalse(double d)
+ {
+ return double.IsNaN(d) && (BitConverter.DoubleToInt64Bits(d) == TrueBitPattern);
+ }
}
}
View
4 Src/IronJS.Runtime/TypeConverter.cs
@@ -509,12 +509,12 @@ public static double ToNumber(string s)
public static double ToNumber(double d)
{
- if (double.IsNaN(d) && (TaggedBools.True == BitConverter.DoubleToInt64Bits(d)))
+ if (TaggedBools.IsTrue(d))
{
return 1.0;
}
- if (double.IsNaN(d) && (TaggedBools.False == BitConverter.DoubleToInt64Bits(d)))
+ if (TaggedBools.IsFalse(d))
{
return 0.0;
}
Please sign in to comment.
Something went wrong with that request. Please try again.