kspread
KSpread::ValueCalc Class Reference
#include <valuecalc.h>
Detailed Description
The ValueCalc class is used to perform all sorts of calculations.No other means of calculation should be performed, to achieve transparency, and to ease addition of new datatypes.
Currently, most functions simply convert data to double and work with that. The idea is such that after we add support for bigger precision, we only need to adjust this class and the parsing/formatting/converting classes. All function implementations will remain exactly the same.
Of course, for some functions, it might be impossible to apply them on all datatypes, but since all of them can be applied on both doubles and GnuMP-based numbers, that is not of much concern ;)
Definition at line 69 of file valuecalc.h.
Public Member Functions | |
ValueCalc (ValueConverter *c) | |
ValueConverter * | conv () |
void | setDoc (Doc *d) |
Doc * | doc () |
Value | add (const Value &a, const Value &b) |
Value | sub (const Value &a, const Value &b) |
Value | mul (const Value &a, const Value &b) |
Value | div (const Value &a, const Value &b) |
Value | mod (const Value &a, const Value &b) |
Value | pow (const Value &a, const Value &b) |
Value | sqr (const Value &a) |
Value | sqrt (const Value &a) |
Value | add (const Value &a, double b) |
Value | sub (const Value &a, double b) |
Value | mul (const Value &a, double b) |
Value | div (const Value &a, double b) |
Value | pow (const Value &a, double b) |
Value | abs (const Value &a) |
bool | isZero (const Value &a) |
bool | isEven (const Value &a) |
bool | equal (const Value &a, const Value &b) |
bool | approxEqual (const Value &a, const Value &b) |
bool | greater (const Value &a, const Value &b) |
bool | gequal (const Value &a, const Value &b) |
bool | lower (const Value &a, const Value &b) |
bool | strEqual (const Value &a, const Value &b) |
int | sign (const Value &a) |
Value | roundDown (const Value &a, const Value &digits) |
Value | roundUp (const Value &a, const Value &digits) |
Value | round (const Value &a, const Value &digits) |
Value | roundDown (const Value &a, int digits=0) |
Value | roundUp (const Value &a, int digits=0) |
Value | round (const Value &a, int digits=0) |
Value | log (const Value &number, const Value &base) |
Value | log (const Value &number, double base=10) |
Value | ln (const Value &number) |
Value | exp (const Value &number) |
Value | pi () |
Value | eps () |
Value | random (double range=1.0) |
Value | random (Value range) |
Value | fact (const Value &which) |
Value | fact (const Value &which, const Value &end) |
Value | fact (int which, int end=0) |
Value | factDouble (int which) |
Value | factDouble (Value which) |
Value | combin (int n, int k) |
Value | combin (Value n, Value k) |
Value | gcd (const Value &a, const Value &b) |
Value | lcm (const Value &a, const Value &b) |
Value | base (const Value &val, int base=16, int prec=0) |
Value | fromBase (const Value &val, int base=16) |
Value | sin (const Value &number) |
Value | cos (const Value &number) |
Value | tg (const Value &number) |
Value | cotg (const Value &number) |
Value | asin (const Value &number) |
Value | acos (const Value &number) |
Value | atg (const Value &number) |
Value | atan2 (const Value &y, const Value &x) |
Value | sinh (const Value &number) |
Value | cosh (const Value &number) |
Value | tgh (const Value &number) |
Value | asinh (const Value &number) |
Value | acosh (const Value &number) |
Value | atgh (const Value &number) |
Value | phi (Value x) |
Value | gauss (Value xx) |
Value | gaussinv (Value xx) |
Value | GetGamma (Value _x) |
Value | GetLogGamma (Value _x) |
Value | GetGammaDist (Value _x, Value _alpha, Value _beta) |
Value | GetBeta (Value _x, Value _alpha, Value _beta) |
Value | besseli (Value v, Value x) |
Value | besselj (Value v, Value x) |
Value | besselk (Value v, Value x) |
Value | besseln (Value v, Value x) |
Value | erf (Value x) |
Value | erfc (Value x) |
void | arrayWalk (const Value &range, Value &res, arrayWalkFunc func, Value param) |
void | arrayWalk (QValueVector< Value > &range, Value &res, arrayWalkFunc func, Value param) |
void | twoArrayWalk (const Value &a1, const Value &a2, Value &res, arrayWalkFunc func) |
void | twoArrayWalk (QValueVector< Value > &a1, QValueVector< Value > &a2, Value &res, arrayWalkFunc func) |
arrayWalkFunc | awFunc (const QString &name) |
void | registerAwFunc (const QString &name, arrayWalkFunc func) |
Value | sum (const Value &range, bool full=true) |
Value | sumsq (const Value &range, bool full=true) |
Value | sumIf (const Value &range, const Value &checkRange, const Condition &cond) |
int | count (const Value &range, bool full=true) |
int | countIf (const Value &range, const Condition &cond) |
Value | avg (const Value &range, bool full=true) |
Value | max (const Value &range, bool full=true) |
Value | min (const Value &range, bool full=true) |
Value | product (const Value &range, Value init, bool full=true) |
Value | stddev (const Value &range, bool full=true) |
Value | stddev (const Value &range, Value avg, bool full=true) |
Value | stddevP (const Value &range, bool full=true) |
Value | stddevP (const Value &range, Value avg, bool full=true) |
Value | sum (QValueVector< Value > range, bool full=true) |
int | count (QValueVector< Value > range, bool full=true) |
Value | avg (QValueVector< Value > range, bool full=true) |
Value | max (QValueVector< Value > range, bool full=true) |
Value | min (QValueVector< Value > range, bool full=true) |
Value | product (QValueVector< Value > range, Value init, bool full=true) |
Value | stddev (QValueVector< Value > range, bool full=true) |
Value | stddev (QValueVector< Value > range, Value avg, bool full=true) |
Value | stddevP (QValueVector< Value > range, bool full=true) |
Value | stddevP (QValueVector< Value > range, Value avg, bool full=true) |
void | getCond (Condition &cond, Value val) |
bool | matches (const Condition &cond, Value d) |
Protected Member Functions | |
Value::Format | format (Value::Format a, Value::Format b) |
Protected Attributes | |
ValueConverter * | converter |
Doc * | _doc |
std::map< QString, arrayWalkFunc > | awFuncs |
Member Function Documentation
|
basic arithmetic operations
Definition at line 176 of file valuecalc.cc. |
|
numerical comparison with a little epsilon tolerance
Definition at line 426 of file valuecalc.cc. |
|
Walk the array in function-like style. This method is here to avoid duplication in function handlers. Definition at line 1560 of file valuecalc.cc. |
|
array/range walking
Definition at line 1534 of file valuecalc.cc. |
|
base conversion 10 -> base
Definition at line 718 of file valuecalc.cc. |
|
bessel functions - may also end up being separated from here
Definition at line 1492 of file valuecalc.cc. |
|
combinations
Definition at line 665 of file valuecalc.cc. |
|
numerical comparison
Definition at line 415 of file valuecalc.cc. |
|
error functions (see: man erf)
Definition at line 1522 of file valuecalc.cc. |
|
some computational functions
Definition at line 622 of file valuecalc.cc. |
|
double factorial (every other number multiplied)
Definition at line 650 of file valuecalc.cc. |
|
return result formatting, based on these two values
Definition at line 1852 of file valuecalc.cc. |
|
base conversion base -> 10
Definition at line 744 of file valuecalc.cc. |
|
greatest common divisor
Definition at line 683 of file valuecalc.cc. |
|
numerical comparison - greater or equal
Definition at line 448 of file valuecalc.cc. |
|
This method parses the condition in string text to the condition cond. It sets the condition's type and value. Definition at line 1863 of file valuecalc.cc. |
|
numerical comparison
Definition at line 441 of file valuecalc.cc. |
|
comparison and related
Definition at line 403 of file valuecalc.cc. |
|
lowest common multiplicator
Definition at line 701 of file valuecalc.cc. |
|
logarithms and exponentials
Definition at line 548 of file valuecalc.cc. |
|
numerical comparison
Definition at line 453 of file valuecalc.cc. |
|
Returns true if value d matches the condition cond, built with getCond(). Otherwise, it returns false. Definition at line 1929 of file valuecalc.cc. |
|
some statistical stuff TODO: we may want to move these over to a separate class or something, as the functions are mostly big
Definition at line 910 of file valuecalc.cc. |
|
constants
Definition at line 597 of file valuecalc.cc. |
|
random number from <0.0, range)
Definition at line 612 of file valuecalc.cc. |
|
rounding
Definition at line 458 of file valuecalc.cc. |
|
goniometric functions
Definition at line 755 of file valuecalc.cc. |
|
hyperbolic functions
Definition at line 841 of file valuecalc.cc. |
|
string comparison
Definition at line 436 of file valuecalc.cc. |
|
range functions using value lists
Definition at line 1634 of file valuecalc.cc. |
|
basic range functions
Definition at line 1627 of file valuecalc.cc. |
Member Data Documentation
|
registered array-walk functions
Definition at line 266 of file valuecalc.h. |
The documentation for this class was generated from the following files: