github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/numeric/log.mdx (about)

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