FirebirdSQL logo

TANH()

Hyperbolic tangent

Result type

DOUBLE PRECISION

Syntax
TANH (number)
Table 1. TANH Function Parameters
Parameter Description

number

An expression of a numeric type

Due to rounding, the result is in the range [-1, 1] (mathematically, it’s <-1, 1>).

TRUNC()

Truncate number

Result type

single argument: integer type, DOUBLE PRECISION or DECFLOAT;
two arguments: numerical, matching first argument

Syntax
TRUNC (number [, scale])
Table 1. TRUNC Function Parameters
Parameter Description

number

An expression of a numeric type

scale

An integer specifying the number of decimal places toward which truncating is to be performed, e.g.:

  •  2 for truncating to the nearest multiple of 0.01

  •  1 for truncating to the nearest multiple of 0.1

  •  0 for truncating to the nearest whole number

  • -1 for truncating to the nearest multiple of 10

  • -2 for truncating to the nearest multiple of 100

The single argument variant returns the integer part of a number.With the optional scale argument, the number can be truncated to powers-of-ten multiples (tens, hundreds, tenths, hundredths, etc.).

Note
  • If the scale argument is present, the result usually has the same scale as the first argument, e.g.

    • TRUNC(789.2225, 2) returns 789.2200 (not 789.22)

    • TRUNC(345.4, -2) returns 300.0 (not 300)

    • TRUNC(-163.41, 0) returns -163.00 (not -163)

  • Otherwise, the result scale is 0:

    • TRUNC(-163.41) returns -163

Important

If you are used to the behaviour of the external function TRUNCATE, please notice that the internal function TRUNC always truncates toward zero, i.e. upward for negative numbers.