infinity comparison

Bovaird, Brian Brian.Bovaird at NOVELLUS.com
Fri Sep 17 16:40:04 UTC 2004


VisualWorks has a class Infinity defined in their MetaNumbers application
from my OE252 version.



-----Original Message-----
From: Jarvis, Robert P. (Bob) (Contingent)
[mailto:bob.jarvis at timken.com]
Sent: Friday, September 17, 2004 6:17 AM
To: 'The general-purpose Squeak developers list'
Subject: RE: infinity comparison


Upon some reflection

   A) I'm surprised it didn't trigger a floating point overflow caused by
trying to convert 1000! to Float.
   B) Float is probably not the best place for infinity to reside.  Perhaps
a better solution would be to have an Infinity class (subclass of Number)
with a singleton instance - this class could then define the appropriate
comparison operations and voila!  No more problem.  Better yet, have a
PositiveInfinity and NegativeInfinity class, thus leading to

	1000 factorial < PositiveInfinity value		"--> true"
	1000 factorial * -1 > NegativeInfinity value	"--> true"

That would match well with the IEEE floating-point standard's concept of
positive and negative infinities.

Bob Jarvis
Compuware @ Timken

> -----Original Message-----
> From: Lex Spoon [mailto:lex at cc.gatech.edu]
> Sent: Friday, September 17, 2004 11:51 AM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: infinity comparison
> 
> 
> Okay, here's another useless discussion, following up the recent one
> about comparison of NaN's.  Try this in Squeak:
> 
> 1000 factorial < Float infinity    "-->  false"
> 
> This hydra just won't stay dead!
> 
> And if this example seems silly, just think of all the algorithms that
> insert infinity's as initial values on paper, but for which C and Java
> programmers have to use some sort of sentinel value like -1.  
> There are
> some serious cool points are at stake here, if we can make it possible
> in our language to insert a plain old infinity.
> 
> -Lex
> 

-----------------------------------------
**********************************************************************
PLEASE NOTE: The above email address has recently changed from a previous
naming standard -- if this does not match your records, please update them
to use this new name in future email addressed to this individual.    This
message and any attachments are intended for the   individual or entity
named above. If you are not the intended  recipient, please do not forward,
copy, print, use or disclose this   communication to others; also please
notify the sender by   replying to this message, and then delete it from
your system.     The Timken Company
**********************************************************************


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Infinity.st
Type: application/octet-stream
Size: 6099 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040917/f63649d7/Infinity.obj


More information about the Squeak-dev mailing list