Echo Writes Code

floats.orchid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- An Orchid program demonstrating the various floating point literal notations.

main! {
	-- Simple decimal floating-point numbers
	bind! simple_float = 1.5;
	bind! positive_float = +1.5;
	bind! negative_float = -1.5;

	-- Exponential notation
	bind! kilo_float = 1.5e3;
	bind! milli_float 1.5e-3;

	-- Floats of various bases (all equivalent)
	-- Keywords are used here to keep the tokenizer simpler
	bind! binary_float = bin! "1.1";
	bind! octal_float = oct! "1.4";
	bind! decimal_float dec! "1.5";
	bind! hexadecimal_float hex! "1.8";
}