github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/numeric/abs.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: abs - Functions - Configuration Language
     4  description: The abs function returns the absolute value of the given number.
     5  ---
     6  
     7  # `abs` Function
     8  
     9  `abs` returns the absolute value of the given number. In other words, if the
    10  number is zero or positive then it is returned as-is, but if it is negative
    11  then it is multiplied by -1 to make it positive before returning it.
    12  
    13  ## Examples
    14  
    15  ```shell-session
    16  > abs(23)
    17  23
    18  > abs(0)
    19  0
    20  > abs(-12.4)
    21  12.4
    22  ```