On Fri, 13 Oct 2006, David Powers wrote:
When working with computers, I think you'd also want to point out that a 'float' has some amount of precision, and that this is related to how many bits of memory the computer uses to store the number.
yes
I believe it would be correct to say a float is a finite decimal approximation
No, it's a binary approximation, which is not equivalent to a decimal approximation because the bases do not have the same prime factors. In that sense, base 8 and 16 are equivalent to each other, and bases 10 and 20 and 50 are equivalent, but the two groups of bases are not, because one is 2^a and the other is 2^a * 5^b. (a,b must be more than zero of course, else they'd be the same for b=0).
Anyway, knowing that the number is a decimal approximation might be important from time to time in multimedia programming...
Knowing that it's not a decimal approximation might be important, at least for the fact that most of the time 1 - 0.9 is not exactly 0.1, when you ask pd or most any other piece of software.
You may also use true rationals in some languages, so that 1 - 9/10 is always exactly 1/10, but it's a lot slower, and it's not available in pd yet. (It's available in Lisp, Smalltalk, Ruby, Mathematica, and a bunch more)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada