Precision Level
What is the difference between a float and a double type in Java?
I'm currently covering casting in my programming class (Java), but I'm getting confused with when casting is nece...
Precision Level

What is the difference between a float and a double type in Java?
I'm currently covering casting in my programming class (Java), but I'm getting confused with when casting is necessary when using float or double numbers. I know that float values are 32 bits and double values are 64 (and thus give different levels of precision). What I'm confused is in a case such as this:
float f = (float) 3.14;
Why is casting necessary? Isn't 3.14 already within a float's range; why would it have to be casted again as a float?
Thanks for the help :]
It comes down to the fact that Java has tight type safety.
By default java assumes a manually specified number to be a double, as a double would more precisely cover more numbers that you could type in. You have to cast between doubles and float explicitly. Java is helping you to not do something stupid (loose precision) by making you be absolutely sure about what your doing.
If you want to manually specify floats I always do the following to avoid annoying casting
float f = 3.14f;
|
|
|
Tags: level mage, level precision, precision level
Posted in Calipers & Inspection Guages | No Comments »
Machinist Level

are there any open entry level machining jobs in northern Utah?
I've been going to the DATC and have almost finished my certification and am looking for an entry level job in machining but everyone seems to want at least 3 years on the job experience, does anyone know of a job that is available for an entry level machinist???
It will be hard to find a job in N. Utah. ATK (contractor for NASA making rockets/boosters), the larges employer in the area is laying off a good portion of their workforce. This obviously is not all the machinist jobs in the area, but those will probably be filled by more experienced people laid off from ATK.
|
|
|
Tags: level mage, machinist
Posted in Calipers & Inspection Guages | No Comments »