Top Description Fields Constructors Methods
org.apache.poi.ss.formula.functions

public Class Rate

extends Object
implements Function
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.Function
Imports
org.apache.logging.log4j.LogManager, .Logger, org.apache.poi.ss.formula.eval.ErrorEval, .EvaluationException, .NumberEval, .OperandResolver, .ValueEval

Implements the Excel Rate function

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public
Rate()

Method Summary

Modifier and TypeMethod and Description
private static double
_g_div_gp(double r, double n, double p, double x, double y, double w)

pack-priv static double

Returns:

rate of interest per period or NaN if the solution didn't converge
calculateRate
(double
Number of compounding periods
nper
,
double
Payment
pmt
,
double
Present Value
pv
,
double
Future value
fv
,
double
When payments are due ('begin' (1) or 'end' (0))
type
,
double
Starting guess for solving the rate of interest
guess
)

Compute the rate of interest per period.

pack-priv static void
checkValue(double result)

Excel does not support infinities and NaNs, rather, it gives a #NUM!

public ValueEval
evaluate(ValueEval[]
the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.
args
,
int
row index of the cell containing the formula under evaluation
srcRowIndex
,
int
column index of the cell containing the formula under evaluation
srcColumnIndex
)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

Rateback to summary
public Rate()

Method Detail

_g_div_gpback to summary
private static double _g_div_gp(double r, double n, double p, double x, double y, double w)
calculateRateback to summary
pack-priv static double calculateRate(double nper, double pmt, double pv, double fv, double type, double guess)

Compute the rate of interest per period. The implementation was ported from the NumPy library, see https://github.com/numpy/numpy-financial/blob/d02edfb65dcdf23bd571c2cded7fcd4a0528c6af/numpy_financial/_financial.py#L602

Parameters
nper:double

Number of compounding periods

pmt:double

Payment

pv:double

Present Value

fv:double

Future value

type:double

When payments are due ('begin' (1) or 'end' (0))

guess:double

Starting guess for solving the rate of interest

Returns:double

rate of interest per period or NaN if the solution didn't converge

checkValueback to summary
pack-priv static void checkValue(double result) throws EvaluationException

Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases

Exceptions
EvaluationException:
(#NUM!) if result is NaN or Infinity
evaluateback to summary
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

Parameters
args:ValueEval[]

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.

srcRowIndex:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

row index of the cell containing the formula under evaluation

srcColumnIndex:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

column index of the cell containing the formula under evaluation

Returns:ValueEval

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

The evaluated result, possibly an ErrorEval, never null

Note

- Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate to Double#NaN be sure to translate the result to ErrorEval#NUM_ERROR.

Annotations
@Override