Revision: 4336
          http://vexi.svn.sourceforge.net/vexi/?rev=4336&view=rev
Author:   mkpg2
Date:     2012-01-20 03:18:27 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
Fix. Error thrown trying to format non-finite number.

Modified Paths:
--------------
    trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSNumber.java

Modified: trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSNumber.java
===================================================================
--- trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSNumber.java   
2012-01-19 19:33:21 UTC (rev 4335)
+++ trunk/org.vexi-library.js/src/main/java/org/ibex/js/JSNumber.java   
2012-01-20 03:18:27 UTC (rev 4336)
@@ -207,7 +207,10 @@
         public double toDouble()  { return d; }
         public boolean isTruthy() { return d == d && d != 0.0; /* i.e. not 0, 
not NaN */ }
 
-        public JSNumber round(int scale, RoundingMode roundingMode){ return 
JSU.N(toRational().round(scale, roundingMode)); }
+        public JSNumber round(int scale, RoundingMode roundingMode){ 
+            if(Double.isInfinite(d) || Double.isNaN(d)) return this;
+            return JSU.N(toRational().round(scale, roundingMode)); 
+        }
         public JSNumber abs(){ return (d<0)?JSU.N(-d):this; }
 
         

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to