This article covers features introduced in SpiderMonkey 17

Convert a C floating-point number of type double to a JS::Value.

Replacement to JS_NewNumberValue, JS_NewDoubleValue, JS_NewDouble.

Syntax

// Added in SpiderMonkey 42
JS::Value
JS_NumberValue(double d);

// Obsolete since SpiderMonkey 42
jsval
JS_NumberValue(double d);
Name Type Description
d double The numeric value to convert.

Description

JS_NumberValue converts a C floating-point number of type double to JS::Value, the type of JavaScript values.

The result is an integer JS::Value if d can be stored that way. Otherwise, a new floating-point JS::Value is created.

See Also