Hi there, it’s the first time I am blogging this year so before starting this post here is the famous Happy New Year in its french version Bonne Année
I started the 2009 year with the following sad statement:
“I ignored What Every Computer Scientist Should Know About Floating-Point Arithmetic …”
Dealing for the first time with double values in my Ecplise’s plugins last week, Floating-Point arithmetic wished me an happy New Year with its lot of astonishments.
0.1 + 0.1 +0.1 +0.1 = 0.39999999678 ???
After several reading and discussions with experimented colleagues I know now just a little bit more about Floating point arithmetic. I was able to understand and to solve the problems I faced as a naive programmer dealing with this arithmetic and I think it’s enough for now. Nevertheless I’ll keep carefully the link to the article previously mentioned in order to belonging as soon as possible to this category of scientist developers Knowing the minimum required about floating point arithmetic.
I am also curious to know how many of you are working or have been working intensively with Java double and float primitive types ??
Manu
January 14, 2009 at 2:43 pm |
Although I’m not a very frequent user of doubles (and I usually don’t use floats at all), I have a rule of thumb: if precision is more important than speed, use BigDecimal.