Skip to content

lang: floor and ceil functions produce incorrect result for positive and negative infinity #21463

@apparentlymart

Description

@apparentlymart

Terraform Version

Terraform v0.12.0

Expected Behavior

floor and ceil functions, when given an infinity, should return that same infinity.

Actual Behavior

The infinity is truncated to either the minimum or maximum int64:

> ceil(1/0)
-9223372036854775808

If this result is then used somewhere else, it's likely to lead to a very confusing error message at best or degenerate behavior at worst -- like trying to create 9 trillion of something. Preserving the infinity as-is, on the other hand, would cause a reasonable range error to be produced if the result is used somewhere that an int64 is required.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions