Re: Math crashes with translated programs (Rob?)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy Serpa wrote:
> 
> 
> >
> > --------------------------------------------------------
> > constant lim = log(3e+307)  -- needed for chk_pow_args()
> >
> > function chk_pow_args(atom a, atom b)
> > --       ------------
> >     if a > 0.0 then
> >         if b*log(a) < lim then
> >             return 1
> >         end if
> >     elsif a < 0 and integer(a) then
> >         if b*log(-a) < lim then
> >             return 1
> >         end if
> >     end if
> >     return 0
> > end function
> >
> 
> Am I correct in thinking that should be integer(b) instead of integer(a)
> to guard against using a non-integer exponent when the base is negative?

You are right!

Have a nice day, Rolf

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu