Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inconsistent dump results of jq #2367

@shao-hua-li

Description

@shao-hua-li

Hi there,

I found that for large floating numbers, when compiling with gcc and clang, jq would emit different outputs.

For example, for echo '{"a": 1E9999999999}' | jq .,
gcc compiled jq would emit:

{
  "a": ((double)1.79769313486231570814527423731704357e+308L)
}

while clang compiled jq would emit:

{
  "a": 1.7976931348623157e+308
}

I think the cause is probably different interpretation of DBL_MAX / DBL_MIN in gcc and clang. But to ensure the correctness, robustness, and consistency of jq, it's important to keep programs' behaviour consistent across main-stream compilers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions