Calls the given function with the given precision and exponent size in the global floating point environment and returns its result.
BigFloatEnv.setPrec(func, prec, expBits?)
func
A function to call.
prec
The precision in bits.
expBits optional
The exponent size in bits. If not specified, the exponent size is set to BigFloatEnv.expBitsMax.
The result of calling func.
let show = (s) => print(s, BigFloatEnv.prec, BigFloatEnv.expBits)
show("before")
BigFloatEnv.setPrec(() => { show("inside") }, 53, 11)
show("after")
before 113 15
inside 53 11
after 113 15
print(PI)
BigFloatEnv.setPrec(() => { print(PI) }, 53, 11)
print(PI)
3.1415926535897932384626433832795028
3.141592653589793
3.1415926535897932384626433832795028