From: Paul A Sand <pas@unh.edu>
Subject: Re: Inaccurate logarithm in Pascal
Date: 1999/03/24 [thread overview]
Message-ID: <7daui4$br3$1@tabloid.unh.edu> (raw)
In-Reply-To: 7dad0r$cha$1@news.net.uni-c.dk
"Morten Skaarup Jensen" <morten@nospam.org> writes:
>(*******************************)
>program main(input,output);
>var
> i:integer;
>begin
> writeln('ln(2)=',ln(2):20:18);
> for i:=1 to 40 do
> writeln('i=',i:2,' 2^i=',exp(i*ln(2)):10:2);
>end.
>(******************************************)
Saith the release notes: ``All floating constants are of type REAL in
DEC Pascal'' If you change both occurrances of
ln(2)
to
ln(2.0d0)
(good old Fortran...)
I think you might see double-precision results. (At least I do here.)
--
-- Paul A. Sand | I can't decide if I'm bragging or
-- University of New Hampshire | complaining.
-- pas@unh.edu | (Mary Loveless, rec.arts.books)
-- http://pubpages.unh.edu/~pas |
next prev parent reply other threads:[~1999-03-24 5:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-23 5:00 Inaccurate logarithm in Pascal Morten Skaarup Jensen
1999-03-23 5:00 ` Steve Lionel
1999-03-24 5:00 ` Morten Skaarup Jensen
1999-03-24 5:00 ` Jarkko Hietaniemi
1999-03-24 5:00 ` Paul A Sand [this message]
1999-03-24 5:00 ` Steve Lionel
1999-03-24 5:00 ` John R. Reagan
1999-03-24 5:00 ` Morten Skaarup Jensen
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox