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 20:58, 22 September 2009 by KennyTM~ (talk | contribs) (Created page with '{{infobox Framework | vis = Private | since = 2.0 }} The '''Calculator''' framework provides a single function, <tt>CalculatePerformExpression</tt>, which the only purpose is ev…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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