MCPcopy Create free account
hub / github.com/Snapchat/Valdi / JS_NewFloat64

Function JS_NewFloat64

third-party/quickjs/include/quickjs/quickjs.h:539–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537 }
538 return v;
539}
540
541JSValue JS_NewBigInt64(JSContext* ctx, int64_t v);
542JSValue JS_NewBigUint64(JSContext* ctx, uint64_t v);
543
544static js_force_inline JSValue JS_NewFloat64(JSContext* ctx, double d) {
545 JSValue v;
546 int32_t val;
547 union {
548 double d;
549 uint64_t u;
550 } u, t;
551 u.d = d;
552 val = (int32_t)d;
553 t.d = val;
554 /* -0 cannot be represented as integer, so we compare the bit
555 representation */
556 if (u.u == t.u) {
557 v = JS_MKVAL(JS_TAG_INT, val);
558 } else {
559 v = __JS_NewFloat64(ctx, d);
560 }

Callers 8

onNewNumberMethod · 0.85
tsn_nowFunction · 0.85
tsn_binary_arith_slowFunction · 0.85
tsn_add_slow_numbersFunction · 0.85
tsn_unary_arith_slowFunction · 0.85
tsn_op_divFunction · 0.85
tsn_op_expFunction · 0.85
tsn_doubleFunction · 0.85

Calls 1

__JS_NewFloat64Function · 0.85

Tested by

no test coverage detected