[11742] in Athena Bugs

home help back first fref pref prev next nref lref last post

Your OLC question about "c"

daemon@ATHENA.MIT.EDU (wchuang@MIT.EDU)
Mon Feb 14 21:12:26 1994

From: wchuang@MIT.EDU
Date: Mon, 14 Feb 94 21:12:16 -0500
To: "."  <bhoffman@MIT.EDU>
Cc: alkarim@MIT.EDU, bugs@MIT.EDU

--------

Hello... I'm sorry I couldn't answer your OLC question before you logged
out.  Your question was:

> Hello...is there a bug with the cbrt() math.h function on the DECstation
> s? It's just giving me totally bogus output...here's the code snippit:
> 
>  fraction = ((12*max_moment)/stress_allow);
>   height = cbrt(fraction);
>   printf("fraction: %lf",fraction);
>   printf("height: %lf",height);
> 
> fraction comes out right, but height ends up being like 250 billion something.
> all variables are type double.
> Thanks

The reason this is not working is because the cbrt() function is not
prototyped in the include file math.h.  If you add the following to your
C code declarations:

	double cbrt(double);

if you are using ANSI style declarations, or:

	double cbrt();

if you are using old K&R style declarations, the cbrt() function will
return the correct results.  I am also forwarding this question to the
"bugs" mailing list, so that it can be dealt with and fixed in the
future.

I hope this answers your question, and thanks for using OLC!

					o William Chuang
					o CSS Student Consultant

home help back first fref pref prev next nref lref last post