Newsgroups: comp.lang.c,fj.lang.c
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!wnoc-sfc-news!news.Hawaii.Edu!news.caldera.com!enews.sgi.com!nntprelay.mathworks.com!howland.erols.net!infeed2.internetmci.com!newsfeed.internetmci.com!news.msfc.nasa.gov!bcm.tmc.edu!rice!uw-beaver!entropy1!pilchuck!dschmucker
From: dschmucker@tln.net (Darrell Schmucker)
Subject: Re: powl(x,2)+pow(y,2) is not x*x+y*y
X-Nntp-Posting-Host: ppp14.tln.net
Message-ID: <slrn5tavbi.sn.dschmucker@localhost.localdomain>
Sender: news@data-io.com (Usenet news)
Reply-To: dschmucker@tln.net
Organization: Data I/O Corporation, Redmond/Seattle WA
X-Newsreader: slrn (0.9.2.0 BETA UNIX)
References: <01bc932e$8bb11bf0$d5a21e85@kusunoki> <33CF6F4A.3B21@ici.net>
Date: Wed, 23 Jul 1997 03:44:37 GMT
Lines: 28
Xref: galaxy.trc.rwcp.or.jp fj.lang.c:4542
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.c&nb=4542&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

On Fri, 18 Jul 1997 09:27:38 -0400, Alicia Carla Longstreet <carla@ici.net> wrote:
>NAGAO wrote:
>> 
>> Could anybody help me, beginner of scientific programming?
>> 
>> Using Visual C++2.0.
>> 
>> long double x;
>> long double y;
>> long double distance2;
>> 
>> distance2 = x*x + y*y;              works good, but
>> distance2 = powl(x,2)+powl(y,2);  sets enormous number to distance2.
>
>I do not know what pow1() is or does.  It is NOT an ANSI standard
>function, so I assume it is some specialized MSVC++ function.  I would
>suggest that you not use it, use pow() instead.

What he is using is powl() (pow-ell) not pow1() (pow-one).  powl() is
the long double version of pow() (and is non-ANSI as you said).

But as for what's wrong, I'm not sure. Have you tried checking the global
error variable (Borland uses "errno") to see if something went wrong
(overflow, etc.) inside the function call?

--
Darrell Schmucker (dschmucker@tln.net)

