Node:I/O of Floats, Next:Miscellaneous Float Functions, Previous:Float Comparison, Up:Floating-point Functions
Functions that perform input from a stdio stream, and functions that output to
a stdio stream. Passing a NULL
pointer for a stream argument to
any of these functions will make them read from stdin
and write to
stdout
, respectively.
When using any of these functions, it is a good idea to include stdio.h
before gmp.h
, since that will allow gmp.h
to define prototypes
for these functions.
size_t mpf_out_str (FILE *stream, int base, size_t n_digits, mpf_t op) | Function |
Print op to stream, as a string of digits. Return the number of
bytes written, or if an error occurred, return 0.
The mantissa is prefixed with an Up to n_digits will be printed from the mantissa, except that no more digits than are accurately representable by op will be printed. n_digits can be 0 to select that accurate maximum. |
size_t mpf_inp_str (mpf_t rop, FILE *stream, int base) | Function |
Read a string in base base from stream, and put the read float in
rop. The string is of the form M@N or, if the base is 10 or
less, alternatively MeN . M is the mantissa and N is the
exponent. The mantissa is always in the specified base. The exponent is
either in the specified base or, if base is negative, in decimal. The
decimal point expected is taken from the current locale, on systems providing
localeconv .
The argument base may be in the ranges 2 to 36, or -36 to -2. Negative values are used to specify that the exponent is in decimal. Unlike the corresponding Return the number of bytes read, or if an error occurred, return 0. |