| 94 | } |
| 95 | |
| 96 | void fx_BigInt(txMachine* the) |
| 97 | { |
| 98 | if (mxHasTarget) |
| 99 | mxTypeError("new: BigInt"); |
| 100 | if (mxArgc > 0) |
| 101 | *mxResult = *mxArgv(0); |
| 102 | fxToPrimitive(the, mxResult, XS_NUMBER_HINT); |
| 103 | if (mxResult->kind == XS_NUMBER_KIND) { |
| 104 | int fpclass = c_fpclassify(mxResult->value.number); |
| 105 | txNumber check = c_trunc(mxResult->value.number); |
| 106 | if ((fpclass != C_FP_NAN) && (fpclass != C_FP_INFINITE) && (mxResult->value.number == check)) |
| 107 | fxNumberToBigInt(the, mxResult); |
| 108 | else |
| 109 | mxRangeError("cannot coerce number to bigint"); |
| 110 | } |
| 111 | else if (mxResult->kind == XS_INTEGER_KIND) { |
| 112 | fxIntegerToBigInt(the, mxResult); |
| 113 | } |
| 114 | else |
| 115 | fxToBigInt(the, mxResult, 1); |
| 116 | } |
| 117 | |
| 118 | txNumber fx_BigInt_asAux(txMachine* the) |
| 119 | { |
nothing calls this directly
no test coverage detected