[Haskell-cafe] Re: A question about "monad laws"
jerzy.karczmarczuk at info.unicaen.fr
jerzy.karczmarczuk at info.unicaen.fr
Wed Feb 13 22:31:00 EST 2008
Trialog:
Roman Leshchinskiy writes:
> Richard A. O'Keefe wrote:
>> jerzy.karczmarczuk at info.unicaen.fr wrote:
>>> Would you say that *no* typical floating-point software is reliable?
>>
>> With lots of hedging and clutching of protective amulets around the
>> word "reliable", of course not. What I *am* saying is that
>> (a) it's exceptionally HARD to make reliable because although the
>> operations
>> are well defined and arguably reasonable they do NOT obey the laws that
>> school and university mathematics teach us to expect them to obey
>
> Ints do not obey those laws, either. It is not exceptionally hard to write
> reliable software using ints. You just have to check for exceptional
> conditions. That's also the case for floating point.
>
> That said, I suspect that 90% of programs that use float and double would
> be much better off using something else. The only reason to use floating
> point is performance.
I have a bit different perspective...
First, when I see the advice "use something else", I always ask "what",
and I get an answer very, very rarely... Well? What do you propose?
Then, the problem is not always pathological, in the sense of "exceptional
conditions". There are touchy points related to the stability of the
algorithms for the solution of differential equations. There are doubtful
random number generators in Monte-Carlo business. There are ill-conditioned
matrices and screwed-up iterative definitions. Algorithms work, work, and
ultimately explode or produce rubbish. The "laws" which get broken are
"almost" respected for a long time, and then we have the Bald Man (Sorites)
paradox...
RAO'K very wisely says that people should avoid reinventing wheels, and
they should use established packages, written by people who know.
The problem *here* is that we would like to have something fabulous in
Haskell - for example... And there aren't too many experts, who would
convert to the Functional Religion just for fun.
What is *much worse*, some potential users who could encourage building
such packages in the numerical domain, typically don't believe that FP
gives anything interesting. At least, this is the opinion of physicists
I spoke to recently.
Never mind. We shall dance over their cadavers, unless they dance over
ours. In both cases we shall be happy.
Jerzy Karczmarczuk
More information about the Haskell-Cafe
mailing list