1 fn to-km miles: float -> _/xmm1: float {
2 var result/xmm1: float <- copy miles
3 var factor/xmm0: float <- rational 0x649, 0x3e8 # 1.609 = 1609/1000 in hex
4 result <- multiply factor
10 var zero: float # Mu implicitly initializes variables in memory to 0
11 var result/xmm1: float <- to-km zero
15 draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "F - 0 miles = 0 km\n", 3/fg 0/bg
18 # 1 mile = 1.609 km approximately
19 var one/eax: int <- copy 1
20 var one-float/xmm0: float <- convert one
21 result <- to-km one-float
22 var lower-bound/xmm0: float <- rational 0x649, 0x3e8 # 1609/1000 in hex
24 compare result, lower-bound
26 draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "F - 1 mile > 1.609 km\n", 3/fg 0/bg
29 var upper-bound/xmm0: float <- rational 0x64a, 0x3e8 # 1610/1000 in hex
31 compare result, upper-bound
33 draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "F - 1 mile < 1.610 km\n", 3/fg 0/bg
36 # 2 miles = 3.218 km approximately
37 var two/eax: int <- copy 2
38 var two-float/xmm0: float <- convert two
39 result <- to-km two-float
40 var lower-bound/xmm0: float <- rational 0xc92, 0x3e8 # 3218/1000 in hex
42 compare result, lower-bound
44 draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "F - 2 miles > 3.218 km\n", 3/fg 0/bg
47 var upper-bound/xmm0: float <- rational 0xc93, 0x3e8 # 3219/1000 in hex
49 compare result, upper-bound
51 draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "F - 2 miles < 3.219 km\n", 3/fg 0/bg