>

Vaibhav's Blog Space

Double on 64 bit OS on 64 bit JVM

Friday Jun 13, 2008

Weeks back, one of our colleagues came with a problem. Customer asked them "Any way to get more precision for double on a 64 bit OS on  a 64 bit JVM". I guess it is not possible. I checked the same with this small code.

 
class checkDouble {
    public static void main(String[] args) {
        double num = 1.232432537658635234534645768d;
        System.out.println("Number" + num);
    }
}
Hopefully this code will tell the precision.  I have checked the same code on 64 bit machine with -d64 flag like

>> java -d64 checkDouble

but results on the same output. It should be actually, else class file will behave differently on different OS, different processor. 64 bit JVM we use to make operation faster on a 64 bit OS, there can't be any other rocket science possible with 64 bit OS support. And if you want to go for higher precision use BigDecimal :-)

[5] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg