summaryrefslogtreecommitdiff
path: root/src/unitnumber.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2015-01-29 08:49:55 -0700
committerMike Buland <mike@xagasoft.com>2015-01-29 08:49:55 -0700
commitf03026f5c2cde1eecfda273eaa52df10287f0f9e (patch)
treec3b5398bb29b848fc5fca2a87633961150d41cad /src/unitnumber.cpp
parente64cb84fe43660818f7d6eff2954147495b1ac8b (diff)
downloadclic-1e5d403cf25b86b4572c98792205de19ce76071f.tar.gz
clic-1e5d403cf25b86b4572c98792205de19ce76071f.tar.bz2
clic-1e5d403cf25b86b4572c98792205de19ce76071f.tar.xz
clic-1e5d403cf25b86b4572c98792205de19ce76071f.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.cpp12
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
140void UnitNumber::number2() 140void 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