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 (Number -) @c (rhs : Self) : Self 12 13 def abs : Self = if self < 0 then -self else self 14 def (%) (rhs : Self) = 15 let times = self / rhs 16 self - times * rhs 17 18 class Float = 19 inherit Real 20 21 type f32 @c = 22 def sin "sinf" : f32 23 def cos "cosf" : f32 24 def tan "tanf" : f32 25 def log2 "log2f" : f32 26 def floor "floorf" : f32 27 def round "roundf" : f32 28 def sqrt "sqrtf" : f32 29 30 is Float 31 32 type f64 @c = 33 def sin : f64 34 def cos : f64 35 def tan : f64 36 def log2 : f64 37 def floor : f64 38 def round : f64 39 def sqrt : f64 40 41 is Float 42