diff options
Diffstat (limited to 'libraries/ieee/math_real.vhdl')
-rw-r--r-- | libraries/ieee/math_real.vhdl | 851 |
1 files changed, 612 insertions, 239 deletions
diff --git a/libraries/ieee/math_real.vhdl b/libraries/ieee/math_real.vhdl index b2c818a4b..ca1cec3fe 100644 --- a/libraries/ieee/math_real.vhdl +++ b/libraries/ieee/math_real.vhdl @@ -1,255 +1,628 @@ ------------------------------------------------------------------------ -- --- This source file may be used and distributed without restriction. --- No declarations or definitions shall be added to this package. --- This package cannot be sold or distributed for profit. +-- Copyright 1996 by IEEE. All rights reserved. -- --- **************************************************************** --- * * --- * W A R N I N G * --- * * --- * This DRAFT version IS NOT endorsed or approved by IEEE * --- * * --- **************************************************************** +-- This source file is an essential part of IEEE Std 1076.2-1996, IEEE Standard +-- VHDL Mathematical Packages. This source file may not be copied, sold, or +-- included with software that is sold without written permission from the IEEE +-- Standards Department. This source file may be used to implement this standard +-- and may be distributed in compiled form in any manner so long as the +-- compiled form does not allow direct decompilation of the original source file. +-- This source file may be copied for individual use between licensed users. +-- This source file is provided on an AS IS basis. The IEEE disclaims ANY +-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY +-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source +-- file shall indemnify and hold IEEE harmless from any damages or liability +-- arising out of the use thereof. -- --- Title: PACKAGE MATH_REAL +-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996, +-- MATH_REAL) -- --- Library: This package shall be compiled into a library --- symbolically named IEEE. +-- Library: This package shall be compiled into a library +-- symbolically named IEEE. -- --- Purpose: VHDL declarations for mathematical package MATH_REAL --- which contains common real constants, common real --- functions, and real trascendental functions. +-- Developers: IEEE DASC VHDL Mathematical Packages Working Group -- --- Author: IEEE VHDL Math Package Study Group +-- Purpose: This package defines a standard for designers to use in +-- describing VHDL models that make use of common REAL constants +-- and common REAL elementary mathematical functions. -- --- Notes: --- The package body shall be considered the formal definition of --- the semantics of this package. Tool developers may choose to implement --- the package body in the most efficient manner available to them. +-- Limitation: The values generated by the functions in this package may +-- vary from platform to platform, and the precision of results +-- is only guaranteed to be the minimum required by IEEE Std 1076- +-- 1993. -- --- History: --- Version 0.1 (Strawman) Jose A. Torres 6/22/92 --- Version 0.2 Jose A. Torres 1/15/93 --- Version 0.3 Jose A. Torres 4/13/93 --- Version 0.4 Jose A. Torres 4/19/93 --- Version 0.5 Jose A. Torres 4/20/93 Added RANDOM() --- Version 0.6 Jose A. Torres 4/23/93 Renamed RANDOM as --- UNIFORM. Modified --- rights banner. --- Version 0.7 Jose A. Torres 5/28/93 Rev up for compatibility --- with package body. +-- Notes: +-- No declarations or definitions shall be included in, or +-- excluded from, this package. +-- The "package declaration" defines the types, subtypes, and +-- declarations of MATH_REAL. +-- The standard mathematical definition and conventional meaning +-- of the mathematical functions that are part of this standard +-- represent the formal semantics of the implementation of the +-- MATH_REAL package declaration. The purpose of the MATH_REAL +-- package body is to provide a guideline for implementations to +-- verify their implementation of MATH_REAL. Tool developers may +-- choose to implement the package body in the most efficient +-- manner available to them. -- --- GHDL history --- 2005-04-07 Initial version. --- 2005-09-01 Some PI constants added. --- 2005-12-20 I. Curtis : significant overhaul to bring closer in line --- with ieee standard - -------------------------------------------------------------- -Library IEEE; - -Package MATH_REAL is - -- IAC: should have a string with copyright notice - -- constant CopyRightNotice: STRING - -- := "GPL"; - - -- - -- commonly used constants +-- ----------------------------------------------------------------------------- +-- Version : 1.5 +-- Date : 24 July 1996 +-- ----------------------------------------------------------------------------- + +package MATH_REAL is + constant CopyRightNotice: STRING + := "Copyright 1996 IEEE. All rights reserved."; + + -- + -- Constant Definitions -- - constant MATH_E : real := 2.71828_18284_59045_23536; -- e - constant MATH_1_OVER_E : real := 0.36787_94411_71442_32160; -- 1/e - constant MATH_PI : real := 3.14159_26535_89793_23846; -- pi - constant MATH_2_PI : real := 2.0 * MATH_PI; -- 2 * pi - constant MATH_1_OVER_PI : real := 0.31830_98861_83790_67154; -- 1/pi - constant MATH_PI_OVER_2 : real := 1.57079_63267_94896_61923; -- pi / 2 - constant MATH_PI_OVER_4 : real := 0.78539_81633_97448_30962; -- pi / 4 - constant MATH_LOG_OF_2 : real := 0.69314_71805_59945_30942; - -- natural log of 2 - constant MATH_LOG_OF_10: real := 2.30258_50929_94045_68402; - -- natural log of10 - constant MATH_LOG2_OF_E: real := 1.44269_50408_88963_4074; - -- log base 2 of e - constant MATH_LOG10_OF_E: real := 0.43429_44819_03251_82765; - -- log base 10 of e - constant MATH_SQRT2: real := 1.41421_35623_73095_04880; - -- sqrt of 2 - constant MATH_SQRT1_2: real := 0.70710_67811_86547_52440; - -- sqrt of 1/2 - constant MATH_SQRT_PI: real := 1.77245_38509_05516_02730; - -- sqrt of pi - constant MATH_DEG_TO_RAD: real := 0.01745_32925_19943_29577; - -- conversion factor from degree to radian - constant MATH_RAD_TO_DEG: real := 57.29577_95130_82320_87685; - -- conversion factor from radian to degree + constant MATH_E : REAL := 2.71828_18284_59045_23536; + -- Value of e + constant MATH_1_OVER_E : REAL := 0.36787_94411_71442_32160; + -- Value of 1/e + constant MATH_PI : REAL := 3.14159_26535_89793_23846; + -- Value of pi + constant MATH_2_PI : REAL := 6.28318_53071_79586_47693; + -- Value of 2*pi + constant MATH_1_OVER_PI : REAL := 0.31830_98861_83790_67154; + -- Value of 1/pi + constant MATH_PI_OVER_2 : REAL := 1.57079_63267_94896_61923; + -- Value of pi/2 + constant MATH_PI_OVER_3 : REAL := 1.04719_75511_96597_74615; + -- Value of pi/3 + constant MATH_PI_OVER_4 : REAL := 0.78539_81633_97448_30962; + -- Value of pi/4 + constant MATH_3_PI_OVER_2 : REAL := 4.71238_89803_84689_85769; + -- Value 3*pi/2 + constant MATH_LOG_OF_2 : REAL := 0.69314_71805_59945_30942; + -- Natural log of 2 + constant MATH_LOG_OF_10 : REAL := 2.30258_50929_94045_68402; + -- Natural log of 10 + constant MATH_LOG2_OF_E : REAL := 1.44269_50408_88963_4074; + -- Log base 2 of e + constant MATH_LOG10_OF_E: REAL := 0.43429_44819_03251_82765; + -- Log base 10 of e + constant MATH_SQRT_2: REAL := 1.41421_35623_73095_04880; + -- square root of 2 + constant MATH_1_OVER_SQRT_2: REAL := 0.70710_67811_86547_52440; + -- square root of 1/2 + constant MATH_SQRT_PI: REAL := 1.77245_38509_05516_02730; + -- square root of pi + constant MATH_DEG_TO_RAD: REAL := 0.01745_32925_19943_29577; + -- Conversion factor from degree to radian + constant MATH_RAD_TO_DEG: REAL := 57.29577_95130_82320_87680; + -- Conversion factor from radian to degree -- - -- function declarations + -- Function Declarations -- - function SIGN (X: real ) return real; - -- returns 1.0 if X > 0.0; 0.0 if X == 0.0; -1.0 if X < 0.0 - - function CEIL (X : real ) return real; - attribute foreign of ceil : function is "VHPIDIRECT ceil"; - -- returns smallest integer value (as real) not less than X - - function FLOOR (X : real ) return real; - attribute foreign of floor : function is "VHPIDIRECT floor"; - -- returns largest integer value (as real) not greater than X - - function ROUND (X : real ) return real; - attribute foreign of round : function is "VHPIDIRECT round"; - -- returns integer FLOOR(X + 0.5) if X > 0; - -- return integer CEIL(X - 0.5) if X < 0 - - -- IAC: we are missing the function TRUNC - -- IAC: we are missing the function MOD - -- IAC: functions FMAX and FMIN should be renamed REALMAX and REALMIN - - function FMAX (X, Y : real ) return real; - attribute foreign of fmax : function is "VHPIDIRECT fmax"; - -- returns the algebraically larger of X and Y - - function FMIN (X, Y : real ) return real; - attribute foreign of fmin : function is "VHPIDIRECT fmin"; - -- returns the algebraically smaller of X and Y - - procedure UNIFORM (variable Seed1,Seed2:inout integer; variable X:out real); - -- returns a pseudo-random number with uniform distribution in the - -- interval (0.0, 1.0). - -- Before the first call to UNIFORM, the seed values (Seed1, Seed2) must - -- be initialized to values in the range [1, 2147483562] and - -- [1, 2147483398] respectively. The seed values are modified after - -- each call to UNIFORM. - -- This random number generator is portable for 32-bit computers, and - -- it has period ~2.30584*(10**18) for each set of seed values. - -- - -- For VHDL-1992, the seeds will be global variables, functions to - -- initialize their values (INIT_SEED) will be provided, and the UNIFORM - -- procedure call will be modified accordingly. - - -- IAC: functions SRAND, RAND and GET_RAND_MAX should not be visible - - function SRAND (seed: in integer ) return integer; - attribute foreign of srand : function is "VHPIDIRECT srand"; - -- - -- sets value of seed for sequence of - -- pseudo-random numbers. - -- It uses the foreign native C function srand(). - - function RAND return integer; - attribute foreign of rand : function is "VHPIDIRECT rand"; - -- - -- returns an integer pseudo-random number with uniform distribution. - -- It uses the foreign native C function rand(). - -- Seed for the sequence is initialized with the - -- SRAND() function and value of the seed is changed every - -- time SRAND() is called, but it is not visible. - -- The range of generated values is platform dependent. - - function GET_RAND_MAX return integer; - -- - -- returns the upper bound of the range of the - -- pseudo-random numbers generated by RAND(). - -- The support for this function is platform dependent, and - -- it uses foreign native C functions or constants. - -- It may not be available in some platforms. - -- Note: the value of (RAND() / GET_RAND_MAX()) is a - -- pseudo-random number distributed between 0 & 1. - - function SQRT (X : real ) return real; - -- returns square root of X; X >= 0 - - function CBRT (X : real ) return real; - attribute foreign of cbrt : function is "VHPIDIRECT cbrt"; - -- returns cube root of X - - function "**" (X : integer; Y : real) return real; - -- returns Y power of X ==> X**Y; - -- error if X = 0 and Y <= 0.0 - -- error if X < 0 and Y does not have an integer value - - function "**" (X : real; Y : real) return real; - -- returns Y power of X ==> X**Y; - -- error if X = 0.0 and Y <= 0.0 - -- error if X < 0.0 and Y does not have an integer value - - function EXP (X : real ) return real; - attribute foreign of exp : function is "VHPIDIRECT exp"; - -- returns e**X; where e = MATH_E - - function LOG (X : real ) return real; - -- returns natural logarithm of X; X > 0 - - function LOG (X: in real; BASE: in real) return real; - -- returns logarithm base BASE of X; X > 0 - - function LOG2 (X : in real ) return real; - -- returns logarithm base 2 of X; X > 0 - - function LOG10 (X : in real ) return real; - -- returns logarithm base 10 of X; X > 0 - - function SIN (X : real ) return real; - attribute foreign of sin : function is "VHPIDIRECT sin"; - -- returns sin X; X in radians - - function COS ( X : real ) return real; - attribute foreign of cos : function is "VHPIDIRECT cos"; - -- returns cos X; X in radians - - function TAN (X : real ) return real; - attribute foreign of tan : function is "VHPIDIRECT tan"; - -- returns tan X; X in radians - -- X /= ((2k+1) * PI/2), where k is an integer - - -- IAC: function should be called ARCSIN - - function ASIN (X : real ) return real; - -- returns -PI/2 < asin X < PI/2; | X | <= 1 - - -- IAC: function should be called ARCCOS - - function ACOS (X : real ) return real; - -- returns 0 < acos X < PI; | X | <= 1 - - - -- IAC: function should be called ARCTAN - - function ATAN (X : real) return real; - attribute foreign of atan : function is "VHPIDIRECT atan"; - -- returns -PI/2 < atan X < PI/2 - - -- IAC: function ATAN2 should not exist - function ATAN2 (X : real; Y : real) return real; - -- returns atan (X/Y); -PI < atan2(X,Y) < PI; Y /= 0.0 - - function SINH (X : real) return real; - attribute foreign of sinh : function is "VHPIDIRECT sinh"; - -- hyperbolic sine; returns (e**X - e**(-X))/2 - - function COSH (X : real) return real; - attribute foreign of cosh : function is "VHPIDIRECT cosh"; - -- hyperbolic cosine; returns (e**X + e**(-X))/2 - - function TANH (X : real) return real; - attribute foreign of tanh : function is "VHPIDIRECT tanh"; - -- hyperbolic tangent; -- returns (e**X - e**(-X))/(e**X + e**(-X)) - - -- IAC: function should be called ARCSINH - - function ASINH (X : real) return real; - attribute foreign of asinh : function is "VHPIDIRECT asinh"; - -- returns ln( X + sqrt( X**2 + 1)) - - -- IAC: function should be called ARCCOSH - - function ACOSH (X : real) return real; - -- returns ln( X + sqrt( X**2 - 1)); X >= 1 - - -- IAC: function should be called ARCTANH - - function ATANH (X : real) return real; - -- returns (ln( (1 + X)/(1 - X)))/2 ; | X | < 1 + function SIGN (X: in REAL ) return REAL; + -- Purpose: + -- Returns 1.0 if X > 0.0; 0.0 if X = 0.0; -1.0 if X < 0.0 + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIGN(X)) <= 1.0 + -- Notes: + -- None + + function CEIL (X : in REAL ) return REAL; + -- Purpose: + -- Returns smallest INTEGER value (as REAL) not less than X + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CEIL(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function FLOOR (X : in REAL ) return REAL; + -- Purpose: + -- Returns largest INTEGER value (as REAL) not greater than X + -- Special values: + -- FLOOR(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- FLOOR(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function ROUND (X : in REAL ) return REAL; + -- Purpose: + -- Rounds X to the nearest integer value (as real). If X is + -- halfway between two integers, rounding is away from 0.0 + -- Special values: + -- ROUND(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ROUND(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function TRUNC (X : in REAL ) return REAL; + -- Purpose: + -- Truncates X towards 0.0 and returns truncated value + -- Special values: + -- TRUNC(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- TRUNC(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function "MOD" (X, Y: in REAL ) return REAL; + -- Purpose: + -- Returns floating point modulus of X/Y, with the same sign as + -- Y, and absolute value less than the absolute value of Y, and + -- for some INTEGER value N the result satisfies the relation + -- X = Y*N + MOD(X,Y) + -- Special values: + -- None + -- Domain: + -- X in REAL; Y in REAL and Y /= 0.0 + -- Error conditions: + -- Error if Y = 0.0 + -- Range: + -- ABS(MOD(X,Y)) < ABS(Y) + -- Notes: + -- None + + function REALMAX (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically larger of X and Y + -- Special values: + -- REALMAX(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMAX(X,Y) is mathematically unbounded + -- Notes: + -- None + + function REALMIN (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically smaller of X and Y + -- Special values: + -- REALMIN(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMIN(X,Y) is mathematically unbounded + -- Notes: + -- None + + procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE; variable X:out REAL); + -- Purpose: + -- Returns, in X, a pseudo-random number with uniform + -- distribution in the open interval (0.0, 1.0). + -- Special values: + -- None + -- Domain: + -- 1 <= SEED1 <= 2147483562; 1 <= SEED2 <= 2147483398 + -- Error conditions: + -- Error if SEED1 or SEED2 outside of valid domain + -- Range: + -- 0.0 < X < 1.0 + -- Notes: + -- a) The semantics for this function are described by the + -- algorithm published by Pierre L'Ecuyer in "Communications + -- of the ACM," vol. 31, no. 6, June 1988, pp. 742-774. + -- The algorithm is based on the combination of two + -- multiplicative linear congruential generators for 32-bit + -- platforms. + -- + -- b) Before the first call to UNIFORM, the seed values + -- (SEED1, SEED2) have to be initialized to values in the range + -- [1, 2147483562] and [1, 2147483398] respectively. The + -- seed values are modified after each call to UNIFORM. + -- + -- c) This random number generator is portable for 32-bit + -- computers, and it has a period of ~2.30584*(10**18) for each + -- set of seed values. + -- + -- d) For information on spectral tests for the algorithm, refer + -- to the L'Ecuyer article. + + function SQRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns square root of X + -- Special values: + -- SQRT(0.0) = 0.0 + -- SQRT(1.0) = 1.0 + -- Domain: + -- X >= 0.0 + -- Error conditions: + -- Error if X < 0.0 + -- Range: + -- SQRT(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of SQRT is + -- approximately given by: + -- SQRT(X) <= SQRT(REAL'HIGH) + + function CBRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns cube root of X + -- Special values: + -- CBRT(0.0) = 0.0 + -- CBRT(1.0) = 1.0 + -- CBRT(-1.0) = -1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CBRT(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of CBRT is approximately given by: + -- ABS(CBRT(X)) <= CBRT(REAL'HIGH) + + function "**" (X : in INTEGER; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0 + -- 0**Y = 0.0; Y > 0.0 + -- X**1.0 = REAL(X); X >= 0 + -- 1**Y = 1.0 + -- Domain: + -- X > 0 + -- X = 0 for Y > 0.0 + -- X < 0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0 and Y /= 0.0 + -- Error if X = 0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function "**" (X : in REAL; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0.0 + -- 0.0**Y = 0.0; Y > 0.0 + -- X**1.0 = X; X >= 0.0 + -- 1.0**Y = 1.0 + -- Domain: + -- X > 0.0 + -- X = 0.0 for Y > 0.0 + -- X < 0.0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0.0 and Y /= 0.0 + -- Error if X = 0.0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function EXP (X : in REAL ) return REAL; + -- Purpose: + -- Returns e**X; where e = MATH_E + -- Special values: + -- EXP(0.0) = 1.0 + -- EXP(1.0) = MATH_E + -- EXP(-1.0) = MATH_1_OVER_E + -- EXP(X) = 0.0 for X <= -LOG(REAL'HIGH) + -- Domain: + -- X in REAL such that EXP(X) <= REAL'HIGH + -- Error conditions: + -- Error if X > LOG(REAL'HIGH) + -- Range: + -- EXP(X) >= 0.0 + -- Notes: + -- a) The usable domain of EXP is approximately given by: + -- X <= LOG(REAL'HIGH) + + function LOG (X : in REAL ) return REAL; + -- Purpose: + -- Returns natural logarithm of X + -- Special values: + -- LOG(1.0) = 0.0 + -- LOG(MATH_E) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG is approximately given by: + -- LOG(0+) <= LOG(X) <= LOG(REAL'HIGH) + + function LOG2 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 2 of X + -- Special values: + -- LOG2(1.0) = 0.0 + -- LOG2(2.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG2(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG2 is approximately given by: + -- LOG2(0+) <= LOG2(X) <= LOG2(REAL'HIGH) + + function LOG10 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 10 of X + -- Special values: + -- LOG10(1.0) = 0.0 + -- LOG10(10.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG10(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG10 is approximately given by: + -- LOG10(0+) <= LOG10(X) <= LOG10(REAL'HIGH) + + function LOG (X: in REAL; BASE: in REAL) return REAL; + -- Purpose: + -- Returns logarithm base BASE of X + -- Special values: + -- LOG(1.0, BASE) = 0.0 + -- LOG(BASE, BASE) = 1.0 + -- Domain: + -- X > 0.0 + -- BASE > 0.0 + -- BASE /= 1.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Error if BASE <= 0.0 + -- Error if BASE = 1.0 + -- Range: + -- LOG(X, BASE) is mathematically unbounded + -- Notes: + -- a) When BASE > 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(0+, BASE) <= LOG(X, BASE) <= LOG(REAL'HIGH, BASE) + -- b) When 0.0 < BASE < 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(REAL'HIGH, BASE) <= LOG(X, BASE) <= LOG(0+, BASE) + + function SIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns sine of X; X in radians + -- Special values: + -- SIN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- SIN(X) = 1.0 for X = (4*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- SIN(X) = -1.0 for X = (4*k+3)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIN(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function COS ( X : in REAL ) return REAL; + -- Purpose: + -- Returns cosine of X; X in radians + -- Special values: + -- COS(X) = 0.0 for X = (2*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- COS(X) = 1.0 for X = (2*k)*MATH_PI, where k is an INTEGER + -- COS(X) = -1.0 for X = (2*k+1)*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(COS(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function TAN (X : in REAL ) return REAL; + -- Purpose: + -- Returns tangent of X; X in radians + -- Special values: + -- TAN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL and + -- X /= (2*k+1)*MATH_PI_OVER_2, where k is an INTEGER + -- Error conditions: + -- Error if X = ((2*k+1) * MATH_PI_OVER_2), where k is an + -- INTEGER + -- Range: + -- TAN(X) is mathematically unbounded + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function ARCSIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse sine of X + -- Special values: + -- ARCSIN(0.0) = 0.0 + -- ARCSIN(1.0) = MATH_PI_OVER_2 + -- ARCSIN(-1.0) = -MATH_PI_OVER_2 + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- ABS(ARCSIN(X) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCCOS (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse cosine of X + -- Special values: + -- ARCCOS(1.0) = 0.0 + -- ARCCOS(0.0) = MATH_PI_OVER_2 + -- ARCCOS(-1.0) = MATH_PI + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- 0.0 <= ARCCOS(X) <= MATH_PI + -- Notes: + -- None + + function ARCTAN (Y : in REAL) return REAL; + -- Purpose: + -- Returns the value of the angle in radians of the point + -- (1.0, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0) = 0.0 + -- Domain: + -- Y in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(ARCTAN(Y)) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCTAN (Y : in REAL; X : in REAL) return REAL; + -- Purpose: + -- Returns the principal value of the angle in radians of + -- the point (X, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0, X) = 0.0 if X > 0.0 + -- ARCTAN(0.0, X) = MATH_PI if X < 0.0 + -- ARCTAN(Y, 0.0) = MATH_PI_OVER_2 if Y > 0.0 + -- ARCTAN(Y, 0.0) = -MATH_PI_OVER_2 if Y < 0.0 + -- Domain: + -- Y in REAL + -- X in REAL, X /= 0.0 when Y = 0.0 + -- Error conditions: + -- Error if X = 0.0 and Y = 0.0 + -- Range: + -- -MATH_PI < ARCTAN(Y,X) <= MATH_PI + -- Notes: + -- None + + function SINH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic sine of X + -- Special values: + -- SINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- SINH(X) is mathematically unbounded + -- Notes: + -- a) The usable domain of SINH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + + function COSH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic cosine of X + -- Special values: + -- COSH(0.0) = 1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- COSH(X) >= 1.0 + -- Notes: + -- a) The usable domain of COSH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + function TANH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic tangent of X + -- Special values: + -- TANH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(TANH(X)) <= 1.0 + -- Notes: + -- None + + function ARCSINH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic sine of X + -- Special values: + -- ARCSINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ARCSINH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCSINH is approximately given by: + -- ABS(ARCSINH(X)) <= LOG(REAL'HIGH) + + function ARCCOSH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic cosine of X + -- Special values: + -- ARCCOSH(1.0) = 0.0 + -- Domain: + -- X >= 1.0 + -- Error conditions: + -- Error if X < 1.0 + -- Range: + -- ARCCOSH(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of ARCCOSH is + -- approximately given by: ARCCOSH(X) <= LOG(REAL'HIGH) + + function ARCTANH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic tangent of X + -- Special values: + -- ARCTANH(0.0) = 0.0 + -- Domain: + -- ABS(X) < 1.0 + -- Error conditions: + -- Error if ABS(X) >= 1.0 + -- Range: + -- ARCTANH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCTANH is approximately given by: + -- ABS(ARCTANH(X)) < LOG(REAL'HIGH) end MATH_REAL; |