| 582 | } |
| 583 | |
| 584 | void fx_Math_round(txMachine* the) |
| 585 | { |
| 586 | txNumber arg; |
| 587 | mxNanResultIfNoArg; |
| 588 | if (XS_INTEGER_KIND == mxArgv(0)->kind) { |
| 589 | mxResult->kind = XS_INTEGER_KIND; |
| 590 | mxResult->value.integer = mxArgv(0)->value.integer; |
| 591 | return; |
| 592 | } |
| 593 | arg = fxToNumber(the, mxArgv(0)); |
| 594 | if (c_isnormal(arg) && (-4503599627370495 < arg) && (arg < 4503599627370495)) { // 2 ** 52 - 1 |
| 595 | if ((arg < -0.5) || (0.5 <= arg)) |
| 596 | arg = c_floor(arg + 0.5); |
| 597 | else if (arg < 0) |
| 598 | arg = -0.0; |
| 599 | else if (arg > 0) |
| 600 | arg = 0.0; |
| 601 | } |
| 602 | mxResult->kind = XS_NUMBER_KIND; |
| 603 | mxResult->value.number = arg; |
| 604 | fx_Math_toInteger(the); |
| 605 | } |
| 606 | |
| 607 | void fx_Math_sqrt(txMachine* the) |
| 608 | { |
nothing calls this directly
no test coverage detected