[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

wmcalc: Doesn't calculate properly



The attached patch changes the result format specifier to 10.10g, for all operations. This fixes the truncation issue. I have no idea why it was 10.5g originally.

Gordon: Are you still interested in this package?

debian-release: I understand that etch is frozen, but I think this is a trivial patch to an important bug. IANAD but if someone can roll it in and NMU to etch, that would be great. Please CC me as I'm not subscribed.

Happy new year all,

Antony
--- wmcalcfunc.c.orig	2006-12-27 14:56:52.454490425 +0000
+++ wmcalcfunc.c	2006-12-27 15:05:13.174790252 +0000
@@ -369,6 +369,8 @@
       Calculate result of entered calculation. 
     Change History:
     Date       Modification
+    27/12/06   Increased significant digits (Antony Gelberg,
+                                            antony@wayforth.co.uk)
     11/04/00   Updated Function Header
  ****************************************************************/
 void equalfunc (void) {
@@ -382,19 +384,19 @@
   switch (OpFlag) {
   case '+':
     RegisterA = RegisterB + RegisterA;
-    sprintf(DispString, "%10.5g", RegisterA);
+    sprintf(DispString, "%10.10g", RegisterA);
     break;
   case '-':
     RegisterA = RegisterB - RegisterA;
-    sprintf(DispString, "%10.5g", RegisterA);
+    sprintf(DispString, "%10.10g", RegisterA);
     break;
   case '*':
     RegisterA = RegisterB * RegisterA;
-    sprintf(DispString, "%10.5g", RegisterA);
+    sprintf(DispString, "%10.10g", RegisterA);
     break;
   case '/':
     RegisterA = RegisterB / RegisterA;
-    sprintf(DispString, "%10.5g", RegisterA);
+    sprintf(DispString, "%10.10g", RegisterA);
     break;
   default:
     break;

Reply to: