[CLN-list] print multi-precision floating number in scientific notation

Po-Hsun Tseng zengbs at gmail.com
Mon Feb 10 05:38:44 CET 2020


Hi CLN developers,

Sorry for frequently asking questions. I have checked manual and searched
mailing list for full example, but nothing inside. Moreover, I only
familiar with C...
Question: How to use `print_float()` to print multi-precision floating
number in scientific notation on terminal? below is the full code I have
ever tried, but it always gives me compilation error.
thanks.

#include <cln/io.h>
#include <cln/float.h>
#include <cln/float_io.h>


using namespace cln;

int main( ) {

    int N = 10;

    cl_F x[N];

    for (int i=0 ;i<N;i++) x[i] =
"0.333333333333333333333333333333333333333333333333333333333333";

//    cl_print_flags.float_readably = true;

    for (int i=0 ;i<N;i++) print_float(stdout,
cl_print_flags.float_readably, x[i]);

    return 0 ;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/cln-list/attachments/20200210/b08094e2/attachment.htm>


More information about the CLN-list mailing list