note description: "Routines that ought to be in class DOUBLE" library: "Gobo Eiffel Kernel Library" copyright: "Copyright (c) 2003-2018, Eric Bezault and others" license: "MIT License" date: "$Date: 2019-02-07 22:54:15 +0000 (Thu, 07 Feb 2019) $" revision: "$Revision: 102807 $" class interface KL_DOUBLE_ROUTINES create default_create feature -- Logarithms log (d: REAL_64): REAL_64 -- Natural logarithm of d require d_positive: d > 0.0 ensure instance_free: class log2 (d: REAL_64): REAL_64 -- Base 2 logarithm of d require d_positive: d > 0.0 ensure instance_free: class log10 (d: REAL_64): REAL_64 -- Base 10 logarithm of d require d_positive: d > 0.0 ensure instance_free: class feature -- Exponent exp (d: REAL_64): REAL_64 -- Inverse of the natural logarithm ensure instance_free: class nth_root (d, n: REAL_64): REAL_64 -- n-th root of d require divisible: (1.0).divisible (n) ensure instance_free: class feature -- Conversion truncated_to_integer (d: REAL_64): INTEGER_32 -- Integer part (Same sign, largest absolute -- value no greater than current object's) require d_large_enough: d >= Platform.Minimum_integer.to_double d_small_enough: d <= Platform.Maximum_integer.to_double ensure instance_free: class rounded_to_integer (d: REAL_64): INTEGER_32 -- Rounded integral value require d_large_enough: (d.abs + 0.5) >= Platform.Minimum_integer.to_double d_small_enough: (d.abs + 0.5) < (Platform.Maximum_integer.to_double + 1.0) ensure instance_free: class definition: Result = d.sign * floor_to_integer (d.abs + 0.5) floor_to_integer (d: REAL_64): INTEGER_32 -- INTEGER floor require d_large_enough: d >= Platform.Minimum_integer.to_double d_small_enough: d < (Platform.Maximum_integer.to_double + 1.0) ensure instance_free: class definition: Result = d.floor feature -- NaN is_nan (d: REAL_64): BOOLEAN -- Does d correspond to a Not-A-Number? ensure instance_free: class feature -- Infinity is_plus_infinity (d: REAL_64): BOOLEAN -- Does d correspond to positive infinity? ensure instance_free: class is_minus_infinity (d: REAL_64): BOOLEAN -- Does d correspond to minus infinity? ensure instance_free: class Plus_infinity: REAL_64 -- Positive infinity ensure instance_free: class positive: Result > 0.to_double Minus_infinity: REAL_64 -- Negative infinity ensure instance_free: class negative: Result < 0.to_double end -- class KL_DOUBLE_ROUTINES
Generated by ISE EiffelStudio