Mail Archives: djgpp/1997/08/20/13:23:17
Robert Hoehne wrote:
>
> Rich Birch wrote:
> >
> > Here's the code that I am sure is producing the crash (remember it doesn't
> > crash in Rhide) :-
> >
> > float Function::Result(float x) {
> > float result = 0;
> > for (int count = 0; count < num_results; count++) {
> > if (form.Denominator[count]) //so not to divide by zero
From my good old FORTRAN experience it semms that
basicly it's a very bad idea to write if(!foo)
when foo is a floating point number. You'd be
better off writing
if (abs(foo) > SOME_SMALL_VALUE)
assuming abs is a function returnig the absolute value of a variable
and SOME_SMALL_VALUE is something really small, say 10^(-10)
Other than this the code is perfectly legal
> > result += (form.Numerator[count]
> > / form.Denominator[count])
> > * int_power (x, form.Power[count]);
> > }
> > return(result);
> > }
>
--
Wojciech Galazka
Computer Security Advisor
- Raw text -