Skip to content

Cannot use the pow() nor pow10() functions #2456

Closed
@sebma

Description

@sebma

Describe the bug
I want to divide an integer representing a throughput in bits/sec by 10^9 to get Gbits/sec but I get pow/1 is not defined errors.

To Reproduce

$ echo 7223210000 | jq -r './pow(10,9) | tostring + " bits/sec"'
jq: error: pow/1 is not defined at <top-level>, line 1:
./pow(10,9) | tostring + " bits/sec"
jq: 1 compile error
$ echo 7223210000 | jq -r './pow10(9) | tostring + " bits/sec"'
jq: error: pow10/1 is not defined at <top-level>, line 1:
./pow10(9) | tostring + " bits/sec"
jq: 1 compile error

Expected behavior

$ echo 7223210000 | jq -r './pow(10,9) | tostring + " bits/sec"'
7.22321 bits/sec
$ echo 7223210000 | jq -r './pow10(9) | tostring + " bits/sec"'
7.22321 bits/sec

Environment (please complete the following information):

  • OS and Version: Linux CentOS 7.9
  • jq version 1.5

Additional context
jq has been built with maths functions ( -lm) :

$ ldd $(which jq) | grep libm
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007fa9155a9000)
$ rpm -qf /usr/lib64/libm.so.6
glibc-2.17-325.el7_9.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions