Re: Help! I'm new to Fortran 77



Rich Townsend wrote:
> glen herrmannsfeldt wrote:
....
>> Ask a physicist and a computer scientist about sin(1e50) and compare
>> the answers you get.
>
> I think most physicists would ask why you wanted this value. IIRC, we
> had a long discussion about this a year or two back -- I think it was
> that particular debate that turned our own Tom Riddle into his
> present incarnation.

Of course a language needs to be designed for *both* the
physicist and the computer scientist. And other folks as
well. Mathematicians are notable for their omission
in the above. Why are they left out?

One of the problems is that this disparity of purpose
leads some people to make ludicrous recommendations.
There as some, for example, that claim that the domain
of the trig functions should be restricted (and you should
get an exception - or, in Fortran, a run-time error - when
the angle is so large as to be outside the domain). This
is not, in itself, a ludicrous suggestion.

But the domain they recommend often is. It's fairly easy to
justify requiring angles to be in the interval of [minus PI to
PI] inclusive. You can't represent all angles with less. It's
perhaps as easy to justify the interval of [minus two PI through
two PI] inclusive. Any interval larger than that is increasingly
less defensible. Three PI is less defensible than two PI, four
PI is less defensible than three PI, and so on. The number
often recommended is *way* out - on the order of 10^7 for
IEEE single precision. Even based on the argument used
by the promoters of such a bound, choosing such a large
bound is practically useless! Naive programmers will
continue to lose significance and will likely never run into
the bound - not just in a given program, but never in their
whole career.

More sophisticated users exist (who understand the issues:
yes there really is an angle whose value is 2^35, and it's
exactly representable, and a mathematician might very well
have a reason to want the sine of it). For such users, a
completely arbitrary bound is seen (correctly) as foolish.
If the maximum magnitude of an angle is two PI, then that's
a simple, memorable, and sensible bound that few will
disagree with. The mathematician will then understand
that (s)he must do argument reduction separately. But,
an arcane and arbitrary bound is not sensible. In order
to implement trig functions up to any *large* bound, the
implementor must have done nearly *all* of the work
required for careful argument reduction on the whole range
of floating point representations, but is then denying use of
that algorithm to those that could benefit.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.



Relevant Pages

  • Re: Does any of this make sense ???
    ... Neither am I a professional mathematician. ... > physicists with their actual research or anything like that. ... > see time as a real facet of existence. ... Or, stated in another way, "Time IS changing patterns ...
    (sci.physics.relativity)
  • Re: Clear writing about relativity
    ... Most physicists ... algebra, ... In the second place the function tauis not linear. ... but a mathematician or logician ...
    (sci.physics.relativity)
  • Re: Clear writing about relativity
    ... Most physicists ... algebra, ... In the second place the function tauis not linear. ... but a mathematician or logician ...
    (sci.physics.relativity)
  • Re: Clear writing about relativity
    ... Most physicists ... readers comprehend the astonishing simplicity of ... algebra, ... but a mathematician or logician ...
    (sci.physics.relativity)
  • Re: ECC logging implementation
    ... Perhaps we should use physicists to write parallel programs -:) At ... I was speaking as a pure mathematician - and, what we prove, ... Its not that modern systems don't show these kinds of behaviors, ...
    (comp.arch)