The NBP Calculator

Version: 1.14.144
Date: 2017-11-21 05:57 UTC
Organization: National Braille Press
Contact: Brian Mac Donald
Address:
88 St. Stephen Street
Boston, MA 02115
United States of America

Contents

1   Overview

This calculator has been designed to be as usable as possible not only by sighted people but also by blind people using speech and/or a braille device. It's easy to use via it's own on-screen calculator-style keys, a full on-screen keyboard, or an externally-connected Bluetooth or USB keyboard.

It offers the following features:

1.1   Screen Layout

This subsection contains screen layout images that've been intentionally drawn using traditional ASCII art. This has been done so that a blind person can easily "look" at them because screen readers are notoriously poor at dealing with graphical images.

In both portrait and landscape modes, the result line is immediately above the expression line and the Clear button is immediately below it at the very left. This is to make expression entry as easy as possible for a blind person using a braille device. Moving backward one position enables him/her to quickly check the result, and moving forward one position allows him/her to easily clear the expression.

Layout Legend

Layout Legend
AltKp Alternate Keypad selector
AUSel Angle Unit selector
BkSpc Backspace button
Clear Clear button
CMSel Calculator Mode selector
Del Delete button
DNSel Decimal Notation selector
Down Down button
Erase Erase button
f(x) f(x) button
Left Left button
Right Right button
Store Store button
Up Up button
Var Variable button

1.1.1   Portrait

The screen has the following layout when in portrait mode:

+---------------------------------------+
|                The Result Output Area |
+---------------------------------------+
|             The Expression Input Area |
+-------+-------+-------+-------+-------+
| Clear | AltKp | CMSel | DNSel | AUSel |
+-------+-------+-------+-------+-------+
|  Var  | Store | BkSpc |  Up   |  Del  |
+-------+-------+-------+-------+-------+
| f(x)  | Erase | Left  | Down  | Right |
+-------+-------+-------+-------+-------+
|                                       |
|                                       |
|     The Currently Selected Keypad     |
|                                       |
|                                       |
+---------------------------------------+


1.1.2   Landscape

The screen has the following layout when in landscape mode:

+-------------------------------------------------------+
|                                The Result Output Area |
+-------------------------------------------------------+
|                             The Expression Input Area |
+-------+-------+-------+-------------------------------+
| Clear | AltKp | CMSel |                               |
+-------+-------+-------+                               |
| DNSel |  Var  | Store |                               |
+-------+-------+-------+                               |
| AUSel | f(x)  | Erase | The Currently Selected Keypad |
+-------+-------+-------+                               |
| BkSpc |  Up   |  Del  |                               |
+-------+-------+-------+                               |
| Left  | Down  | Right |                               |
+-------+-------+-------+-------------------------------+


1.2   Result Line

This output area displays the on-going current result of evaluating what's been entered in the expression line. If no data has been entered yet then 0 is displayed. If the expression can't be evaluated at the moment (e.g. due to missing data or syntax errors) then the last known result, preceded by a question mark [?], is displayed. The displayed value begins with zero or more open brackets [(] - one for each bracket nesting level that hasn't yet been closed. Expression evaluation only considers the current bracket nesting level.

To illustrate, here's what's displayed as the expression (2+3)×(4−(5+6)×7) is entered:

Expression Result
  0
( (?
(2 (2
(2+ (?2
(2+3 (5
(2+3) 5
(2+3)× ?5
(2+3)×( (?5
(2+3)×(4 (4
(2+3)×(4− (?4
(2+3)×(4−( ((?4
(2+3)×(4−(5 ((5
(2+3)×(4−(5+ ((?5
(2+3)×(4−(5+6 ((11
(2+3)×(4−(5+6) (−7
(2+3)×(4−(5+6)× (?−7
(2+3)×(4−(5+6)×7 (−73
(2+3)×(4−(5+6)×7) −365

1.3   Expression Line

This input area is where the expression to be evaluated is entered (see Expressions for syntax). It's current content is persistent.

The expression can be entered by pressing the calculator-style keys on the screen, via a full on-screen keyboard (tap this line to open it), or via an external keyboard. Additionally, the navigation buttons can be used to edit the expression.

The result of evaluating the expression is displayed on the result line. It's kept up-to-date as the expression is being entered and/or edited.

1.3.1   Enter Key

Typing this key completes the expression. The expression is added to the expression history, the expression line is cleared, and the final result is displayed on the result line. If there's an error then the cursor is placed at the error's location and the message is displayed on the result line.

Pressing the = key on any of the keypads performs this same action.

1.3.2   Shortcuts

the following actions can be performed by typing shortcuts on a keyboard:

Expression Shortcuts
Character Action
CTRL-A Long press the Angle Unit selector.
CTRL-C Press the Clear button.
CTRL-D Press the Down button.
CTRL-E Press the Erase button.
CTRL-F Press the f(x) button.
CTRL-K Set the input focus to the Keypad.
CTRL-M Long press the Calculator Mode selector.
CTRL-N Long press the Decimal Notation selector.
CTRL-S Press the Store button.
CTRL-U Press the Up button.
CTRL-V Press the Variable button.

1.3.3   Expression History

A history of successfully completed expressions is maintained. An expression is considered complete if there are no syntax errors within it when either the = key on any of the keypads is pressed or when the Enter key is typed.

  • Pressing the Up key moves backward through the history.
  • Pressing the Down key moves forward through the history.
  • Long pressing the Up key moves to the earliest entry in the history.
  • Long pressing the Down key moves to the most recent entry in the history.

Any history entry can be edited and recompleted, although the history entries themselves are never actually changed. Edits to an entry are lost when moving away (up or down) from it without recompleting it. Recompleting a history entry adds it as a new entry.

1.4   Control Buttons

1.4.1   Clear

Pressing this button clears the expression line.

1.4.2   Alternate Keypad

Repeatedly pressing this button cycles through all of the keypads associated with the current calculator mode. A long press switches to the mode's primary keypad. This button is disabled if the mode only has one keypad.

1.4.3   Calculator Mode

Repeatedly pressing this button cycles through all of the calculator modes. A long press presents a list from which the desired mode can be selected. The button's label is a three-letter abbreviation for the current selection. The current selection is persistent.

The following modes are available:

DEC

Decimal (the default). This mode performs real and complex operations on IEEE 64-bit floating-point (commonly known as double) values. They consist of a 1-bit sign, an 11-bit exponent, and a 52-bit significand. Other than 0 (which is a special case), the smallest absolute value that this representation supports is 2-1074 or approximately 5×10−324, and the largest absolute value that it supports is 21023 or approximately 1.8×10308. Calculations are performed with an accuracy of 15 significant digits.

This mode supports complex numbers. The imaginary component, if nonzero, is displayed as either an addition to or a subtraction from the real component. If a number doesn't have an imaginary component then only its real component is displayed. If it does have an imaginary component but doesn't have a real component then only the imaginary component is displayed. Here are some examples:

  • 0
  • 1
  • i
  • 2i
  • −3
  • −4i
  • 5 + i
  • −6 + 2i
  • −7 − 3i
  • 2.3×104 + 5.6×107i

The keypads associated wit this mode are:

HEX

Hexadecimal. This mode performs unsigned integer and bitwise operations on 64-bit values. Both input and output are in base 16 and use hexadecimal digits. Digits A through F are always displayed in uppercase but may be input in either case. A number may consist of up to 16 hexadecimal digits.

The keypads associated wit this mode are:

1.4.4   Decimal Notation

Repeatedly pressing this button cycles through all of the decimal notations. A long press presents a list from which the desired notation can be selected. The button's label is a three-letter abbreviation for the current selection. The current selection is persistent.

The following notations are available:

FXD

Fixed (the default). If the absolute value of the number is less than 1012 [1,000,000,000,000] and greater than or equal to 10-3 [0.001] then it's displayed with its decimal point in its natural position. Its power of ten multiplier (e.g. ×10x) isn't displayed (because it's 0), and digit grouping separators (e.g. 1,000) are displayed (to ease readability). If the number is an integer then the decimal point isn't displayed.

If the number is outside this range then it's considered to be too difficult to intuitively read in fixed notation, and scientific notation is used instead.

SCI
Scientific. The number is always displayed such that its absolute value is greater than or equal to 1 and less than 10. In other words, there's always exactly one digit before the decimal point. If the rest of the digits (other than the first one) are 0 then the decimal point isn't displayed. If it needs to be multiplied by a power of 10 (either positive or negative) then ×10x is appended.
ENG
Engineering. This is identical to scientific notation except that the power of ten is always a multiple of 3 and up to 3 digits are displayed before the decimal point.

In all cases, the sign is only displayed if the number is negative. This is also true for the power of ten.

Comparison of Decimal Notations
Fixed 0.0123 456,789
Scientific 1.23×10-2 4.56789×105
Engineering 12.3×10-3 456.789×103

1.4.5   Angle Unit

Repeatedly pressing this button cycles through all of the trigonometric angle units. A long press presents a list from which the desired unit can be selected. The button's label is a three-letter abbreviation for the current selection. The current selection is persistent.

The following units are available:

DEG
Degrees (the default). A circle is divided into 360 degrees.
RAD
Radians. A circle is divided into 2π radians.
GON
Gradians (also known as grads or gons). A circle is divided into 400 gradians.

1.5   Memory Buttons

These keys provide easy access to the predefined variables and to the predefined functions. They can also be used to manage user-defined variables.

The Memory Keypad
Var Store
f(x) Erase

1.5.1   Variable

Pressing this button presents a list of the user-defined variables followed by the predefined variables. Each line contains the name and current value of a variable. For a predefined variable, it also contains its description.

Selecting a variable from this list enters its name into the expression line. The following actions are also available:

Cancel
Dismiss the list without taking any action.

1.5.2   Store

Pressing this button presents a list of the user-defined variables. Each line contains the name and current value of a variable.

Selecting a variable from this list assigns the value currently shown on the result line to it. The following actions are also available:

Cancel
Dismiss the dialog without taking any action.
New

Present a dialog for entering the name of a new variable. This dialog doesn't allow an existing variable to be overwritten. It offers the following actions:

Cancel
Dismiss the dialog without taking any action.
Store
Assign the value currently shown on the result line to to the new variable. This action is disabled when the name field is empty and when it contains the name of an existing variable.

Variables can also be created or updated via the = operator within an expression. For example:

  • x = 1
  • x = y = 2
  • x = 3 + y = 4 + z = 5

To clarify: the last example sets z to 5, y to 9, and x to 12.

1.5.3   Erase

Pressing this button presents a list of the user-defined variables. Each line contains the name and current value of a variable.

Selecting a variable from this list removes its definition. The following actions are also available:

Cancel
Dismiss the dialog without taking any action.

A long press presents the same list in a way that allows several variable definitions to be removed at once. It offers the following additional actions:

Erase
Remove the definitions of all the variables that have been selected.

1.5.4   f(x)

Pressing this button presents a list of the predefined functions. Each line contains the name and description of a function.

Selecting a function from this list enters its name, followed by an open bracket, into the expression line. The following actions are also available:

Cancel
Dismiss the dialog without taking any action.

1.7   Keypads

1.7.1   Decimal

This is the primary keypad for the Decimal calculator mode. It has the following layout:

The Decimal Keypad
( ) " ' x⋅10y
7 8 9 ÷ xy
4 5 6 × !
1 2 3 %
. 0 i + =

Most of these keys enter whatever their label says into the expression line. The exceptions are:

  • The = key completes the expression. It's equivalent to typing the Enter key.
  • The xy key enters ^ (the actual exponentiation operator).
  • The x⋅10y key enters ×10^. It's for multiplying a number by a power of ten.

The " and ' keys are for entering a number in the degrees"minutes'seconds format. Each of these components ("minutes and 'seconds) is optional. If specified, it's value must be an integer that's greater than or equal to 0 and less then 60. If omitted, it's value is assumed to be 0. If any of these components is specified then a decimal point may not be used.

1.7.2   Function

This is the second keypad for the Decimal calculator mode. It has the following layout:

The Function Keypad
abs arg cnj rcp
sin cos tan r2d
asin acos atan d2r
sinh cosh tanh sqrt
exp log log10 cbrt
e pi    

Each of these keys enters its function's name, followed by an open bracket [(], into the expression line. The exceptions are e and pi, which don't enter the open bracket because they're variables.

1.7.3   Conversion

This is the third keypad for the Decimal calculator mode. It has the following layout:

The Conversion Keypad
Type From To DF2DC
Type From To mi2km
Type From To ac2ha
Type From To cup2ml
Type From To lb2kg

Each four-key row is a separate key group. This allows five different unit conversions to be configured. Each of them, as shown above, defaults to a common US-to-International unit conversion.

The first three keys configure the conversion:

Type
This key presents a list from which the desired unit type (e.g. length, area, volume) can be selected.
From
This key presents a list from which the unit that the supplied value is in can be selected. The list only contains units belonging to the currently configured type.
To
This key presents a list from which the unit that the supplied value is to be converted to can be selected. The list only contains units belonging to the currently configured type.

The rightmost key is for actually performing the currently configured unit conversion. It's label shows what that conversion is in the form from2to (e.g. mi2km). This is the name of the predefined function that performs the conversion. Just like the keys on the Function keypad, pressing this key enters the name of this function, followed by an open bracket [(], into the expression line.

Any of the unit conversion functions can be directly typed into the expression line. Because there are so many, none of them is included within the list presented by pressing the f(x) button.

The most recently configured conversion for each unit type for each key group is persistent.

1.7.4   Hexadecimal

This is the primary keypad for the Hexadecimal calculator mode. It has the following layout:

The Hexadecimal Keypad
( ) < > % ^
C D E F ÷ |
8 9 A B × &
4 5 6 7 ~
0 1 2 3 + =

Each of these keys enters whatever its label says into the expression line. The 0 through 9 and A through F keys are the 16 hexadecimal digits. The rest of the keys are as follows:

Key Description
= expression completion
( open bracket
) close bracket
< logical left shift
> logical right shift
& bitwise and
| bitwise inclusive or
^ bitwise exclusive or
~ bitwise ones complement
+ integer addition
integer subtraction or bitwise twos complement
× integer multiplication
÷ integer division
% integer remainder

2   Expressions

3   Reference

3.1   Variables

3.1.1   Predefined Variables

Predefined Variables
Name Value Description Units
gamma 0.57721566490153286060 Euler-Mascheroni constant  
pi 3.14159265358979323846 ratio of circumference to diameter  
sigma 5.670367×10−8 Stefan-Boltzmann constant W m−2 K−4
c 299,792,458 speed of light in vacuum m s−1
e 2.71828182845904523536 base of natural logarithms  
h 6.626070040×10−34 Planck constant J s
i i imaginary unit  
k 1.38064852×10−23 Boltzmann constant J K−1
F 96,485.33289 Faraday constant C mol−1
G 6.67408×10−11 Newtonian constant of gravitation m3 kg−1 s−2
L 6.022140857×1023 Avogadro constant mol−1
R 8.3144598 molar gas constant J mol−1 K−1

3.2   Functions

3.2.1   Predefined Functions

Predefined Functinos
Name Description
abs(z) absolute value (modulus, magnitude) of complex number
acos(x) trigonometric arc cosine
acot(x) trigonometric arc cotangent
acsc(x) trigonometric arc cosecant
arg(z) arg (amplitude, phase) of complex number
asec(x) trigonometric arc secant
asin(x) trigonometric arc sine
atan(x) trigonometric arc tangent
cbrt(z) cube root of complex number
ceil(x) round real number up to nearest integer
cnj(z) conjugate of complex number
cos(x) trigonometric cosine
cosh(x) hyperbolic cosine
cot(x) trigonometric cotangent
coth(x) hyperbolic cotangent
csc(x) trigonometric cosecant
csch(x) hyperbolic cosecant
d2r(x) convert real number from degrees to radians
exp(z) natural exponential of complex number
floor(x) round real number down to nearest integer
gamma(z) gamma function of complex number
imag(z) imaginary component of complex number
log(z) natural log of complex number
log10(z) log10 of complex number
neg(z) negation of complex number
r2d(x) convert real number from radians to degrees
rcp(z) reciprocal of complex number
real(z) real component of complex number
round(x) round real number to nearest integer
sec(x) trigonometric secant
sech(x) hyperbolic secant
sin(x) trigonometric sine
sinh(x) hyperbolic sine
sqrt(z) square root of complex number
tan(x) trigonometric tangent
tanh(x) hyperbolic tangent

3.3   Unit Conversion

3.3.1   Angle

Angle Units
Symbol Name Calculation
rad radians  
brad binary radians 1÷128 = 0.0078125 radians
deg degrees pi÷180 = 0.0174533 radians
rev revolutions 360 degrees
crev centirevolutions 360÷100 = 3.6 degrees
mrev millirevolutions 0.1 centirevolutions
quad quadrants 360÷4 = 90 degrees
sxt sextants 360÷6 = 60 degrees
oct octants 360÷8 = 45 degrees
sign signs 360÷12 = 30 degrees
point points 360÷32 = 11.25 degrees
hxct hexacontades 360÷60 = 6 degrees
dmin arc minutes 1÷60 = 0.0166667 degrees
dsec arc seconds 1÷60 = 0.0166667 arc minutes
gon gradians 0.9 degrees
gmin centesimal minutes 0.01 gradians
gsec centesimal seconds 0.01 centesimal minutes

3.3.2   Area

Area Units
Symbol Name Calculation
m2 SI meters2  
a ares 100 meters2
ha hectares 100 ares
sqin square inches 2.542 = 6.4516 centimeters2
sqft square feet 122 = 144 square inches
sqyd square yards 32 = 9 square feet
sqrd square rods 5.52 = 30.25 square yards
sqch square chains 42 = 16 square rods
sqlink square links 0.012 = 10−4 square chains
sqfur square furlongs 102 = 100 square chains
sqmi square miles 82 = 64 square furlongs
sqlg square leagues 32 = 9 square miles
ro roods 40 square rods
ac acres 4 roods

3.3.3   Energy

Energy Units
Symbol Name Calculation
J SI joules  
erg ergs 100 nanojoules
Ry rydbergs 2.179872 attojoules
eV electronvolts 160.217653 zeptojoules
Ha hartrees 27.2107 electronvolts
ftlbf foot pounds force 1.3558 joules
BTU British thermal units 1055 joules
thm therms 100,000 British thermal units
hphr horsepower hours 2.6845 megajoules
gasgal gasoline gallons 120 megajoules
kWh kilowatt hours 3.6 megajoules
cal small calories 4.184 joules
Cal large calories 1,000 small calories

3.3.4   Force

Force Units
Symbol Name Calculation
N SI newtons  
dyn dynes 10 micronewtons
sn sthènes 1 kilonewton
kgf kilograms force 9.80665 newtons
lbf pounds force 4.4482216152605 newtons
kip kips 1000 pounds force
pdl poundals 0.138254954376 newtons

3.3.5   Length

Length Units
Symbol Name Calculation
m SI meters  
in inches 2.54 centimeters
ft feet 12 inches
yd yards 3 feet
rd rods 5.5 yards
ch chains 4 rods
link links 0.01 chains
fur furlongs 10 chains
mi miles 8 furlongs
lg leagues 3 miles

3.3.6   Mass

Mass Units
Symbol Name Calculation
g SI grams  
t tonnes 1 megagram
Da daltons 1.660539040 yoctograms
oz ounces 28.34952 grams
dr drams 1÷16 ounces
lb pounds 16 ounces
stone stones 14 pounds
quarter quarters 2 stone
hw hundredweight 4 quarters
tl long tons 20 hundredweight
ts short tons 2,000 pounds
ct carats 200 milligrams
gr grains 64.79891 milligrams
dwt penny weight 24 grains
ozt troy ounces 20 penny weight
lbt troy pounds 12 troy ounces

3.3.7   Power

Power Units
Symbol Name Calculation
W SI watts  
hp mechanical horsepower 745.69987158 watts
bhp boiler horsepower 9,809.5 watts
ehp electrical horsepower 746.0 watts
mhp metric horsepower 735.49875 watts

3.3.8   Pressure

Pressure Units
Symbol Name Calculation
Pa SI pascals  
at technical atmospheres 98.0665 kilopascals
atm standard atmospheres 101,325 pascals
Torr torrs 1÷760 = 1.315789×10-3 standard atmospheres
bar bars 100,000 pascals
psi pounds per square inch 6.894757 kilopascals
mmHg millimeters of mercury 133.322387415 pascals
inHg inches of mercury 25.4 millimeters of mercury

3.3.9   Speed

Speed Units
Symbol Name Calculation
mps SI meters per second  
kmph kilometers per hour 1,000 ÷ (60 × 60)
mph miles per hour (2.54 × 12 × 5,280) ÷ 100,000

3.3.10   Temperature

Temperature Units
Symbol Name Calculation
DC degrees Celsius  
K kelvins degrees Celsius + 273.15
DF degrees Fahrenheit degrees Celsius × 5 ÷ 9 + 32
DR degrees Rankine kelvins × 5 ÷ 9
DRé degrees Réaumur 1.25 degrees Celsius
DRø degrees Rømer 100÷52.5 = 1.90476 degrees Celsius + 7.5
DDe degrees Delisle −2÷3 = −0.666667 degrees Celsius + 150
DN degrees Newton 100÷33 = 3.0303 degrees Celsius

3.3.11   Time

Time Units
Symbol Name Calculation
s, sec SI seconds  
min minutes 60 seconds
hr hours 60 minutes
da days 24 hours
wk weeks 7 days
sen sennights 7 days
fort fortnights 14 days
yr years 365.2422 days
dec decades 10 years
cen centuries 100 years
mil millennia 1000 years

3.3.12   Volume

Volume Units
Symbol Name Calculation
m3 SI meters3  
cc cubic centimeters 1 centimeters3
l SI liters 1 cubic centimeter
tsp teaspoons 4.92892 milliliters
tbsp tablespoons 3 teaspoons
floz fluid ounces 2 tablespoons
cup cups 8 fluid ounces
pt pints 2 cups
qt quarts 2 pints
gal gallons 4 quarts
cbin cubic inches 2.543 = 16.3871 centimeters3
cbft cubic feet 123 = 1728 cubic inches
cbyd cubic yards 33 = 27 cubic feet
cbrd cubic rods 5.53 = 166.375 cubic yards
cbch cubic chains 43 = 64 cubic rods
cblink cubic links 0.013 = 10−6 cubic chains
cbfur cubic furlongs 103 = 1,000 cubic chains
cbmi cubic miles 83 = 512 cubic furlongs
cblg cubic leagues 33 = 9 cubic miles

3.4   Système International Prefixes

Any of these symbols may be prepended to the symbol for any metric unit, and any of these names may be prepended to the name for any metric unit. The metric units within the unit tables are flagged with SI [Système International].

3.4.1   For Positive Powers of Ten

Prefixes for Positive Powers of Ten
Name Symbol Short Scale Long Scale
101 deca da ten ten
102 hecto h hundred hundred
103 kilo k thousand thousand
106 mega M million million
109 giga G billion milliard
1012 tera T trillion billion
1015 peta P quadrillion billiard
1018 exa E quintillion trillion
1021 zetta Z sextillion trilliard
1024 yotta Y septillion quadrillion

3.4.2   For Negative Powers of Ten

Note

u (rather than µ) is being used for micro.

Prefixes for Negative Powers of Ten
Name Symbol Short Scale Long Scale
10−1 deci d tenth tenth
10−2 centi c hundredth hundredth
10−3 milli m thousandth thousandth
10−6 micro u millionth millionth
10−9 nano n billionth milliardth
10−12 pico p trillionth billionth
10−15 femto f quadrillionth billiardth
10−18 atto a quintillionth trillionth
10−21 zepto z sextillionth trilliardth
10−24 yocto y septillionth quadrillionth

3.4.3   For Positive Powers of Two

Prefixes for Positive Powers of Two
Name Symbol
210 kibi Ki
220 mebi Mi
230 gibi Gi
240 tebi Ti
250 pebi Pi
260 exbi Ei
270 zebi Zi
280 yobi Yi