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

     1  ---
     2  layout: docs
     3  page_title: log - Functions - Configuration Language
     4  description: The log function returns the logarithm of a given number in a given base.
     5  ---
     6  
     7  # `log` Function
     8  
     9  `log` returns the logarithm of a given number in a given base.
    10  
    11  ```hcl
    12  log(number, base)
    13  ```
    14  
    15  ## Examples
    16  
    17  ```shell-session
    18  > log(50, 10)
    19  1.6989700043360185
    20  > log(16, 2)
    21  4
    22  ```
    23  
    24  `log` and `ceil` can be used together to find the minimum number of binary
    25  digits required to represent a given number of distinct values:
    26  
    27  ```shell-session
    28  > ceil(log(15, 2))
    29  4
    30  > ceil(log(16, 2))
    31  4
    32  > ceil(log(17, 2))
    33  5
    34  ```