BigFloatEnv.setPrec

Calls the given function with the given precision and exponent size in the global floating point environment and returns its result.

Syntax

BigFloatEnv.setPrec(func, prec, expBits?)

Parameters

Return value

The result of calling func.

Example

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

See also