> > perl -le '$n=1; print "$n   \t",((1 + (1/$n))** $n) while $n*=1.001'
> > [...]
> > When to throw away
> > a result as meaningless is certainly an important piece of wisdom,
> > I do not know any programming languages that do it for you 
> > -- issue a warning when you've overloaded your accuracy instead
> > of merrily returning you your noise -- what do you think?

> What, exactly, would be warned against?

In the case above, the interesting case is a floating point underflow.
IEE754 defines a few ways to determine underflow and requires that a
conforming implementation provide this status information. It additional
defines the concept of a trap, which may optionally be implemented.

So, if perl is to provide compliant floating point support, it should
provide access to the floating point status info (in the standard, this
is confusingly known as exception status). I feel there should also be
either a pragma or a ctor that tells perl to throw exceptions on the
IEE754 trap conditions.

For completeness, this should also be available for integer arithmetic.

(BTW, I think ADA provides this: I can't think of any other common
languages that do)


Dave.
--
Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071; http://www.fast-chip.com
Opinions my own; statements of fact may be in error. 

Reply via email to