JSVAL_TO_DOUBLE

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSVAL_TO_DOUBLE
  • Revision title: JSVAL_TO_DOUBLE
  • Revision id: 111995
  • Created:
  • Creator: lw
  • Is current revision? No
  • Comment 4 words removed

Revision Content

Casts a given jsval to a jsdouble without any type checking or error handling.

Syntax

jsdoubleJSVAL_TO_DOUBLE(jsval v);

Description

JSVAL_TO_DOUBLE casts a specified JS value, v, to a C floating-point number of type jsdouble. As a precondition, JSVAL_IS_DOUBLE(v) must be true. This function is not type-safe: if v is an integer, string, null, or anything else, the behavior is undefined.

To convert any value to a number, use JS_ValueToNumber instead.

{{ LXRSearch("ident", "i", "JSVAL_TO_DOUBLE") }}

Revision Source

<p>Casts a given <code><a href="/En/SpiderMonkey/JSAPI_Reference/Jsval" title="en/jsval">jsval</a></code> to a <code><a href="/en/SpiderMonkey/JSAPI_Reference/jsdouble" title="en/jsdouble">jsdouble</a> </code>without any type checking or error handling.</p>
<h3 name="Syntax">Syntax</h3>
<pre class="eval"><a href="/en/SpiderMonkey/JSAPI_Reference/jsdouble" title="en/SpiderMonkey/JSAPI Reference/jsdouble">jsdouble</a> * <strong>JSVAL_TO_DOUBLE</strong>(<a href="/En/SpiderMonkey/JSAPI_Reference/Jsval" title="En/SpiderMonkey/JSAPI Reference/Jsval">jsval</a> v);
</pre>
<h3 name="Description">Description</h3>
<p><code>JSVAL_TO_DOUBLE</code> casts a specified JS value, <code>v</code>, to a C floating-point number of type <code>jsdouble</code>. As a precondition, <code><a href="/en/SpiderMonkey/JSAPI_Reference/JSVAL_IS_DOUBLE" title="en/SpiderMonkey/JSAPI Reference/JSVAL IS DOUBLE">JSVAL_IS_DOUBLE</a>(v)</code> must be true. This function is not type-safe: if <code>v</code> is an integer, string, null, or anything else, the behavior is undefined.</p>
<p>To <em>convert</em> any value to a number, use <a href="/en/SpiderMonkey/JSAPI_Reference/JS_ValueToNumber" title="en/JS_ValueToNumber">JS_ValueToNumber</a> instead.</p>
<p>{{ LXRSearch("ident", "i", "JSVAL_TO_DOUBLE") }}</p>
Revert to this revision