diff options
author | Checkmate50 <dgeisler50@gmail.com> | 2016-07-19 11:56:01 -0600 |
---|---|---|
committer | Checkmate50 <dgeisler50@gmail.com> | 2016-07-19 11:56:01 -0600 |
commit | 6bf5043aeab0430325c4ccde3e6ca3bd82d96704 (patch) | |
tree | a5a31ea3700cef05d44c14f76b85b9e279c9c4df | |
parent | f3f704edfb2cd1021d811050c72694767710217f (diff) |
fixed floatceiling function
-rw-r--r-- | Source/Basetypes/BigFloat.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Basetypes/BigFloat.cs b/Source/Basetypes/BigFloat.cs index 5f711e70..3816a22d 100644 --- a/Source/Basetypes/BigFloat.cs +++ b/Source/Basetypes/BigFloat.cs @@ -314,14 +314,15 @@ namespace Microsoft.Basetypes BIM two = new BIM(2); BIM sig = Significand + BIM.Pow(two, SignificandSize); //Add hidden bit - BIM exp = Exponent - BIM.Pow(two, ExponentSize); - sig = sig >> ExponentSize; + BIM exp = Exponent - BIM.Pow(two, ExponentSize-1) + 1; while (exp > BIM.Zero) { exp--; - sig = sig >> 1; + sig = sig << 1; } + sig = sig >> SignificandSize; + if (isNeg) { ceiling = -sig + 1; floor = -sig; |