This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
in the program below I have initialised two variables with int values and decrement the variable f by one each repetition f eventually becomes 0 which creates a ArithmeticException and I get the desired result for the exercise the code is below
the resultant output is 120/5 is 24 120/4 is 30 120/3 is 40 120/2 is 60 120/1 is 120 cannot devide by zero ---which is what I expectd
I changed the variable f to a double :-
and got this 120/5.0 is 24.0 etc..... 120/1.0 is 120.0 120/0.0 is infinity
Would someone be kind enough to tell me what causes the difference in output when a varialbles initialiser is changed , please
an island in the sun <br />with a language of many tongue?
Being able to denote infinity as a specific value is useful because it allows operations to continue past overflow situations. Operations with infinite values are well defined in IEEE floating point.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus