Skip to content

testbench3.cpp: integer exp2 test uses inexact reference and invalid test data #2

Description

@oltolm

The following issue was found by an AI while I was using VCL to test GCC. I don't know if it is correct, but it did lead to test failures.


The exp2 test in testbench3.cpp (testcase 11) is incorrect for integer input types.

The reference function computes exp2 as powl(2., a), which goes through floating-point pow and can introduce rounding errors for integer exponents. It also does not model VCL's overflow and underflow behavior correctly at the type boundaries.

In addition, the test data generator uses the normal floating-point data path for integer tests. After conversion to integer types, this can produce invalid inputs, including values derived from infinities or NaNs.

As a result, the integer exp2 test can fail even when the implementation is correct.

Expected behavior

For integer input types, the reference function should compute exact powers of two and apply the same overflow and underflow limits as VCL. The test data generator should produce integer exponent values directly, including relevant boundary cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions