Re: Absolute

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: "Aidan Bindoff" <abindoff at one.net.au>
To: "Euphoria Programming for MS-DOS" <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, June 10, 2000 10:16 PM
Subject: Absolute


  <SNIP>
>
> If x is the largest possible atom,  what happens when your program calls
> x+1?

if x is the largest possible atom then x must be a float64.
This means that x+1 will yield +inf.  Same rule applies if x is the smallest
possible atom and you tried x-1.  You get -inf.  The program doesn't crash
when it comes to atoms going out of range but it will crash when integers go
out of range.

> Or 2x?  Or any other equation that will make x bigger than x already is?
> Obviously the program will crash. Are there methods commonly used to avoid
> this happening if it is possibly likely (e.g if x>too_big then
> approximate(x) and inform) or do we just hope it doesn't happen?

Euphoria doesn't have error trapping.  For those that don't know what that
is.
Error trapping is when an error occurs and the program is written to try and
handle the error as gracefully as possible.
Example:
  Dave: Add 1 to x
  Hal: I'm sorry, I can't allow you to do that, Dave.

Some computer languages allow error trapping.  When an error occurs during
error trapping the program is sent to a specific set of code that the
programmer has defined to try and handle the error.  When the error occurs a
variable is setup that is a number detailing what the error was that
occurred.
The programmer can define code to handle errors that he knows can occur in
order to keep the program running as long as possible.  The programmer could
also have some emergency shutdown code written in this area.  If an error
was
detected he would have the chance to save and close all files before
crashing
they program.

> How many
> other algorithms that we use every day might possibly crash?

No telling, I just deal with them one at a time as I see them.

>
> I, for one, will only be using the absolute() function you suggested from
> now on. I'm interested to know if you could suggest any more.

Nothing currently comes to mind.

>
> Kind Regards,
> Aidan
>

        Lucius L. Hilley III
        lhilley at cdc.net
+--------------+--------------+
| ICQ: 9638898 | AIM: LLHIII  |
+--------------+--------------+
| http://www.cdc.net/~lhilley |
+-----------------------------+

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu