What I (As Computer Scientist) Ignored About Floating-Point Arithmetic

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 ??



One thought on “What I (As Computer Scientist) Ignored About Floating-Point Arithmetic

  1. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s