แก้ไข

แชร์ผ่าน


LOG (NoSQL query)

APPLIES TO: NoSQL

Returns the natural logarithm of the specified numeric expression.

Syntax

LOG(<numeric_expr> [, <numeric_base>])  

Arguments

Description
numeric_expr A numeric expression.
numeric_base (Optional) An optional numeric value that sets the base for the logarithm. If not set, the default value is the natural logarithm approximately equal to `2.718281828``.

Return types

Returns a numeric expression.

Examples

The following example returns the logarithm value of various values.

SELECT VALUE {
    logFive: LOG(5),
    logTwoBaseTen: LOG(2, 10)
}
[
  {
    "logFive": 1.6094379124341003,
    "logTwoBaseTen": 0.3010299956639812
  }
]

Remarks

  • This function doesn't use the index.
  • The natural logarithm of the exponential of a number is the number itself: LOG( EXP( n ) ) = n. And the exponential of the natural logarithm of a number is the number itself: EXP( LOG( n ) ) = n.