Created
February 21, 2013 09:50
-
-
Save blueberrystream/5003576 to your computer and use it in GitHub Desktop.
桁落ちのなにが悪いんだ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author KID / @blueberrystream | |
*/ | |
public class 桁落ち { | |
/** | |
* @param args | |
*/ | |
public static void main(final String[] args) { | |
final Long l1 = System.currentTimeMillis(); | |
final Long l2 = System.currentTimeMillis() + 5; | |
final Double d1 = l1.doubleValue() / 10000000000000L; | |
final Double d2 = l2.doubleValue() / 10000000000000L; | |
System.out.println(d1); | |
System.out.println(d2); | |
System.out.println(d2 - d1); | |
/* | |
出力例 | |
0.1361440116519 | |
0.1361440116524 | |
5.000166947155549E-13 | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
桁落ちとは : JavaA2Z http://www.kab-studio.biz/Programing/JavaA2Z/Word/00000528.html これのサンプルプログラムのコメントでようやく理解。