Topics |
LaunchBar’s built-in Calculator
To open the Calculator, do one of the following:
Operation | Example |
---|---|
Basic arithmetical operations | 44 - 16 * (12.3 + 4.8 / 3) |
Trigonometric operations | sin(pi / 2) |
Inverse trigonometric operations | atan(1) |
Square Root | sqrt(2) |
Raise to power | pow(27 | 1/3) |
Raise to integral power | 2^8 |
Exponential function ex | exp(1) |
Logarithm (base 10) | log(1000) |
Natural logarithm | ln(2.71828182846) |
Binary logarithm | ld(1024) |
Greatest common divisor | gcd(527 | 697) |
Least common multiple | lcm(91 | 143) |
If a function has more than one argument (such as pow or gcd), the arguments have to be separated with a vertical line character | to prevent ambiguities with decimal and thousand separators.
To enter this separator more conveniently, you can also press either Tab or \.
To speed up typing your expressions (especially on notebook keyboards), LaunchBar provides some smart conversions during input or prior to calculating the result:
Calculator automatically inserts closing brackets if appropriate. When you type an opening bracket, the corresponding closing bracket will inserted automatically.
To put some part of an already entered expression in brackets, select that part and type a bracket. Entering an opening bracket will put the insertion point before the bracketed expression, entering a closing bracket will put it behind.
Uppercase letters can be used to enter function names more quickly. For example, type S45 to get sin(45), or type Q2 to get sqrt(2).
Input | Result |
---|---|
S | sin(x) |
C | cos(x) |
T | tan(x) |
AS | asin(x) |
AC | acos(x) |
AT | atan(x) |
Q | sqrt(x) |
L | ln(x) |
D | ld(x) |
G | log(x) |
E | exp(x) |
P | pow(x|y) |
X | pow(10|x) |
R | 1/x |
Shift-2 | x² |
Shift-3 | x³ |
Calculator automatically detects the used notation for decimal- and thousand-separators (period vs. comma). So you may enter either 12.3 + 1,550 or 12,3 + 1.550 and you’ll get the expected results in both cases.
In ambiguous cases (e.g. 12.000 + 3,123) LaunchBar considers the number format as specified in System Preferences > Language & Text > Formats.
To calculate the sum of a series of numbers, you can omit the plus signs. It’s sufficient to separate the numbers with a space character, or if you enter them via Copy & Paste they just have to be in separate lines (so you can paste e.g. a column of numbers).
With Instant Calculate you can quickly perform calculations via Instant Send. If the sent text appears to be a valid calculator expression, the results are displayed automatically.
For example, if you are working on a document that contains a series of numbers, you can select these numbers, send them to LaunchBar via Instant Send, and LaunchBar will instantly show the sum of these numbers.
Many OS X applications support non-contiguous text selections, allowing you to select multiple, individual pieces of text. You first select one piece of text, then hold down the Command key and select some other text elsewhere in the document. For example, the following TextEdit selection was created by double clicking the first, third and fourth number while holding the Command key down:
Now copy and paste this text selection from TextEdit to LaunchBar, and you will get the following result:
Or if you are using Instant Calculate as described above, you’ll get the sum of these numbers with just a single keystroke:
When the result of a calculation is displayed in large type, you can press Space to modify the current expression, or press Tab, +, -, *, / or A to perform subsequent calculations based on the current result.
The letter “a” can be used as a placeholder for the most recent result, which is especially useful if you want to use this result in different places of your new expression. For example, if your last calculation delivered 7.24 as the result you can enter:
(a + 3) / a
which will then evaluate to:
(7.24 + 3) / 7.24
Calculations can be sent from external applications to LaunchBar via AppleScript or URL commands. The result of the expression is then displayed in large type.
Calculation requests can be sent to LaunchBar via AppleScript using the perform action command. For example:
Calculation requests can also be sent to LaunchBar using the x-launchbar:calculate URL command. You can optionally specify input and output formats to customize the display of the result. Special characters must be properly URL encoded using UTF-8 percent escapes.
The x-launchbar:calculate URL command can also be used to compute the result of predefined formulas via Search Templates.