Created
October 5, 2012 15:08
-
-
Save garrettwilkin/3840376 to your computer and use it in GitHub Desktop.
Java double experiments.
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
gw@airy ~/> java Reps | |
a: 1.0 | |
b: 0.35 | |
c: 0.65 | |
d: 0.35 | |
e: 0.035 | |
f: 0.034999999999999996 | |
g: 0.06999999999999999 |
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
This java class: | |
public class Reps { | |
public static void main(String[] args) { | |
double a = 1.0; | |
System.out.println("a: "+a); | |
double b = a - 0.65; | |
System.out.println("b: "+b); | |
double c = a * 0.65; | |
System.out.println("c: "+c); | |
double d = 35.0 / 100.0; | |
System.out.println("d: "+d); | |
double e = 35.0 / 1000.0; | |
System.out.println("e: "+e); | |
double f = 0.70 * 0.05; | |
System.out.println("f: "+f); | |
double g = f * 2.0; | |
System.out.println("g: "+g); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment