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
Revision as of 02:55, 23 September 2009 by Dustin Howett (talk | contribs) (Calculator -> Calculate)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Calculate.framework
Private Framework
Availabile 2.0 – present
Headers [headers.cynder.me]


The Calculate framework provides a single function, CalculatePerformExpression, whose only purpose is to 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