Package com.singularsys.jep.bigdecimal
Class BigDecFunctionTable
java.lang.Object
com.singularsys.jep.FunctionTable
com.singularsys.jep.bigdecimal.BigDecFunctionTable
- All Implemented Interfaces:
FixedPrecisionFunctionI,JepComponent,Serializable
A function table for BigDecimals.
Has a MathContext field which can be used by functions.
The table supplies the follow functions:
abs(x)absolute value,signum(x)sign of the argument either 1, 0 or -1.if(cond,x,y)if statement,rint(x)round to nearest integer, , rint(x,n) with ties rounded to even numbersrint(x,n)round to n decimal placesround(x)round to nearest integer, , rint(x,n) with ties rounded to positive infinityround(x,n)round to n decimal placesroundSF(x,n)round x to n significant figures,ceil(x)round up to nearest integer valuefloor(x)round down to nearest integer valuesumsum of arguments,vsumsum the elements of a vector,avgmean of the elements of a vector,minminimum element of a vector,maxmaximum element of a vector,countnumber of the elements in a vector,
- Version:
- Jep 3.5 Added min, max and various rounding functions.
- See Also:
-
Field Summary
FieldsFields inherited from class com.singularsys.jep.FunctionTable
table -
Constructor Summary
ConstructorsModifierConstructorDescriptionBigDecFunctionTable(MathContext mc, int scale) Fixed precision functions.protected -
Method Summary
Modifier and TypeMethodDescriptionintGets the number of decimal places used.voidsetDecimalPlaces(int scale) Sets the number of decimal places to use.voidReturns a new shallow copy of this function table.Methods inherited from class com.singularsys.jep.FunctionTable
addFunction, addFunctionIfSet, clear, containsKey, containsValue, copyFunctionsFrom, entrySet, getFunction, getLightWeightInstance, init, isEmpty, keySet, remove, size, threadSafeMapCopy, toString, values
-
Field Details
-
mc
-
scale
protected int scale
-
-
Constructor Details
-
BigDecFunctionTable
-
BigDecFunctionTable
Fixed precision functions.- Parameters:
mc- MathContext, usuallyMathContext.UNLIMITED.scale- number of decimal digits should be greater or equal to zero.- Since:
- Jep 4.1
-
BigDecFunctionTable
-
-
Method Details
-
getMathContext
-
setMathContext
-
shallowCopy
Description copied from class:FunctionTableReturns a new shallow copy of this function table. Calls theFunctionTable.threadSafeMapCopy()method to ensure the table is safe to use a separate thread. All subclasses should override this method to create a function table of the matching type. A typical implementation would be@Override public FunctionTable shallowCopy() { Map<String,PostfixMathCommandI> newMap = this.threadSafeMapCopy(); return new myFunctionTable(newMap); }using theFunctionTable.threadSafeMapCopy()method to return a copy of the map of functions and a constructor taking this map which uses theFunctionTable(Map)constructor.- Overrides:
shallowCopyin classFunctionTable- Returns:
- a new shallow copy of this function table
-
setDecimalPlaces
public void setDecimalPlaces(int scale) Description copied from interface:FixedPrecisionFunctionISets the number of decimal places to use.- Specified by:
setDecimalPlacesin interfaceFixedPrecisionFunctionI- Parameters:
scale- either zero, a positive number or -1 for floating-point formats
-
getDecimalPlaces
public int getDecimalPlaces()Description copied from interface:FixedPrecisionFunctionIGets the number of decimal places used.- Specified by:
getDecimalPlacesin interfaceFixedPrecisionFunctionI- Returns:
- either zero, a positive number or -1 for floating-point formats
-