1 class Real = 2 inherit Number 3 4 def sin : Self 5 def cos : Self 6 def tan : Self 7 def log2 : Self 8 def floor : Self 9 def round : Self 10 def sqrt : Self 11 def pow (x : Self) : Self 12 def (Number -) @c (rhs : Self) : Self 13 14 def abs : Self = if self < 0 then -self else self 15 def (%) (rhs : Self) = 16 let times = self / rhs 17 self - times * rhs 18 19 class Float = 20 inherit Real 21 22 type f32 @c = 23 def sin "sinf" : f32 24 def cos "cosf" : f32 25 def tan "tanf" : f32 26 def log2 "log2f" : f32 27 def floor "floorf" : f32 28 def round "roundf" : f32 29 def sqrt "sqrtf" : f32 30 def pow "powf" (x : f32) : f32 31 32 is Float 33 34 type f64 @c = 35 def sin : f64 36 def cos : f64 37 def tan : f64 38 def log2 : f64 39 def floor : f64 40 def round : f64 41 def sqrt : f64 42 def pow (x : f64) : f64 43 44 is Float 45