template<template< typename U, typename V, typename...Args > class ObjectType = std::map, template< typename U, typename...Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = int64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator></div>
<p>Create an floating-point number JSON value with a given content. This constructor allows any type that can be used to construct values of type <aclass="el"href="classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html#aacf6c869f6a9c66ac1bc99e93f310044">number_float_t</a>. Examples may include the types <code>float</code>.</p>
<tr><tdclass="paramname">CompatibleNumberFloatType</td><td>a floating-point type which is compatible to <aclass="el"href="classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html#aacf6c869f6a9c66ac1bc99e93f310044">number_float_t</a>.</td></tr>
</table>
</dd>
</dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">value</td><td>a floating-point to create a JSON number from</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>RFC 7159 <ahref="http://www.rfc-editor.org/rfc/rfc7159.txt">http://www.rfc-editor.org/rfc/rfc7159.txt</a>, section 6 disallows NaN values: <blockquoteclass="doxtable">
<p>Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. </p>
</blockquote>
In case the parameter <em>value</em> is not a number, a JSON null value is created instead.</dd></dl>
<dlclass="section user"><dt>Example</dt><dd>The example below shows the construction of several JSON floating-point number values from compatible types. <divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="preprocessor">#include <json.hpp></span></div>
<divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment">// create values of different floating-point types</span></div>
<divclass="ttc"id="classnlohmann_1_1basic__json_html"><divclass="ttname"><ahref="classnlohmann_1_1basic__json.html">nlohmann::basic_json</a></div><divclass="ttdoc">a class to store JSON values </div><divclass="ttdef"><b>Definition:</b> json.hpp:121</div></div>
<divclass="ttc"id="namespacenlohmann_html"><divclass="ttname"><ahref="namespacenlohmann.html">nlohmann</a></div><divclass="ttdoc">namespace for Niels Lohmann </div><divclass="ttdef"><b>Definition:</b> json.hpp:56</div></div>
</div><!-- fragment --> Output: <preclass="fragment">42.2299995422363
null
23.42
</pre> The example code above can be translated with<preclass="fragment">g++ -std=c++11 -Isrc doc/examples/basic_json__CompatibleNumberFloatType.cpp -o basic_json__CompatibleNumberFloatType </pre>.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classnlohmann_1_1basic__json_a80a89ddbe4cb7ef15b049febee208cc8.html#a80a89ddbe4cb7ef15b049febee208cc8"title="create a floating-point number (explicit) ">basic_json(const number_float_t)</a></dd></dl>