Back to package · Browse packages
1import math "std:math" 2import linalg "std:linalg" 3 4fn fail(msg) { 5 print("FAIL") 6 print(msg) 7 oren_exit(1) 8} 9 10fn main() { 11 var half = math.power(2.0, -1.0) 12 var curved = math.power(2.0, 4.3) 13 var dot = linalg.dot_f64([1.0, 2.0, 3.0], [4.0, 5.0, 6.0]) 14 15 if half < 0.49 || half > 0.51 { fail("power negative exponent") } 16 if curved < 19.69 || curved > 19.71 { fail("power fractional exponent") } 17 if dot != 32.0 { fail("dot_f64") } 18 19 print("science-calculator demo OK") 20 print(half) 21 print(curved) 22 print(dot) 23 oren_exit(0) 24} 25