MCPcopy Create free account
hub / github.com/cockroachdb/apd / newLoop

Method newLoop

loop.go:36–44  ·  view source on GitHub ↗

newLoop returns a new loop checker. Arguments: - name: name of the function being calculated (for error messages) - arg: argument to the function (for error messages) - precision: desired precision; the loop ends when consecutive estimates differ less than the desired precision.

(name string, arg *Decimal, precision uint32, maxItersPerDigit int)

Source from the content-addressed store, hash-verified

34// - maxItersPerDigit: after this many iterations per digit of precision, the
35// loop ends in error.
36func (c *Context) newLoop(name string, arg *Decimal, precision uint32, maxItersPerDigit int) *loop {
37 return &loop{
38 c: c,
39 name: name,
40 arg: new(Decimal).Set(arg),
41 precision: int32(precision),
42 maxIterations: 10 + uint64(maxItersPerDigit*int(precision)),
43 }
44}
45
46// done reports whether the loop is done. If it does not converge
47// after the maximum number of iterations, it returns an error.

Callers 2

CbrtMethod · 0.80
LnMethod · 0.80

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected