Search
Document Center

# :exp_decay

Last Updated:Feb 23, 2023

## Feature functions

You can use feature functions in sort expressions. Most feature functions can be used only in fine sort expressions. You can combine various syntax and clauses to perform complex sorts.

The fields that you reference in parameters of feature functions must be configured as index or attribute fields based on the description of each function.

## exp_decay: uses an exponential function to calculate a decay degree based on the distance between values and a specified start point

1.Syntax:

exp_decay(origin, value, scale, decay, offset)

2.Parameters:

• origin: the start point. The value of this parameter must be a double-precision floating-point number.

• value: the user-defined field or the expression for which you want to calculate the decay degree. The value of this parameter must be a double-precision floating-point number.

• scale: the scale that is used to calculate the decay degree. The value of this parameter must be a double-precision floating-point number.

• decay: the decay degree when the distance equals to the value of the scale parameter. This parameter is optional. The value of this parameter must be a double-precision floating-point number. Default value: 0.000001.

• offset: the offset. The decay degree starts to be calculated when the distance is greater than the offset. This parameter is optional. The value of this parameter must be a double-precision floating-point number. Default value: 0.

2.Return value:

The return value is of the DOUBLE type. Valid values: [0,1].

4.Scenarios:

The usage of this function is the same as that of the gauss_decay function, except that the decay algorithms of the two functions are different.

5.Usage notes:

• The field that you reference in the parameter of this function must be configured as an attribute field.

• If the value of the scale parameter is less than or equal to 0, the exp_decay function returns 0 by default.

• If the value of the decay parameter is greater than or equal to 1, the exp_decay function returns 1 by default.

• If the value of the decay parameter is less than or equal to 0, the decay parameter is set to 0.000001 by default.

• If the value of the offset parameter is less than 0, the offset parameter is set to 0 by default.