functd.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------


partial class DLOG_EXP_FUNCTIONS

partial class DLOG_EXP_FUNCTIONS is -- This partial class introduces the logarithmic and exponential -- functions which may be included from the FLTD class when building -- a library as required. These are kept separate from the class FLTD -- itself as they will usually be implemented in some external mathematical -- software library to which this class provides a 'built-in' interface. -- NOTE The natural logarithm, exponent and pow are in FLTD. -- Version 1.1 Dec 2000. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 9 Jan 97 kh Original from ICSI Sather dist. -- 17 Dec 00 kh Moved to maths library -- 22 Mar 01 djw integral -> is_integral exp_minus_one : FLTD is -- This routine returns e^self-1.0, accurate even for tiny self. builtin FLTD_EXPM1 end ; exp2 : FLTD is -- This routine returns 2^self. Built-in. builtin FLTD_EXP2 end ; exp10 : FLTD is -- This routine returns 10^self. Built-in. builtin FLTD_EXP10 end ; plus_one_log : FLTD is -- This routine returns (self+1).log, accurate even for tiny self. -- Built-in. builtin FLTD_LOG1P end ; log2 : FLTD is -- This routine returns the logarithm to the base two of self. return self.log * log2_e end ; log10 : FLTD is -- This routine returns the logarithm base ten of self. Built-ib. builtin FLTD_LOG10 end ; -- Gamma Functions log_gamma : FLTD is -- This routine returns the value of the log gamma function. -- x.ln_gamma = x.gamma.abs.log builtin FLTD_LGAMMA end ; gamma : FLTD is -- This routine implements the Gamma function. if self > zero then return log_gamma.exp elsif is_exact then return zero elsif abs.floor.int.is_even then return (-log_gamma).exp else return log_gamma.exp end end ; end ; -- DLOG_EXP_FUNCTIONS

partial class DMATH_FUNCTIONS

partial class DMATH_FUNCTIONS is -- This partial class intorduces additional mathematical functions -- which may be included into the FLTD class where their availability is -- required. These are also kept separately from the class FLTD in this -- partial class as they will usually be implemented in some external -- software library to which this class provides a 'built-in' interface. -- Version 1.1 Dec 2000. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 7 Jan 97 kh Original from ICSI Sather dist. -- 17 Dec 00 kh Moved to maths library bessel_j0 : FLTD is builtin FLTD_J0 end ; bessel_j1 : FLTD is builtin FLTD_J1 end ; bessel_jn( order : INT ) : FLTD is builtin FLTD_JN end ; bessel_y0 : FLTD is builtin FLTD_Y0 end ; bessel_y1 : FLTD is builtin FLTD_Y1 end ; bessel_yn( order : INT ) : FLTD is builtin FLTD_YN end ; -- The standard error function erf and a derivative erf : FLTD is -- This routine calculates and returns the error function -- -- self.erf = (1/sqrt(pi))*integrate(0,self,exp(-t^2)dt) builtin FLTD_ERF end ; one_minus_erf : FLTD is -- This routine calculates 1.0 - self.erf in a way which avoids -- cancellation for large values of self. builtin FLTD_ERFC end ; -- Hyperbolic functions -- -- NOTES The hyperbolic functions handle exceptional arguments -- in the spirit of IEEE 754-1985. So :-- -- -- sinh and cosh return +-infinity on overflow -- -- acosh returns a NaN if its argument is less than 1.0 -- -- atanh returns a NaN if its argument has an absolute -- value > 1.0 acosh : FLTD is -- This routine returns the inverse hyperbolic cosine of self. builtin FLTD_ACOSH end ; cosh : FLTD is -- This routine returns the hyperbolic cosine of self. builtin FLTD_COSH end ; sinh : FLTD is -- This routine returns the hyperbolic sine of self. builtin FLTD_SINH end ; tanh : FLTD is -- This routine returns the hyperbolic tangent of self. builtin FLTD_TANH end ; asinh : FLTD is -- This routine returns the inverse hyperbolic sine of self. builtin FLTD_ASINH end ; atanh : FLTD is -- This routine returns the inverse hyperbolic tangent of self. builtin FLTD_ATANH end ; hypot( arg : FLTD ) : FLTD is -- This routine returns sqrt(self*self+arg*arg), taking precautions -- against unwarranted IEEE exceptions. +-infinity.hypot(arg) is +infinity -- for any arg, even a NaN, and is exceptional only for a signaling NaN. builtin FLTD_HYPOT end ; end ; -- DMATH_FUNCTIONS

partial class CPXD_FUNCTIONS

partial class CPXD_FUNCTIONS is -- This class specifies the log and exponential functions for complex -- numbers, it should be included in complex classes if required. -- Version 1.1 Dec 2000. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 4 Sep 97 kh Original taken from CPXD. -- 17 Dec 00 kh Moved exps to CPXD sinh : SAME is -- This routine returns the complex sinh of self using -- -- (e^self - e^(-self)) / 2. See Steele p308. raise self -- TO DO! end ; cosh : SAME is -- This routine returns the complex cosh of self using -- -- (e^self + e^(-self)) / 2. See Steele p308. raise self -- TO DO! end ; tanh : SAME is -- This routine returns the complex tanh of self using -- -- (e^self - e^(-self)) / (e^self + e^(-self)). See Steele p308. raise self -- TO DO! end ; asinh : SAME is -- This routine returns the hyperbolic asinh using -- -- log (self + sqrt(1 + self^2)) See Steele p308. raise self -- TO DO! end ; acosh : SAME is -- This routine returns the hyperbolic acosh using -- -- log (self + (self + 1)sqrt((self - 1)/(self + 1))))) See Steele p308. raise self -- TO DO! end ; atanh : SAME is -- This routine returns the hyperbolic atanh using -- -- log ((1 + self) * sqrt(1 / (1 - self^2))) See Steele p308. raise self -- TO DO! end ; end ; -- CPXD_FUNCTIONS