Integer division with / - request explanation of behavior

Robert Klemme wrote:

/ ...

> I
> know a case where a legacy system doing static calculus was replaced by
> a new system on a totally different OS platform. Data was migrated and
> afterwards people complained that the new system was doing the match
> wrong. It turned out that it was the *old* system that actually had the
> math wrong. They were lucky that in years no building crashed because
> of this...

That's a great story. I hope its details are written up somewhere. You may
be aware there is a lot of academic interest in examples where erroneous
computer results come to be accepted, even defended as accurate.

I am reminded of a scene in "Rain Man" in which the idiot savant played by
Dustin Hoffman is asked to provide a difficult mathematical result, while
the questioner simultaneously computes it on a calculator. The savant
replies with the exact number of decimal places that the calculator
produces, no more, no less, for a problem that produces an irrational
result. This is obviously for the benefit of the nonspecialist in the
audience, who would have been *less* impressed if the savant had offered
more digits than the calculator -- those extra digits couldn't possibly be
real, could they, otherwise the calculator would have provided them.

Would you mind if I suggest this Ruby Quiz

compute *all* didgits of Pi, if you have less time, just compute the *last*
digit of Pi.

Robert

/ ...

···

On 9/30/06, Paul Lutus <nospam@nosite.zzz> wrote:

>> There's a can of worms. It turns out the behavior of the different
>> languages WRT conversion from and to base ten leads to some borderline
>> failures if the textual forms are transferred between environments.
>
> I am sure, conversion is yet another standard. :slight_smile: Or maybe not:

I think this is part of a standard, and it's usually followed to the
letter.

/ ...

> The question is whether one should
> rely on the binary <-> text conversion. The best for decimal accuracy
> is probably BCD anyway...

Yes. My point is that this business of converting between binary and
text/base-ten forms is generally very reliable, both within and between
environments, Perl apparently excepted.

Not to say that the numbers themselves represent precise quantities, but
that they can be reliably converted and compared to each other.

--
Paul Lutus
http://www.arachnoid.com

--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein

Robert Dober wrote:

Would you mind if I suggest this Ruby Quiz

compute *all* didgits of Pi, if you have less time, just compute the
*last*
digit of Pi.

Easy as pi ... just use the Ruby language "call with continued fraction"
feature.

I fail to understand, why use fractions Pi is defined as 42 of course. 8-]

···

On 9/30/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

Robert Dober wrote:
> Would you mind if I suggest this Ruby Quiz
>
> compute *all* didgits of Pi, if you have less time, just compute the
> *last*
> digit of Pi.

Easy as pi ... just use the Ruby language "call with continued fraction"
feature.

--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein