manpagez: man pages & more
info mpfr
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.8 Input and Output Functions

This section describes functions that perform input from an input/output stream, and functions that output to an input/output stream. Passing a null pointer for a stream to any of these functions will make them read from stdin and write to stdout, respectively.

When using any of these functions, you must include the <stdio.h> standard header before ‘mpfr.h’, to allow ‘mpfr.h’ to define prototypes for these functions.

Function: size_t mpfr_out_str (FILE *stream, int base, size_t n, mpfr_t op, mpfr_rnd_t rnd)

Output op on stream stream, as a string of digits in base base, rounded in the direction rnd. The base may vary from 2 to 62. Print n significant digits exactly, or if n is 0, enough digits so that op can be read back exactly (see mpfr_get_str).

In addition to the significant digits, a decimal point (defined by the current locale) at the right of the first digit and a trailing exponent in base 10, in the form ‘eNNN’, are printed. If base is greater than 10, ‘@’ will be used instead of ‘e’ as exponent delimiter.

Return the number of characters written, or if an error occurred, return 0.

Function: size_t mpfr_inp_str (mpfr_t rop, FILE *stream, int base, mpfr_rnd_t rnd)

Input a string in base base from stream stream, rounded in the direction rnd, and put the read float in rop.

This function reads a word (defined as a sequence of characters between whitespace) and parses it using mpfr_set_str. See the documentation of mpfr_strtofr for a detailed description of the valid string formats.

Return the number of bytes read, or if an error occurred, return 0.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.