Skip to content
Santhosh Kumar edited this page Jan 2, 2020 · 12 revisions

Welcome to the fcal wiki!

Basic Arithmetic operation

Operation Operator Phrases Example
Addition + PLUS, AND, WITH, ADD 1 + 24, 1 plus 3 plus 5
Subtraction - MINUS, SUBTRACT, WITHOUT 0.234 - 3.14, 23 without 10
Multiplication * TIMES, MULTIPLIEDBY, MUL 1234 * 100, 6665.01 MUL 001
Division / DIVIDE, DIVIDEBY (1+23)/(0.01)
Power ^ POW 2 ^ 2 ^ 2 pow 23
Modulus mod 134 mod 13
Percentage of 25% of 1024, 10 of 234

Operator precedence rule in Fcal

Operators Meaning Association
() Parentheses
log() Function call
34 cm , 45 cm Unit suffix
^ Exponent right to left
+x, -x, !x Unary right to left
as, in Unit or number system conversion
*, / , mod, of Multiplication, division, modulus and percentage left to right
+, - Addition and subtraction left to right
<, >, <=, >=, <==, >== Camparison left to right
==, !=, ===, !== Equality left to right
= Assignment right to left

Percentage operation

For general percentage operations like adding or subtracting the per cent of value, you can do 12 + 24%, 1230 - 23.23%

Variables

You can declare variables using = or : operator, you can also reassign them

please note that you can't use variable names which are being used for phrases in operations and units

radius : 20cm
PI*radius^2

Constants

Variable name Value
E 2.718281828459045235360287
PI 3.141592653589793238462645
PI2 6.2831853071795864769

You can use the default functions

abs(-23) + log(123)

Units

you can convert one unit into another. Fcal will automatically convert units to perform operations if it's needed during conversion.

23day in sec
100min + 34sec + 1day + 10% of 100 day

you can find supported units here Units

Number System

You can convert one number system into another

0.34 km in octal # 0o0.25605075341217270244 Kilometer
0b1011 + 0xac

<<<<<<< HEAD you can find supported units here Units

Scales

You use scales in the number literal

45 B
Clone this wiki locally