MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fx_Math_imod

Function fx_Math_imod

xs/sources/xsMath.c:334–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void fx_Math_imod(txMachine* the)
335{
336 txInteger x = (mxArgc > 0) ? fxToInteger(the, mxArgv(0)) : 0;
337 txInteger y = (mxArgc > 1) ? fxToInteger(the, mxArgv(1)) : 0;
338 if (y == 0) {
339 mxResult->kind = XS_NUMBER_KIND;
340 mxResult->value.number = C_NAN;
341 }
342 else {
343 mxResult->kind = XS_INTEGER_KIND;
344#if mxIntegerDivideOverflowException
345 if ((x == (txInteger)0x80000000) && (y == -1))
346 mxResult->value.integer = 0;
347 else
348#endif
349 mxResult->value.integer = (x % y + y) % y;
350 }
351}
352
353void fx_Math_imul(txMachine* the)
354{

Callers

nothing calls this directly

Calls 1

fxToIntegerFunction · 0.85

Tested by

no test coverage detected