-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloat_math.ko
More file actions
33 lines (28 loc) · 764 Bytes
/
float_math.ko
File metadata and controls
33 lines (28 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Float64 Arithmetic — demonstrates floating-point operations in Kōdo.
//
// Compile and run:
// kodoc build examples/float_math.ko -o float_math
// ./float_math
module float_math {
meta {
purpose: "Demonstrates Float64 arithmetic operations",
version: "0.1.0",
author: "Kōdo Team"
}
fn main() {
// Basic arithmetic
let a: Float64 = 3.14
let b: Float64 = 2.0
let sum: Float64 = a + b
let diff: Float64 = a - b
let prod: Float64 = a * b
let quot: Float64 = a / b
println_float(sum)
println_float(diff)
println_float(prod)
println_float(quot)
// Negation
let neg: Float64 = -a
println_float(neg)
}
}