No subject

uunet!plauger!uucp uunet!plauger!uucp
Tue Jan 19 14:16:38 PST 1993


>From iravcl.ira.uka.de!S_JUFFA  Tue Jan 19 05:03:16 1993 remote from uunet
	from uunet with UUCP; Tue, 19 Jan 93 08:08:02 EST
          id <17124-0airaun1.ira.uka.de>; Tue, 19 Jan 1993 10:23:46 +0100
          id <01GTP73B5YBKDWOOTWaIRAVCL.IRA.UKA.DE>;
          Tue, 19 Jan 1993 10:25:19 MET
Date: 19 Jan 1993 10:25:19 +0100 (MET)
From: uunet!iravcl.ira.uka.de!S_JUFFA
Subject: Your book: The Standard C Library
To: plauger!cray.com!nceg
X-Vms-To: IN%"plauger!cray.com!ncegauunet.UU.NET"
Mime-Version: 1.0
Content-Transfer-Encoding: 7BIT

Dear Mr. Plauger:

I have recently aquired a copy of your book "The Standard C Library". I found
the book to be well organized and equally well written. Having programmed a
floating point package myself, I especially like your treatment of the "math.h"
module containing the transcendental functions. However, I think I have found
a mistake in that section of the book. On page 149, you introduce the macro
HUGE_RAD as being equal to 3.14e30 and explain that you can divide any value
up to HUGE_RAD by pi/2 and still get a value that you can convert to a long
without fear of overflow. From figure 7.15 (showing xsin.c) on the following
page one can see that HUGE_RAD is indeed used according to the description.
As longs can only hold values of up to 2^31-1, the value of HUGE_RAD is far too
big. I think that what you meant to assign to HUGE_RAD is 3.14*2^30 ~ 3.22e9.
Dividing this by pi/2 would give a number slightly smaller than 2^31-1. With
the current value of HUGE_RAD, about 100 bits would be needed to respresent
the result of a division by pi/2 without overflow.

Norbert
--------------------------------------------------------------------------------
Norbert Juffa        email: S_JUFFAaIRAVCL.IRA.UKA.DE         Live and let live!




More information about the Numeric-interest mailing list