Updated on 2024-05-14 GMT+08:00

Arithmetic Functions

Table 1 Arithmetic functions

No.

MySQL

GaussDB

Difference

1

log2()

Supported.

  1. The display of decimal places is different from that in MySQL. Due to the restriction of the GaussDB floating-point data type, the extra_float_digits parameter is used to control the number of decimal places to be displayed.
  2. Due to the internal processing difference of the input precision, the calculation results of GaussDB and MySQL are different.
  3. The following data types are supported:
    • Integer types: bigint, int16, int, smallint, and tinyint.
    • Unsigned integer types: bigint unsigned, integer unsigned, smallint unsigned, and tinyint unsigned.
    • Floating-point types: numeric and real.
    • String types: character, character varying, clob, text, and numeric. However, only numeric integer strings are supported.
    • SET type.
    • NULL type.

2

log10()

Supported.

  1. The display of decimal places is different from that in MySQL. Due to the restriction of the GaussDB floating-point data type, the extra_float_digits parameter is used to control the number of decimal places to be displayed.
  2. Due to the internal processing difference of the input precision, the calculation results of GaussDB and MySQL are different.
  3. The following data types are supported:
    • Integer types: bigint, int16, int, smallint, and tinyint.
    • Unsigned integer types: bigint unsigned, integer unsigned, smallint unsigned, and tinyint unsigned.
    • Floating-point types: numeric and real.
    • String types: character, character varying, clob, text, and numeric. However, only numeric integer strings are supported.
    • SET type.
    • NULL type.