[Haskell-cafe] Re: A question about "monad laws"

Yitzchak Gale gale at sefer.org
Tue Feb 12 07:33:35 EST 2008

I wrote:
>> Floating point intentionally trades accuracy for speed,

Jerzy Karczmarczuk wrote:
> 1. This is not a possible "trade-off" or not. In scientific/engineering
>   computation there is really no choice, since you have to compute
>   logarithms, trigonometric functions, etc., and some inaccuracy is
>   unavoidable. Of course, one may use intervals, and other extremely
>   costly stuff, but if the stability of the algorithms is well controlled,
>   and in normal case it is (especially if the basic arithmetics has some
>   extra control bits to do the rounding), th issue is far from being
>   mortal.

Agreed. That is what I meant by "trade-off". And I am not trying
to say at all that it is wrong to use it. Life is full of trade-offs.

>> It used to be true - and may still be - that the engineers
>> who implement floating point in the hardware of our
>> CPUs would never fly on commercial airliners. Would you?

> 2. The story about engineering not flying commercial planes is largely
>   anecdotical, and you know that. Repeating it here doesn't change much.

I heard it from someone who personally worked with one such team
of engineers about ten years ago.

>> Would you entrust your country's nuclear arsenal to an
>> automated system that depends on floating point arithmetic?

> 3. Nuclear arsenal is never really "entrusted to an automated system",
>   because of reasons much beyond the fl.point inaccuracies.

Yes, of course, no one is really that stupid. Are they?

>   On the other hand, in all those software one has to deal with
>   probabilities, and with imprecise experimental data, so even if for God
>   knows which purpose everything used exact algebraic numbers, or
>   controlled transcendental extensions, the input imprecision would kill
>   all the sense of infinitely precise computations thereupon.
> 4. The non-reliability of engineering software has many more important
>   reasons, sometimes incredibly stupid, such as the confusion between
>   metric and English units in the Mars Climate Orbiter crash...
>   The Ariane 5 crash was the result not of the floating-point computation
>   but of the conversion to signed 16-bit numers (from a 64bit double).

Yes, high reliability is very hard. There are many factors that
make it hard; floating point is undeniably one of them.
Again - that doesn't mean that floating point should not be used.
It is a powerful and important tool, as you say.

I was once part of a software project in which people's lives
might depend on there not being any bugs in my code.
It was an experience that changed my life forever,
and that is probably one of the factors that contributes
to my interest in Haskell.


More information about the Haskell-Cafe mailing list