summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_cnvtf.rst
blob: f2b0fa88b548204a2f7ba369275e29042eb43a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
PR_cnvtf
========

Converts a floating point number to a string.


Syntax
------

.. code::

   #include <prdtoa.h>

   void PR_cnvtf (
     char *buf,
     PRIntn bufsz,
     PRIntn prcsn,
     PRFloat64 fval);


Parameters
~~~~~~~~~~

The function has these parameters:

``buf``
   The address of the buffer in which to store the result.
``bufsz``
   The size of the buffer provided to hold the result.
``prcsn``
   The number of digits of precision to which to generate the floating
   point value.
``fval``
   The double-precision floating point number to be converted.


Description
-----------

:ref:`PR_cnvtf` is a simpler interface to convert a floating point number
to a string. It conforms to the ECMA standard of Javascript
(ECMAScript).

On return, the result is written to the buffer pointed to by ``buf`` of
size ``bufsz``.