🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #46667

PROBLEM: 'pow' function not converting int to double???

#46667
From: Joel L. Seber ... CH210
Date: Thu, 03 Nov 1994 00:50
39 lines
1841 bytes
I am running gcc version 2.4 on a Sun Sparcstation 1, SUNOS 4.1.3_U1, 16MB
RAM.

I am having difficulty with the 'pow' function.  As stated in several ANSI C
texts, I should be able to do this:

pow ( variable, 2 )

as well as:

pow ( variable, 2.0 ).

When I run the program in question (the quadradic formula) with the 
constant 2, I get the following errored results:

neg**non-integral: DOMAIN error
For a,b,c of  1.00 -2.00 -3.00
The value of the discrim is   NaN

Whereas if I run it with the constant 2.0, I get:

For a,b,c of  1.00 -2.00 -3.00
The value of the discrim is  16.00

which is correct!  Anyone know what has happened here and willing to help?
It would be much appreciated...

Please email me directly.

Thanks in advance,

Joel L. Seber                           | Dry humor is wasted around here.
SUN Workstation Laboratory Manager      |                 -Joel L. Seber
Center for Manufacturing Research       |
      and Technology Utilization        | recursive, adj.
Tennessee Technological University      |     See 'recursive'
Cookeville, TN  38505                   |
                                        | What if there were no hypothetical
jls2013@tntech.edu                      |   situations?     -Steven Wright
Technical Details
Message-ID: <1994Nov2.185002.4596@atlas.tntech.edu>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!darwin.sura.net!atlas.tntech.edu!jls2013

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,57988c7611bc94a3,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1994-11-02 16:50:02 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!darwin.sura.net!atlas.tntech.edu!jls2013
From: jls2013@tntech.edu (Joel L. Seber ... CH210)
Newsgroups: gnu.gcc.help
Subject: PROBLEM: 'pow' function not converting int to double???
Message-ID: <1994Nov2.185002.4596@atlas.tntech.edu>
Date: 2 Nov 94 18:50:02 -0600
Organization: Tennessee Tech University
Lines: 39