From f03026f5c2cde1eecfda273eaa52df10287f0f9e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Jan 2015 08:49:55 -0700 Subject: Fixed nasty subtraction bug when dealing with fractions. 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. --- src/unitnumber.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/unitnumber.cpp') 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() #define mathTest( anum, op, bnum, scale, answ ) \ unitTest( (Number(anum, scale) op Number(bnum, scale)).toString() == answ ) -/* + void UnitNumber::number2() { - mathTest( "1", /, "17", 10, "0.0588235294" ); - mathTest( "1", /, "177", 10, "0.0056497175" ); + mathTest("55", +, "-100", 0, "-45"); + mathTest("30.01", +, "-31.21", 2, "-1.20"); + mathTest("55", -, "100", 0, "-45"); + mathTest("30.01", -, "31.21", 2, "-1.20"); +// mathTest( "1", /, "17", 10, "0.0588235294" ); +// mathTest( "1", /, "177", 10, "0.0056497175" ); } -*/ + /* // clic -- cgit v1.2.3