Tolerate lack of C99 in MSVC.

This commit is contained in:
James Turner 2013-01-23 16:01:46 +01:00
parent 5b92575ed3
commit 94a6cb2cff

View File

@ -120,6 +120,7 @@ static naRef f_clamp(naContext c, naRef me, int argc, naRef* args)
static naRef f_periodic(naContext c, naRef me, int argc, naRef* args)
{
double range;
naRef a = naNumValue(argc > 0 ? args[0] : naNil());
naRef b = naNumValue(argc > 1 ? args[1] : naNil());
naRef x = naNumValue(argc > 2 ? args[2] : naNil());
@ -127,7 +128,7 @@ static naRef f_periodic(naContext c, naRef me, int argc, naRef* args)
if(naIsNil(a) || naIsNil(b) || naIsNil(x))
naRuntimeError(c, "non numeric arguments to periodic()");
double range = b.num - a.num;
range = b.num - a.num;
x.num = x.num - range*floor((x.num - a.num)/range);
// two security checks that can only happen due to roundoff
if (x.num <= a.num)