I'm new to the C programming language. What am I trying to do, to bring the store pie into arbitrary precision and That string has to be changed.
Int calculation PIConst (int preciznost) {// init var mpfr_t x; Mpfr_init2 (ex, presizanost); // Populate P MPFrank_Const_PI (X, MPFR_RNDN); // String four ABC [PRESEZNOSH] to turn ON; Int i; // error is over; Segmentation fault; core dumped; Real-time: 90 mms; User: 0 MMS; System: 0ms // mpfr_get_str (ABC, I, 50, 50, X, MPFR_RNDN); // to write PP mpfr_printf ("PI =% 1.1024RNf \ n", x); Mpfr_clear (x); Return * ABC; }
Here is the mpfr lib documentation documentation
If the documentation If you are not a null pointer to str , then it should point out enough storage blocks for importance, i.e., at least max ( n + 2, 7). The extra two bytes are for a possible loan mark, and for the futile tap character, and 7 accounts for the value - @info @ plus terminating blank characters
In addition, I assume you want your result in base 10, not base 50.
Try it out:
Four ABCs [Presiznost + 2]; / * Handle preciznost & gt; = 5 * /: mpfr_get_str (ABC, I, 10, 50, X, MPFR_RNDN);
No comments:
Post a Comment