Returns the hyperbolic arc sine of the specified number. - CSharp System

CSharp examples for System:Math Number

Description

Returns the hyperbolic arc sine of the specified number.

Demo Code

/*//w ww. j ava2 s  . c o  m
    **************************************************************************
    **
    **    Class  SpecialFunction (C#)
    **
    **************************************************************************
    **    Copyright (C) 1984 Stephen L. Moshier (original C version - Cephes Math Library)
    **    Copyright (C) 1996 Leigh Brookshaw    (Java version)
    **    Copyright (C) 2005 Miroslav Stampar   (C# version [->this<-])
    **
    **    This program is free software; you can redistribute it and/or modify
    **    it under the terms of the GNU General Public License as published by
    **    the Free Software Foundation; either version 2 of the License, or
    **    (at your option) any later version.
    **
    **    This program 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 the
    **    GNU General Public License for more details.
    **
    **    You should have received a copy of the GNU General Public License
    **    along with this program; if not, write to the Free Software
    **    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    **************************************************************************
    **
    **    This class is an extension of System.Math. It includes a number
    **    of special functions not found in the Math class.
    **
    *************************************************************************/
using System;

public class Main{
        /// <summary>
        ///     Returns the hyperbolic arc sine of the specified number.
        /// </summary>
        /// <param name="xx"></param>
        /// <returns></returns>
        public static double asinh(double xx)
        {
            double x;
            int sign;
            if (xx == 0.0) return xx;
            if (xx < 0.0)
            {
                sign = -1;
                x = -xx;
            }
            else
            {
                sign = 1;
                x = xx;
            }
            return sign*Math.Log(x + Math.Sqrt(x*x + 1));
        }
}

Related Tutorials