Name

^ — exponentiation

Syntax

                     number1 ^ number2
                  

Description

Raises the first number to the power of the second. The result is a real.

Do not blame AppleScript for the phenomena inherent in doing floating-point arithmetic in any language on any computer. It is the nature of computer numerics that most values can only be approximated. Modern processors are extraordinarily clever about compensating, but rounding operations can easily expose the truth:

2.32 * 100.0 div 1 -- 231

Similarly, there may be situations where instead of comparing two values for absolute equality you will do better to test whether the difference between them lies within some acceptable small epsilon.

Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.