ClustrMaps

The roadrunner is back as never before! See also: My homepage or my very obsolete site
If by any means entries in my blog are considered to be harmful or damaging, please let me know (add comment) or just mail me. In this (unhopely) case I will remove or change the contents.

Friday, November 02, 2007

I am seeing double again

The advise is: do not use double!
See also: http://joscoenen.blogspot.com/2007_01_01_archive.html

import java.math.BigDecimal;

public class TestDouble {

public static void main(String[] args) throws Exception {
double a = 12345.00;
double b = 6686.88;
double c = a - b;
BigDecimal bd = new BigDecimal(c);
BigDecimal bd2 = new BigDecimal(Double.toString(c));

System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(bd);
System.out.println(bd2);
// 12345.0
// 6686.88
// 5658.12
// 5658.1199999999998908606357872486114501953125
// 5658.12
System.exit(0);
}
}

And now for something completely different:
http://www.bakkumopzijnkop.nl/bakkumsewoorden.htm
Anderhalve man en een paardenkop - weinig toeschouwers/bezoekers
Die is zo lui als het paard van Christus (en dat was een ezel) - een lui iemand

No comments: