Updated on 2025-04-14 GMT+08:00

Numeric Operation Functions

Table 1 Numeric operation functions

MySQL

GaussDB

Difference

log2()

Supported, with differences

  • The display of decimal places is different from that in MySQL. Due to the limitation of the GaussDB floating-point data type, the extra_float_digits parameter is used to control the number of decimal places to be displayed.
  • Due to the internal processing difference of the input precision, the calculation results of GaussDB and MySQL are different.
  • 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 number type: numeric and real.
    • Character string type: character, character varying, clob, and text. Only numeric integer strings are supported.
    • SET type.
    • NULL type.

log10()

Supported, with differences

  • The display of decimal places is different from that in MySQL. Due to the limitation of the GaussDB floating-point data type, the extra_float_digits parameter is used to control the number of decimal places to be displayed.
  • Due to the internal processing difference of the input precision, the calculation results of GaussDB and MySQL are different.
  • 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 number type: numeric and real.
    • Character string type: character, character varying, clob, and text. Only numeric integer strings are supported.
    • SET type.
    • NULL type.