# Help

You will find many examples of how to use CalcPad here.

- Basics: Intro, Variables, Reserved Variables, Constants, User-defined Functions
- Numbers Syntax: Number Syntax, Convert to Words, Convert to Fractions
- More Numbers: Tips and Sales, Vectors, Number Bases
- Units: Units, Currency, Physics
- Functions: Logic, Bitwise, Summation

- Extra Stuff

## Intro

Here is a quick look at some of the features.

## Variables

This is one of the most basic features. So I put some extra time into it.

## Reserved Variables

CalcPad stores the value of previous lines in different ways. Keep in mind that any line that uses 'total' or 'sum' is defined as a 'total line' or 'sum line'. So a line that just says "total" or a line that says "total + 500" are both considered to be a "total line".

    ans, answer, prev        Answer of previous line.
    total, vtotal            Sum of all previous lines that don't have reserved variables (except 'ans').
    subtotal, vsubtotal      Same as total, but resets at lines with 'total' or 'subtotal'.
    count, vcount            Counts all lines that don't have reserved variables (except for 'ans').
    subcount, vsubcount      Same as count, but resets at lines with 'count' or 'subcount'.
    average, averageall      Total / Count.

## Constants

Constants are not case-sensitive by default (some are made to be case-sensitive though). Most constants are accessible through the Constants Menu as well. However, many constants have alternative names, these can be found in the Data Menu.

## User-Defined Functions

## Number Syntax

## Convert To Words

## Convert to Fractions

## Tips & Sales

## Vectors

## Number Bases

## Units

CalcPad uses the values of base units to build other units. There is no "meter/second²" saved anywhere in CalcPad. It builds these units on the fly by combining base units. This allows CalcPad to supports tons and tons of units.

## Currency

List of different currencies can be found here.

## Physics

As you can see it's easy to setup a formula in CalcPad and re-use it. You can even add your own permanent functions from the Data menu.

## Logic

## Bitwise

## Summation

## Extra Stuff

You can copy/paste the input from the demos in this section into CalcPad to see them work.

### Variable Inception

If you copy/paste this into CalcPad and change "a", the changed will propagate all the way down to "2f".

CalcPad
a=4 b=a c=b d=c e=d f=e 2f | ᵥₐᵣ 4 ᵥₐᵣ 4 ᵥₐᵣ 4 ᵥₐᵣ 4 ᵥₐᵣ 4 ᵥₐᵣ 4 8

### Function Inception

CalcPad
f(x) = x+2 g(x) = x² h(x)= x/2 f(g(3)) f(g(h(3))) | function function function 11 4.25

### Metric Prefixes Everywhere

You can add metric prefixes to pretty much anything. CalcPad doesn't store units like kilogram or kilometer, it stores the prefixes themselves and then combined them with units when needed. It will even combine with a literal number.

CalcPad
1 kilometer 1 kilomile to miles 1 megamile to miles speed of light mega speed of light 100 mega100 centi5 pi nanopi gigapi | 1 kilometer 1,000 miles 1,000,000 miles 299,792,458 meter/second 299,792,458,000,000 meter/second 100 100,000,000 0.05 3.141592 3.1415926E-09 3,141,592,653.58979

### Large Numbers

Yes, these are real numbers. Although, at this point knowing the names don't help you comprehend them any better.

CalcPad
1e+3 in words 1e+6 in words 1e+9 in words 1e+12 in words 1e+15 in words 1e+18 in words 1e+21 in words 1e+32 in words 1e+64 in words 1e+96 in words 1e+100 in words | 1 thousand 1 million 1 billion 1 trillion 1 quadrillion 1 quintillion 1 sextillion 100 nonillion 10 vigintillion 1 untrigintillion 10 duotrigintillion

### Bitwise: Odd/Even Check

You can use the bitwise & operator to determine if a number is even or odd. If you & a number by 1 it will return 0 if even and 1 if odd. This works because there is only one odd slot. Try visualizing it: 0, 1, 2, 4, 8, 16, 32, etc. Every slot is even except for "1". The & operator only returns 1/true if both sides are 1/true. So it only returns 1/true if the number if the 1 bit is set (i.e. is odd).

CalcPad
// Evens 100 & 1 52 & 1 18 & 1 4 & 1 2 & 1 // Odds 1 & 1 17 & 1 63 & 1 99 & 1 | 0 0 0 0 0 1 1 1 1

### Bitwise: Swap Two Values With Only Two Variables

Typically, if you want to swap the values of two variables, you need a 3rd variable. But with bitwise you don't need that extra variable. You can try it yourself in CalcPad.

CalcPad
a = 8 b = 3 a = a XOR b b = a XOR b a = a XOR b a b | 8 3 11 8 3 3 8

### Powerball Meme

During 2015 an image started circulating Facebook, claiming that if everyone split the money from Powerball we'd all get $4.33 million! That doesn't sound right. In CalcPad, instead of counting zeros while typing in 1300000000 / 300000000 you can use commas: 1,300,000,000 / 300,000,000. Or, you can just type in 1.3 billion / 300 million.

CalcPad
$1300000000 / $300000000 $1,300,000,000 / $300,000,000 $1.3 billion / $300 million | $4.33 $4.33 $4.33

For more Help see the other pages. You can also use the built-in examples feature in the Help menu.

## Sources

- Low Level Bit Hacks You Absolutely Must Know