This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

EiffelBase class
(HTML page generated by ISE Eiffel 4.2)

Eiffel Class
indexing
	description: "Basic mathematical operations, double-precision. This class may be used as ancestor by classes needing its facilities.";
	status: "See notice at end of class";
	date: "$Date: 2007-03-30 19:10:11 +0000 (Fri, 30 Mar 2007) $";
	revision: "$Revision: 95354 $"

class DOUBLE_MATH

inherit
	MATH_CONST
		export
			{NONE} all
		end

feature -- Access

	log_2 (v: DOUBLE): DOUBLE is
			-- Base 2 logarithm of v
		local
			a: DOUBLE
		do
			a := 2.0;
			Result := log (v) / log (a)
		end;

	cosine (v: DOUBLE): DOUBLE is
			-- Trigonometric cosine of radian v approximated
			-- in the range [-pi/4, +pi/4]
		external
			"C | <math.h>"
		alias
			"cos"
		end;

	arc_cosine (v: DOUBLE): DOUBLE is
			-- Trigonometric arccosine of radian v
			-- in the range [0, pi]
		external
			"C | <math.h>"
		alias
			"acos"
		end;

	sine (v: DOUBLE): DOUBLE is
			-- Trigonometric sine of radian v approximated
			-- in range [-pi/4, +pi/4]
		external
			"C | <math.h>"
		alias
			"sin"
		end;

	arc_sine (v: DOUBLE): DOUBLE is
			-- Trigonometric arcsine of radian v
			-- in the range [-pi/2, +pi/2]
		external
			"C | <math.h>"
		alias
			"asin"
		end;

	tangent (v: DOUBLE): DOUBLE is
			-- Trigonometric tangent of radian v approximated
			-- in range [-pi/4, +pi/4]
		external
			"C | <math.h>"
		alias
			"tan"
		end;

	arc_tangent (v: DOUBLE): DOUBLE is
			-- Trigonometric arctangent of radian v
			-- in the range [-pi/2, +pi/2]
		external
			"C | <math.h>"
		alias
			"atan"
		end;

	sqrt (v: DOUBLE): DOUBLE is
			-- Square root of v
		external
			"C | <math.h>"
		end;

	log (v: DOUBLE): DOUBLE is
			-- Natural logarithm of v
		external
			"C | <math.h>"
		end;

	log10 (v: DOUBLE): DOUBLE is
			-- Base 10 logarithm of v
		external
			"C | <math.h>"
		end;

	floor (v: DOUBLE): DOUBLE is
			-- Greatest integral less than or equal to v
		external
			"C | <math.h>"
		end;

	ceiling (v: DOUBLE): DOUBLE is
			-- Least integral greater than or equal to v
		external
			"C | <math.h>"
		alias
			"ceil"
		end;

feature {NONE} -- Implementation

	dabs (v: DOUBLE): DOUBLE is
			-- Absolute of v
		external
			"C | <math.h>"
		alias
			"fabs"
		end;

end -- class DOUBLE_MATH