diff options
author | Mike Buland <mike@xagasoft.com> | 2015-01-29 08:49:55 -0700 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2015-01-29 08:49:55 -0700 |
commit | f03026f5c2cde1eecfda273eaa52df10287f0f9e (patch) | |
tree | c3b5398bb29b848fc5fca2a87633961150d41cad /src/unitnumber.cpp | |
parent | e64cb84fe43660818f7d6eff2954147495b1ac8b (diff) | |
download | clic-0.13.tar.gz clic-0.13.tar.bz2 clic-0.13.tar.xz clic-0.13.zip |
Fixed nasty subtraction bug when dealing with fractions.0.13
It turned out to be a really simple solution, but man, that was
embarassing. I forgot to include the fractional portion of a number
when fixing my radix+1 compliment numbers.
Diffstat (limited to 'src/unitnumber.cpp')
-rw-r--r-- | src/unitnumber.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/unitnumber.cpp b/src/unitnumber.cpp index 985f0d9..d213ed7 100644 --- a/src/unitnumber.cpp +++ b/src/unitnumber.cpp | |||
@@ -136,13 +136,17 @@ void UnitNumber::number1() | |||
136 | 136 | ||
137 | #define mathTest( anum, op, bnum, scale, answ ) \ | 137 | #define mathTest( anum, op, bnum, scale, answ ) \ |
138 | unitTest( (Number(anum, scale) op Number(bnum, scale)).toString() == answ ) | 138 | unitTest( (Number(anum, scale) op Number(bnum, scale)).toString() == answ ) |
139 | /* | 139 | |
140 | void UnitNumber::number2() | 140 | void UnitNumber::number2() |
141 | { | 141 | { |
142 | mathTest( "1", /, "17", 10, "0.0588235294" ); | 142 | mathTest("55", +, "-100", 0, "-45"); |
143 | mathTest( "1", /, "177", 10, "0.0056497175" ); | 143 | mathTest("30.01", +, "-31.21", 2, "-1.20"); |
144 | mathTest("55", -, "100", 0, "-45"); | ||
145 | mathTest("30.01", -, "31.21", 2, "-1.20"); | ||
146 | // mathTest( "1", /, "17", 10, "0.0588235294" ); | ||
147 | // mathTest( "1", /, "177", 10, "0.0056497175" ); | ||
144 | } | 148 | } |
145 | */ | 149 | |
146 | 150 | ||
147 | /* | 151 | /* |
148 | // clic | 152 | // clic |