I get this error: floating point error in math.pow()
The line has math.pow(a,2)
Does this mean 'a' is a NaN? And is there any way to check in Nasal if a variable is NaN?
// Toss a runtime error for any NaN or Inf values produced. Note that
// this assumes an IEEE 754 format.
#define VALIDATE(r) (valid(r.num) ? (r) : die(c, __FUNCTION__+2))
static int valid(double d)
{
union { double d; unsigned long long ull; } u;
u.d = d;
return ((u.ull >> 52) & 0x7ff) != 0x7ff;
}
static naRef die(naContext c, const char* fn)
{
naRuntimeError(c, "floating point error in math.%s()", fn);
return naNil();
}
Users browsing this forum: No registered users and 1 guest