Re: Numeric literals, take 1

[email protected] (Jonathan Scott Duff) Thu, 14 Nov 2002 16:23:00 -0600
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
On Thu, Nov 14, 2002 at 01:12:52PM -0700, Luke Palmer wrote:
> > From: "Tanton Gibbs" <[email protected]>
> > Date: Thu, 14 Nov 2002 15:00:57 -0500
> > 
> > > >   Inf - Inf     NaN
> > > 
> > > I'd expect 0.
> > 
> > I'd expect Inf
> 
> Which Inf is bigger?  Inf, or Inf?
> 
> You can't know, so it's NaN.

Maybe I'm just wired wrong, but Inf is the same size as Inf (since
they are the same "value")  To me "Inf" is a textual representation of
a value that's larger than all other values. So ...

	Inf == Inf		# true
	Inf != Inf		# false
	Inf > Inf		# false
	Inf < Inf		# false
	Inf - Inf == 0		# true
	Inf + Inf == Inf	# true

But, I'm willing to be educated on the subject.  I don't ever use
infinities in code now and I don't think I'm likely to (except perhaps
in lazy list generation).

The only infinities of varying sizes that I know of are the alephs,
and they don't apply here.

> It's actually
> 
>                   { 0  , $P < 1
>     $P ** Inf     { 1  , $P == 1
>                   { Inf, $P > 1
> 
> But perhaps we could forgo documenting any of the power cases and
> leave it to common sense.

We can't leave *anything* to common sense because one person's common
sense may be different from another's.  (i.e., there's no such thing
as "common sense" :)

-Scott
-- 
Jonathan Scott Duff
[email protected]