8

Luckily this is quite simple to make clear, even if you are steering clear of the IEEE standard. Honestly, even binary is not needed here. I would start by borrowing a page from Scheme, and say that we can't make blanket guarantees about the exactness of decimal numbers. For instance, when we try to express $2/3$ in decimal, and it doesn't work! All the ...


6

Better yet, is there any way I can show the students such an explanation? (Perhaps an online, interactive demonstration of floating point precision etc. - I couldn't find one) Show them these bits of code: float one = 16777291; float two = one + 1; System.out.println(one == two); float one = 1.00000001f; float two = one + .00000001f; System.out.println(...


5

Tell the students they have seven decimal digits of precision in a float, and that the decimal point is placed "somewhere" within those seven digits, depending on the magnitude of the number. Ask them to add 0.01 to 9,999,999 and express the result to seven digits. Ask what the answer would be if they performed the addition a thousand times. Now ask them ...


2

Actually, it isn't quite so clear. If I run this in Java: // Simple computation with float and double // Increment by a third three times is not the same as incrementing by one // Float can actually be more accurate than Double in limited cases public static void main(String[] args) { float oneThirdF = 1.0f/3.0f; float wholeF = 0.0f; float ...


1

I missed this question! I will attempt to provide feedback in parts: I am concerned that there are too many critiera. I don't understand the reason for this concern, so I cannot comment upon it. The criteria seem reasonable to me. It also raises the question of how a student shows they know how to, say, convert between decimal and two's complement. Do I ...


1

Simple demonstration of "precision" using handheld calculators. Get a pair of calculators. One cheap model that has a limited number of digits in its display. Models can be found built in to clipboards and other "office" things. One decent model, not necessarily a good model, that has double the digits of the other calculator. If it has exactly double the ...


1

Many compilers will promote floats to doubles, do the calculation, and cast back. I see little or no reason to use floats unless one is dealing with huge matrices of floating-point numbers. I encourage my students to use doubles for most purposes.


Only top voted, non community-wiki answers of a minimum length are eligible