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

Function fx_Math_idiv

xs/sources/xsMath.c:310–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void fx_Math_idiv(txMachine* the)
311{
312 txInteger x = (mxArgc > 0) ? fxToInteger(the, mxArgv(0)) : 0;
313 txInteger y = (mxArgc > 1) ? fxToInteger(the, mxArgv(1)) : 0;
314 if (y == 0) {
315 mxResult->kind = XS_NUMBER_KIND;
316 mxResult->value.number = C_NAN;
317 }
318 else {
319 mxResult->kind = XS_INTEGER_KIND;
320#if mxIntegerDivideOverflowException
321 if ((x == (txInteger)0x80000000) && (y == -1))
322 mxResult->value.integer = x;
323 else
324#endif
325 mxResult->value.integer = x / y;
326 }
327}
328
329void fx_Math_idivmod(txMachine* the)
330{

Callers

nothing calls this directly

Calls 1

fxToIntegerFunction · 0.85

Tested by

no test coverage detected