RosettaCodeData/Task/Eulers-constant-0.5772.../FreeBASIC/eulers-constant-0.5772...-3...

24 lines
519 B
Plaintext

' ******************************************
'Subject: Euler's constant 0.5772...
'tested : FreeBasic 1.08.1 with mpfr 4.1.0
'-------------------------------------------
#include "gmp.bi"
#include "mpfr.bi"
dim as mpfr_ptr a = allocate(len(__mpfr_struct))
dim as ulong e2, e10
dim as double tim = TIMER
'decimal precision
e10 = 100
'binary precision
e2 = (1 + e10) / .30103
mpfr_init2 (a, e2)
mpfr_const_euler (a, MPFR_RNDN)
mpfr_printf (!"gamma %.*Rf\n\n", e10, a)
gmp_printf (!"time: %.7f s\n", TIMER - tim)
end