Ryan Richter wrote:
> Jon Lang wrote:
>> TSa wrote:
>> > John M. Dlugosz wrote:
>> >> The sqrt(2) should be a Num of 1.414213562373 with the precision of the
>> >> native floating-point that runs at full speed on the platform.
>> >
>> > That makes the Num type an Int with non-uniform spacing. E.g. there
>> > are Nums where $x++ == $x. And the -Inf and +Inf were better called
>> > Min and Max respectively. IOW, the whole type based aproach to Inf
>> > is reduced to mere notational convenience.
>>
>> Please give an example value for a Num where $x++ == $x.  Other than
>> Inf, of course.
>
> All floats run out of integer precision somewhere, e.g. in p5
>
> $ perl -le '$x=1; while($x+1 != $x) { $x *= 2; } print $x'
> 1.84467440737096e+19
>
> Arbitrary precision mantissas aren't practically useful, since they have
> a strong tendency to consume all memory in a few iterations.

Ah; I see.  We just had a role-vs-class cognitive disconnect.
Officially, Num is the autoboxed version of the native floating point
type (i.e., 'num').  Somehow, I had got it into my head that Num was a
role that is done by all types that represent values on the real
number line, be they integers, floating-point, rationals, or
irrationals.  And really, I'd like Num to mean that.  I'd rather see
what is currently called 'num' and 'Num' renamed to something like
'float' and 'Float', and leave 'Num' free to mean 'any real number,
regardless of how it is represented internally'.  Either that, or
continue to use Num as specified, but also allow it to be used as a
role so that one can create alternate representations of real numbers
(or various subsets thereof) that can be used anywhere that Num can be
used without being locked into its specific approach to storing
values.

-- 
Jonathan "Dataweaver" Lang

Reply via email to