Computing @ 40's

Trying to overcome the obsolescence

Java float and double primitive types are evil. Don’t use them.

Leave a comment

Hi people!

I’m right back here again from holidays and after some weeks without publishing anything I want to resume the work with a short post talking about java primitive types float and double.  Today is an easy post for begginers. No web, no application servers, no JavaServer Faces. A simple lesson about Java SE.

Today I was talking with a colleague at work. He was showing me a Java class, and I noticed that he was using a Double class variable to store some floating point values that were coming from a database. A long time ago I had a bad experience with float and double types when doing a database migration that gave me some hours of headache. I pointed him that he should use BigDecimal instead of that evil things. Fortunately he followed my advice.

I will explain here why I hate float and double primitive types in Java. Why I think they shouldn’t exist. Follow this link and you will learn the reason of my obsession against these “poor innocent” types.

As always I will be very proud to have any comment, any word encouragement, any gift, any million of euros. Every kind of feedback will be greatefully wellcomed.

Cardedeu, September 30th, 2013


Author: Dani Gisbert

Computer engineer, Java Programmer and M3 consultant

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s