TanH()

TanH()

Hyperbolic Tangent of the argument

Syntax

      TANH( nArea ) -> nHyperbolicTangent

Arguments

<nArea> the size of the area (see below)

Returns

<nHyperbolicTangent> the hyperbolic tangent of <nArea>

Description

The function TANH() calculates the hyperbolic tangent of the argument. In analytical mathematics it is defined as SINH(x)/COSH(x).

Examples

      ? tanh( 0.0 ) // --> 0.0
      ? tanh( 1.0 ) // --> 0.7615...

Tests

      tanh( 0.0 ) == 0.0
      tanh( -0.5 ) == -tanh( 0.5 )

Compliance

TANH() is new in Harbours CT3’s library.

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), RTOD(), DTOR(), PI()

TAN()

TAN()

Tangent of the argument

Syntax

      TAN( nRadiant ) -> nTangent

Arguments

<nRadiant> an angle size given in radiants

Returns

<nTangent> the tangent of <nRadiant>

Description

The function TAN() calculates the tangent of an angle whose size is given in radiants (full angle equals 2*Pi – see DTOR() for angle size given in degress). A common geometric interpretation of the TAN() function is the counterkathede-ankathede-ratio of a right-angled triangle, or, tan(x) = sin(x)/cos(x).

Examples

      ? tan( 0.0 ) // --> 0.0
      ? tan( 1.0 ) // --> 1.5574...

Tests

      tan( 0.0 ) == 0.0
      tan( PI() / 4 ) == 1
      tan( PI() ) == 0.0

Compliance

TAN() is compatible with CT3’s TAN().

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), TANH(), RTOD(), DTOR(), PI()

SINH()

SINH()

Hyperbolic Sine of the argument

Syntax

      SINH( nArea ) -> nHyperbolicSine

Arguments

<nArea> the size of the area (see below)

Returns

<nHyperbolicSine> the hyperbolic sine of <nArea>

Description

The function SINH() calculates the hyperbolic sine of the argument. In analytical mathematics it is defined as 1/2*(exp(nArea)-exp(-nArea)). A common geometric interpretation of the SINH() function is the maximum y value of the points in the area with the given size <nArea>, that is bound by the x axis, a straight line through the point of origin (this one is fixed by the area) and the hyperbola xˆ2-yˆ2=1.

Examples

      ? sinh( 0.0 ) // --> 0.0
      ? sinh( 1.0 ) // --> 1.1752...

Tests

      sinh( 0.0 ) == 0.0
      sinh( -0.5 ) == -sinh( 0.5 )

Compliance

SINH() is new in Harbours CT3’s library.

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), COSH(), TANH(), RTOD(), DTOR(), PI()

SIN()

SIN()

Sine of the argument

Syntax

      SIN (nRadiant) -> nSine

Arguments

<nRadiant> an angle size given in radiants

Returns

<nSine> the sine of <nRadiant>

Description

The function SIN() calculates the sine of an angle whose size is given in radiants (full angle equals 2*Pi – see DTOR() for angle size given in degress). A common geometric interpretation of the SIN() function is the counterkathede-hypotenuse-ratio of a right-angled triangle.

Examples

      ? sin( 0.0 ) // --> 0.0
      ? sin( 1.0 ) // --> 0.8414...

Tests

      sin( 0.0 ) == 0.0
      sin( PI() / 4 ) == sqrt( 1 / 2 )
      sin( PI() / 2 ) == 1.0
      sin( PI() ) == 0.0

Compliance

SIN() is compatible with CT3’s SIN().

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), TANH(), RTOD(), DTOR(), PI()

SIGN()

SIGN()

Sign of a number

Syntax

      SIGN( <nNumber> ) -> nSign

Arguments

<nNumber> a number

Returns

<nSign> sign of <nNumber>

Description

The function SIGN() determines the sign of <nNumber>. If <nNumber> is > 0, then SIGN(<nNumber>) returns 1 If <nNumber> is < 0, then SIGN(<nNumber>) returns -1 If <nNumber> is == 0, then SIGN(<nNumber>) returns 0

Examples

      ? sign( 1.1 )   // --> 1
      ? sign( -1.1 )  // --> -1
      ? sign( 0.0 )   // --> 0

Tests

      sign( 1.1 )  == 1
      sign( -1.1 ) == -1
      sign( 0.0 )  == 0

Compliance

SIGN() is compatible with CT3’s SIGN().

Platforms

All

Files

Source is math.c, library is libct.

INFINITY()

INFINITY()

Returns the largest floating point number available in the system

Syntax

      INFINITY( [<lPlatformIndependant>] ) --> nLargestNumber

Arguments

[<lPlatformIndependant>] .T., if the function should return the maximum floating point value available (DBL_MAX) .F., function should try to return the same value as the original CT3 lib did Default: .F.

Returns

<nLargestNumber> the largest floating point number available in the system

Description

INFINITY() returns the largest floating point number available in the system. For platform independance, this is set to DBL_MAX.

Compliance

INFINITY() must not necessarily return the same number as CT3’s INFINITY().

Platforms

All

Files

Source is num1.c, library is libct.

RTOD()

RTOD()

Convert radiant to degree

Syntax

      RTOD( nRadiant ) -> nDegree

Arguments

<nRadiant> the size of an angle in radiant

Returns

<nDegree> the size of that angle in degree

Description

The function RTOD() can be used to convert sizes of angles given in radiant (like those returned by the asin, acos or atan function) to degrees that are commonly used geometry and technics.

Examples

      ? rtod( PI() ) // --> 180
      ? tanh( PI() / 3 ) // --> 60

Tests

      rtod( 0.0 ) == 0.0
      rtod( PI() ) == 180.0

Compliance

RTOD() is compatible with CT3’s RTOD().

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), TANH(), DTOR(), PI()

PI()

PI()

Returns Pi, the perimeter-to-diameter-ratio of a circle

Syntax

      PI() -> nPi

Returns

<nPi> the math constant Pi with maximum precision available

Description

The function PI() can be used if the constant Pi is needed with maximum precision. One of the most known interpretations of this number is the constant perimeter-to-diameter-ratio of circles.

Examples

      // the diameter of a circle-like swimming pool is 3.4 meters, how
      // long is the perimeter ?

      ? Str( PI() * 3.4, 5, 3 ) + " meters" // --> 10.681 meters

Compliance

PI() is compatible with CT3’s PI().

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), TANH(), RTOD(), DTOR()

EXPONENT()

EXPONENT()

Evaluate the exponent of a floating point number

Syntax

      EXPONENT( <nFloatingPointNumber> ) --> nExponent

Arguments

<nFloatingPointNumber> Designate any Harbour number.

Returns

EXPONENT() returns the exponent of the <nFloatingPointNumber> number in base 2.

Description

This function supplements MANTISSA() to return the exponent of the <nFloatingPointNumber> number.

Values > 1 or values < -1 return a positive number 0 to 1023.

Values < 1 or values > -1 return a negative number -1 to -1023.

The EXPONENT( 0 ), return 0.

The following calculation reproduces the original value:

2ˆEXPONENT(<nFloatingPointNumber>) * MANTISSA(<nFloatingPointNumber>) = <nFloatingPointNumber>

TODO: add documentation

Compliance

EXPONENT() is compatible with CT3’s EXPONENT()

Platforms

All

Files

Source is exponent.c, library is libct.

Seealso

MANTISSA()

DTOR()

DTOR()

Convert degree to radiant

Syntax

      DTOR( nDegree ) -> nRadiant

Arguments

<nDegree> the size of that angle in degree

Returns

<nRadiant> the size of an angle in radiant

Description

The function DTOR() can be used to convert sizes of angles given in degrees to radiant (as expected by sin, cos or tan functions).

Examples

      ? dtor( 180 ) // --> PI()
      ? dtor( 60 ) // --> PI() / 3

Tests

      dtor( 0.0 ) == 0.0
      dtor( 180.0 ) == PI()

Compliance

DTOR() is compatible with CT3’s DTOR().

Platforms

All

Files

Source is trig.c, library is libct.

Seealso

SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(), ATN2(), SINH(), COSH(), TANH(), RTOD(), PI()