abs function

Syntax

float   abs(x)

float[] abs(x)

Parameters

Returns

The absolute value of floating point number x or a new array containing absolute values of elements of x.

Related

Example

findAll(array, value, epsilon) =
    [0 : size(array)-1][abs(array .- value) .<= epsilon]

getValues(array, value, epsilon) =
    array[abs(array .- value) .<= epsilon]
	
const sequence = [0 : 0.1 : 2]

Lot --> print(           findFirst(sequence, 1, 0.15)   )  // 9
        print( sequence[ findFirst(sequence, 1, 0.15) ] )  // 0.9
        print(           findAll  (sequence, 1, 0.15)   )  // (3)[9,10,11]
        print( sequence[ findAll  (sequence, 1, 0.15) ] )  // (3)[0.9,1,1.1]
        print(           getValues(sequence, 1, 0.15)   )  // (3)[0.9,1,1.1]
Using the abs function to find values in an array within a tolerance epsilon. In contrast to the findFirst function, findAll returns all found indices.

Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.