# # Calculations

Calculations is a minimal browser-based spreadsheet.

## # 1 User Guide

Click on a cell to edit it. Defocus the text input to confirm, or press Enter to confirm and copy to the cell below (if it is empty).

Cells can contain values or formulas. Formulas start with “=”.

The language is JavaScript. Mathematical functions can be used without “Math.” prefix.

Click on the top left “#” to get a permalink to the current calculations.

Note: opening calculations permalinks from untrusted sources is risky.

### # 1.1 Values

numbers

1.618

integers

1000n

strings

"Hi"

objects

{name:"Bob",age:42}

arrays

[0,1,2]

functions

(x)=>{return exp(-(x**2)/2)/sqrt(2*PI);}

### # 1.2 Formulas

Expressions starting with = can depend on other cells (but recursive cycles are not allowed).

Absolute references: A0 B8 F4

Relative references: cell(dx,dy)

### # 1.3 Example: Fibonacci

A0: ()=>{return cell(0,-1)+cell(0,-2);}

This defines a function that, when evaluated in a formula cell, sums the two cells immediately above it.

A1: 0n

A2: 1n

These are the first two terms of the sequence. Using BigInt (n suffix) ensures accuracy of larger terms.

A3 and below (keep pressing Enter): =A0()

Constructs the sequence by evaluating the previously defined function.

The sequence can then be varied by changing A1, A2, and even A0.

The ratios between successive terms can be calculated too:

B0: ()=>{return Number(cell(-1,0))/Number(cell(-1,-1));}

B2 and below: =B0()

Converting from BigInt to Number ensures fractional division.