Infinity?
Andreas Raab
Andreas.Raab
Fri Apr 18 14:54:30 PDT 2003
Hi Andrew,
I think your questions are better asked at the Squeak developers mailing
list - there are plenty of people who will be able to discuss these
issues over there. Please check out
http://lists.squeakfoundation.org/listinfo/squeak-dev for the archives
and more information.
Cheers,
- Andreas
> -----Original Message-----
> From: owner-squeakland at squeakland.org
> [mailto:owner-squeakland at squeakland.org] On Behalf Of Andrew Henrick
> Sent: Wednesday, October 09, 2002 10:53 PM
> To: squeakland at squeakland.org
> Subject: Infinity?
>
>
> Hello everyone,
>
> I am a new comer to Squeak and I have a few questions. My
> background in
> Smalltalk (and the Squeak version of it) is pathetic so
> please excuse
> my ignorance. Also please let me know if I am posting to the wrong
> list. The only real reference I have is "Squeak: A Quick Trip to
> ObjectLand." In any case, here they are:
>
> Q1. Is there some way to have the browser colorize and indent on the
> fly as I write code? Right now, I just select "colorPrint" and that
> formats text that has been accepted by the "system," but is there
> anything better?
>
> Q2. I am confused about Exception handling in Squeak. Were
> can I find
> an adaquate description of how it works. For instance what generates
> which exceptions?
>
> Q3. How can I detect an underflow/flow in the system. This may seem
> like an odd question, but it comes in reference to some code that I
> found in "Object-Oriented Implementation of Numerical Methods" by
> Besset. He was working in Visual Age, so his exception handling is
> different, but the idea is to cause an overflow by repetitive
> multipilication:
>
> computeLargestNumber
> | one floatingRadix fullMantissaNumber |
> one _ 1 asFloat.
> floatingRadix _ self radix asFloat.
> fullMantissaNumber _ one - (floatingRadix * self
> negativeMachinePrecision).
> largestNumber _ fullMantissaNumber.
> [[fullMantissaNumber _ fullMantissaNumber * floatingRadix.
> largestNumber _ fullMantissaNumber.
> true] whileTrue: [ ].
> ] when: ExAll do: [:signal | signal exitWith: nil].
>
> I tried using this code and changing the exception handling to an
> ifError: message, but that does not work. If i print the
> largestNumber
> to the transcript after each iteration the number eventually becomes
> "Infinity", but no exception is thrown. Instead the
> following seems to
> do the trick:
>
> computeLargestNumber
> | one floatingRadix fullMantissaNumber |
> one _ 1 asFloat.
> floatingRadix _ self radix asFloat.
> fullMantissaNumber _ one - (floatingRadix * self
> negativeMachinePrecision).
> [largestNumber _ fullMantissaNumber.
> fullMantissaNumber _ fullMantissaNumber * floatingRadix.
> fullMantissaNumber isInfinite] whileFalse
>
> Also, I was wondering what the heck Infinity is. If one does
> a 'Float
> inspect' and looks at the 'classPool', they will see that
> Infinity is a
> class variable of Float, but that its value is Infinity?
>
> Thanks,
> AKH
>
>
> --
> *******************************************
> Andrew Henrick
> Department of Aerospace and Mechanical Engineering
> University of Notre Dame
> http://newton.ame.nd.edu/~ahenrick
>
> Los Alamos National Laboratory
> Dynamic eXperimentation Division 2
> Phone: 5-1137
> Mail Stop: SM C920
>
> "Ah, I know the lion by his paw!"
> - Johann Bernoulli after Newton discovered the solution to the
> brachistochrone problem
>
> "If we knew what it was we were doing, it would not be called
> research, would it?"
> - Albert Einstein
>
> "When you say 'I wrote a program that crashed Windows',
> people just stare at
> you blankly and say 'Hey, I got those with the system, *for
> free*'." -
> - Linus Torvalds
> *******************************************
>
>
More information about the Squeakland
mailing list