[PD] Some more float weirdness/fun
Jonathan Wilkes
jancsika at yahoo.com
Fri Mar 9 19:28:59 CET 2012
>________________________________
> From: Quim Llimona <lemonzi42 at gmail.com>
>To: pd-list <pd-list at iem.at>
>Sent: Friday, March 9, 2012 1:18 PM
>Subject: Re: [PD] Some more float weirdness/fun
>
>
>It's well-known that floats can't be treated the same way as integers... but since PD is aimed at non-engineers and non-scientists I think it would be a good idea to implement the "good" comparison algorithms (i.e. checking against a threshold, etc) inside [==] and so, just to make patching easier. Maybe it's already supposed to behave this way...
How often do these problems happen for people?
Or maybe there is a better example than [==], which let's face it isn't going to be used anyway when you're
checking against a threshold value.
-Jonathan
>
> As for the loss of integer precision issue, an object that detects "integer overflow" (that is, when all integer digits of the number cannot be represented) could be created, taking into account the floating point precision (32-bit, 64-bit...) and so.
>
>
>2012/3/9 Mathieu Bouchard <matju at artengine.ca>
>
>Le 2012-03-09 à 09:39:00, Charles Henry a écrit :
>>
>>Martin a écrit :
>>>
>>>
>>>For any floatX unless X is infinity the number of floats that are not
>>>>exactly represented is always infinite.
>>>>
>>For a floatX format where X is the number of bits, every float is exact and there are at most pow(2,X) floats.
>>
>>You mean that there are an infinity of numbers that round to a finite number of floats.
>>
>>
>>
>>There is a countably infinite number of rational numbers and a uncountably infinite number of irrational numbers that cannot be represented.
>>>
>>
From a constructivist point of view, there's a countably infinite number of irrationals that can be represented at all no matter how. For a certain ontology useful to constructivism, it can be said that the uncountably many irrationals that are inexpressible also don't exist.
>>
>>This leaves you with countably many rational numbers and countably many irrationals, that can't be represented in a finite format.
>>
>>
>>
>>We could also debate over whether infinity is exactly represented.
>>>When some math operation overflows (exceeds the range of floats), the
>>>result assigned is inf.
>>>
>>
Every float represents a range of numbers. The difference with infinities is that they represent half-intervals, that is, a line bounded only on one side.
>>
>>
>>
>>That's not the definition of infinity either: Take the set of real numbers R and the ordering operation <, then add an additional point "infinity" such that for any x belonging to R, x < infinity.
>>>
>>
You should know that there are several competing definitions of infinity for real numbers (not considering other number systems in which this definition doesn't work).
>>
>>There are three definitions of Real numbers (R) in common use : one without any infinite number, one with two infinite numbers as endpoints, and one with a single infinite number without a sign. There are different motivations for the use of each of those three sets. There's no definition that fits all purposes, though the one without infinite numbers at all is considered generally «cleaner» in the field of pure math.
>>
>>
>>
>>So, the inf in the float definition only represents "infinity" defined relative to the finitely countable set of numbers that can be represented as floats
>>>
>>
Yes, except NaN.
>>
>>You'll also find out that certain definitions of infinity that applies to the whole set of Reals also are relative to just that set, and don't work as-is for all possible extensions of Reals ; for example, Complex numbers don't have a single coherent definition of less-than and greater-than anymore, because all you can do is extract features of Complex numbers and compare those features as Reals... thus you need more specific definitions (and there are more possibilities of them).
>>
>>
>>
>>not the actual infinity as represented in your head :)
>>>
>>
How do you know what's in people's heads ?
>>
>>
>> ______________________________________________________________________
>>| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
>>_______________________________________________
>>Pd-list at iem.at mailing list
>>UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>>
>>
>
>_______________________________________________
>Pd-list at iem.at mailing list
>UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
>
>
More information about the Pd-list
mailing list