-
Bug
-
Resolution: Incomplete
-
P4
-
None
-
7u13
-
JSE 7u13 on OpenSUSE on AMD Phenom 8x with 8 gigs memory. Netbeans 7.3RC2.
I don't know what version it is. I'm using JSE 7u13 on Linux AMD 64 so it must the the latest.
BigDecimal is working only with whole numbers.
I'm using Netbeans 7.3RC2 to create a scene graph with the java api. In the section where I am using a BigDecimal to calculate a percentage (i.e. no "observable" anything) it is 100% pure java but I presume it is running on an fx thread.
BigDecimal big = new BigDecimal(500/100, RoundingMode.HALF_UP) yields the expected value of 5.0.
big = new Decimal(50/100, RoundingMode.HALF_UP) yields a value of 0 (irrespective of any "scale" setting). Any number/formula other than an integer value results in a value of 0!
Double/double likewise does not work nor does Float/float.
I have used BigDecimal hundreds of times in my Swing/Java code over the last decade, never with results like this. The only new element in the mix is runing fx on the Netbeans Platform.
BigDecimal is working only with whole numbers.
I'm using Netbeans 7.3RC2 to create a scene graph with the java api. In the section where I am using a BigDecimal to calculate a percentage (i.e. no "observable" anything) it is 100% pure java but I presume it is running on an fx thread.
BigDecimal big = new BigDecimal(500/100, RoundingMode.HALF_UP) yields the expected value of 5.0.
big = new Decimal(50/100, RoundingMode.HALF_UP) yields a value of 0 (irrespective of any "scale" setting). Any number/formula other than an integer value results in a value of 0!
Double/double likewise does not work nor does Float/float.
I have used BigDecimal hundreds of times in my Swing/Java code over the last decade, never with results like this. The only new element in the mix is runing fx on the Netbeans Platform.