1833757 Members
3116 Online
110063 Solutions
New Discussion

wrong formula

 
SOLVED
Go to solution
Werner Rips
Advisor

wrong formula

Tried some maths like this:
x1 = ((x1 + k / x1) * 0.5);
x1 = ((x1 + k / x1) / 2.0);
where x1 and k are float and x1 = 1.0, k = 4.0;
The first formular gives nan, the second works.

Is it a compiler error?

what /opt/ansic/bin/cc gives:
cc:
LINT B.11.11.06 CXREF B.11.11.06
HP92453-01 B.11.11.06 HP C Compiler
$ Sep 8 2000 23:13:51 $

Any help would be appreciated.
Thanks in advance,
Werner
4 REPLIES 4
Ravi_8
Honored Contributor

Re: wrong formula

Hi,

have u included
#include ?
never give up
Werner Rips
Advisor

Re: wrong formula

Yes, i have, but doesn't help.

Tried bundled compiler, -> works!
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: wrong formula

I can't reproduce your problem and I am running the B.11.06 version of the ANSI/C compiler; however, I do have PHSS_28706 installed and that is probably the difference.
If it ain't broke, I can fix that.
Werner Rips
Advisor

Re: wrong formula

Thank you Clay,
installed the patch and the problem has gone.
Werner