Java float and double primitive types are evil. Don’t use them. | Computing @ 40's
Java float and double primitive types are evil. Don’t use them.
Today I am writing a short article to show people why I decided some time ago to not to use Java float or double primitive types in any case.
When you start programming Java, one of the firsts lessons is to show java primitive types like int, short, long, byte, etc… All these are used to store integers in different range of values available. For floating point numbers, exists two types: float and double types.
But usually people is not aware that when using float or doubles they are entering to a twilight zone that can bring them a lot of headaches.
To see the reason let’s look a simple example. Take this code and run it on Eclipse or Netbeans. It’s a simple Java class with a main procedure.
Read full article from Java float and double primitive types are evil. Don’t use them. | Computing @ 40's
No comments:
Post a Comment