[Webfunds-commits] java/webfunds/ricardian Currency.java

Ian Grigg iang@cypherpunks.ai
Sun, 4 Jun 2000 20:51:24 -0400 (AST)


iang        00/06/04 20:51:24

  Modified:    webfunds/ricardian Currency.java
  Log:
  old diags commented out

Revision  Changes    Path
1.6       +10 -6     java/webfunds/ricardian/Currency.java

Index: Currency.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Currency.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Currency.java	2000/04/20 00:08:24	1.5
+++ Currency.java	2000/06/05 00:51:24	1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: Currency.java,v 1.5 2000/04/20 00:08:24 iang Exp $
+ * $Id: Currency.java,v 1.6 2000/06/05 00:51:24 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -21,22 +21,26 @@
     }
 
     protected final double factor;
-    /** getting the fraction might be useful if working with floats */
+    /** getting the fraction will be useful if working with prices */
     public double getFactor() { return factor; }
 
     // amount = dollars, units = cents
     public long getUnits(double amount)
     {
-System.err.println(getField("currency", "factor"));
-System.err.println("Fraction = " + factor);
-System.err.println("Amount   = " + amount);
-System.err.println("Amount/Fraction = " + Math.round(amount/factor));
+// System.err.println(getField("currency", "factor"));
+// System.err.println("Fraction = " + factor);
+// System.err.println("Amount   = " + amount);
+// System.err.println("Amount/Fraction = " + Math.round(amount/factor));
         return Math.round(amount/factor);
     }
 
+    /**
+     *  Consider casting the result to a float to clean FP errors.
+     */
     //amount = dollars, units = cents
     public double getAmount(long units)
     {
+// System.err.println("returning " + units + " * " + factor + " == " + ( units * factor));
         return units * factor;
     }