-- ----------------------------------------------------------------------- -- Title: single_support_functions -- Last Mod: Thu Apr 4 12:29:22 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 single-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 single_support_functions is function reduced_logdel_2 (y: in single) return single; -- -- 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 rational (even) 1,1 approximation to -- log_2( (1+y)/(1-y) )/y with relative error (omitting roundoff) < 1.91e-8. -- this delivers high relative accuracy for small y. -- Note: reduced_logdel_2( 0.0) = 0.0 exactly. -- function reduced_log_2 (x: in single) return single; -- -- return the base-2 logarithm of x, x in the interval [sqrt(1/2),sqrt(2)]. -- procedure log_2_parts (int_part: out single; frac_part: out single; x: in single); -- -- 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 single) return single; -- -- 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 single) return single; -- -- return 2.0**x for x in the interval [-0.524, 0.524]. -- the coefficients are a Remez-optimized rational(3,2) approximation, -- with relative error (omitting roundoff) < 1e-8. -- The interval would be [-1/2, 1/2] but we allow some slop. -- function two_to_the (x: in single) return single; -- -- return 2.0**x, underflowing to zero for very negative x, -- and overflowing for very positive x. -- function reduced_sin (x: in single) return single; -- -- 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) < 2e-8. -- this gives high relative accuracy for small x. -- function reduced_cos (x: in single) return single; -- -- 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) < 1.8e-9 -- function reduced_arctan (x: in single) return single; -- -- returns arctan x in radians from [-pi/4,pi/4] for x in [-1,1]. -- coefficents from Abramowitz and Stegun p81, #4.4.49 . -- relative error < 2e-8. -- end single_support_functions; -- $Header: s_support_functions_s.a,v 3.24 91/04/04 13:22:41 broman Exp $