Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
Calculate.framework - iPhone Development Wiki

Calculate.framework

From iPhone Development Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Calculate.framework
Private Framework
Availabile 2.0 – present
Headers [headers.cynder.me]


The Calculator framework provides a single function, CalculatePerformExpression, which the only purpose is evaluate a mathematical expression in a string. The usage as same as the Mac OS X counterpart, and is documented in [1].

Recognized expressions

  • Binary operators:
    • and, or, nor, xor, +, -, *, /, <<, >>
  • Constants:
    • pi
  • Unary functions:
    • sqrt, cbrt, exp, ln, log, sin, cos, tan, asin, acos, atan, sind, cosd, tand, asind, acosd, atand, sinh, cosh, tanh, asinh, acosh, atanh, ceil, floor, fabs, rint, lgamma, erf, erfc
  • Binary functions:
    • pow, fmod, hypot, rem
  • Miscellaneous:
    • x! (factorial), -x (unary minus)

Changing mode and precision in "runtime"

The evaluation mode can be changed in runtime with the integer, double and decimal keyword, e.g.

  • integer 8/3 (returns 2)

The precision can be changed in runtime with precision=x, where 0 ≤ x ≤ 16.

Header