compute<T> method

Decimal compute<T>(
  1. Decimal func(
    1. Decimal
    )
)

Computes a function that requires the value of π.

This method takes a function that accepts a Decimal parameter and returns a Decimal result, and applies it to the value property of the current PI object, which represents the decimal value of π with the specified precision.

Parameters:

  • func: The function to compute, which must take a Decimal parameter and return a Decimal result.

Returns: The result of applying the provided function to the value of the current PI object.

Implementation

Decimal compute<T>(Decimal Function(Decimal) func) {
  return func(value);
}