class interface P_MATH feature(s) from P_MATH -- Math e: REAL int_sqrt (n: INTEGER): INTEGER -- Calculate integer square root. -- Time: O(sqrt(N)) require postive: n >= 0 ensure ok: Result ^ 2 <= n and (Result + 1) ^ 2 > n square_root (x: DOUBLE): DOUBLE -- Square root (floating point). -- Time: O(1) for x in 0.001..100, O(n) for x = a.10^n, slow in any case. require positive: x >= 0 ensure positive: Result >= 0; -- (Result*Result ~= x) done: feature(s) from P_MATH -- Trigonometry Pi_value: DOUBLE sine (x: DOUBLE): DOUBLE -- Portable sine. -- Time: O(1) but far too slow. cosine (x: DOUBLE): DOUBLE -- Portable cosine. -- Time: same as sine. end of P_MATH