summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGravatar Checkmate50 <dgeisler50@gmail.com>2016-07-23 14:27:23 -0600
committerGravatar Checkmate50 <dgeisler50@gmail.com>2016-07-23 14:27:23 -0600
commit2b64144fb02b68d00188ee81c27afa5fbc026b5b (patch)
tree3cd907500621d3a506444688bda63ae0f521696f /Source
parentf678d42190391708ae09fa68347421da54d9a7b4 (diff)
fixed an error where a -0 was not interpreted as a negative number
Diffstat (limited to 'Source')
-rw-r--r--Source/Basetypes/BigFloat.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Basetypes/BigFloat.cs b/Source/Basetypes/BigFloat.cs
index d27a3b00..cb248340 100644
--- a/Source/Basetypes/BigFloat.cs
+++ b/Source/Basetypes/BigFloat.cs
@@ -144,13 +144,13 @@ namespace Microsoft.Basetypes
exp = BIM.Parse(s.Substring(s.IndexOf('e') + 1, s.IndexOf('f') - s.IndexOf('e') - 1));
sigSize = int.Parse(s.Substring(s.IndexOf('f') + 1, s.IndexOf('e', s.IndexOf('e') + 1) - s.IndexOf('f') - 1));
expSize = int.Parse(s.Substring(s.IndexOf('e', s.IndexOf('e') + 1) + 1));
+ isNeg = s[0] == '-'; //We do this so that -0 is parsed correctly
if (sigSize <= 0 || expSize <= 0)
throw new FormatException("Significand and Exponent sizes must be greater than 0");
sigSize = sigSize - 1; //Get rid of sign bit
- isNeg = sig < 0;
- sig = BIM.Abs(sig);
+ sig = BIM.Abs(sig); //sig must be positive
//Uncomment if you want to shift the exponent for the user (i.e. 0e-1f24e8 --> 0e126f24e8)
//exp = exp + BIM.Pow(new BIM(2), expSize-1) - BIM.One;