-- ----------------------------------------------------------------------- -- Title: double_support_functions -- Last Mod: Thu Apr 4 12:32:48 1991 -- Author: Vincent Broman -- Copyright 1990 Vincent Broman -- Permission granted to copy, modify, or compile this software for -- one's own use, provided that this copyright notice is preserved intact. -- Permission granted to distribute compiled binary copies of this -- software which are linked in with some other application. -- Permission granted to distribute other copies of this software, -- provided that (1) any copy which is not source code, i.e. not in the -- form in which the software is usually maintained, must be accompanied -- by a copy of the source code from which it was compiled, and (2) the -- one distributing it must refrain from imposing on the recipient -- further restrictions on the distribution of this software. -- -- Description: -- -- a double-precision-only package of functions -- supporting an implementation of generic_elementary_functions. -- -- Exceptions: No checking done. An accidental overflow could be caused -- by an argument way outside the spec domain of a function. -- ----------------------------------------------------------------------- -- with float_types; use float_types; package double_support_functions is function reduced_logdel_2 (y: in double) return double; -- -- return the base-2 logarithm of (1+y)/(1-y), -- y in the interval [ -3+sqrt(8) .. 3-sqrt(8) ]. -- the coefficients are from a chebychev economized polynomial approximation -- to log_2( (1+y)/(1-y) )/y with relative error (omitting roundoff) < 9.7e-18. -- this delivers high relative accuracy for small x. -- Note: reduced_logdel_2( 0.0) = 0.0 exactly. -- function reduced_log_2 (x: in double) return double; -- -- return the base-2 logarithm of x, x in the interval [sqrt(1/2),sqrt(2)]. -- procedure log_2_parts (int_part: out double; frac_part: out double; x: in double); -- -- return the integer and fractional part of the -- base-2 logarithm of x. -- int_part is a floating pt integer, and abs( frac_part) <= 1/2. -- function log_2 (x: in double) return double; -- -- return the base-2 logarithm of x, assuming x > 0.0 -- -- the value is exact for x an integer power of 2. -- function reduced_two_to_the (x: in double) return double; -- -- return 2.0**x for x in the interval [-0.524, 0.524]. -- the coefficients are a Remez-optimized rational(8,2) approximation, -- with relative error (omitting roundoff) < 7.9e-18 . -- The interval would be [-1/2, 1/2] but we allow some slop. -- function two_to_the (x: in double) return double; -- -- return 2.0**x, underflowing to zero for very negative x, -- and overflowing for very positive x. -- function reduced_sin (x: in double) return double; -- -- return sin x for x in the interval [0,pi/4]. -- the coefficients are a chebychev-economized taylor series for -- sin((1-x)*pi/8)/((1-x)*pi/8) on [-1,1], -- with absolute error (omitting roundoff) < 9.9e-19. -- this gives high relative accuracy for small x. -- function reduced_cos (x: in double) return double; -- -- return cos x for x in the interval [0,pi/4]. -- the coefficients are a chebychev-economized taylor series for -- cos((1-x)*pi/8) on [-1,1], -- with absolute error (omitting roundoff) < 8.1e-20 -- function reduced_arctan (x: in double) return double; -- -- returns arctan x in radians from [-pi/4,pi/4] for x in [-1,1]. -- the reduction formula below comes from the angle-sum formula for tangent. -- the interval [0,1] is broken twice at tan(pi/20) and tan(3 pi/20). -- end double_support_functions; -- $Header: d_support_functions_s.a,v 3.24 91/04/04 13:22:38 broman Exp $