1 # $NetBSD: cond-cmp-numeric-eq.mk,v 1.5 2020/11/08 21:47:59 rillig Exp $
3 # Tests for numeric comparisons with the == operator in .if conditions.
5 # This comparison yields the same result, whether numeric or character-based.
11 # This comparison yields the same result, whether numeric or character-based.
20 # Scientific notation is supported, as per strtod.
31 # Trailing zeroes after the decimal point are irrelevant for the numeric
43 # As of 2020-08-23, numeric comparison is implemented as parsing both sides
44 # as double, and then performing a normal comparison. The range of double is
45 # typically 16 or 17 significant digits, therefore these two numbers seem to
47 .if 1.000000000000000001 == 1.000000000000000002
52 # Because an IEEE 754 double can only hold integers with a mantissa of 53
53 # bits, these two numbers are considered the same. The 993 is rounded down
55 .if 9007199254740993 == 9007199254740992
59 # The 995 is rounded up, the 997 is rounded down.
60 .if 9007199254740995 == 9007199254740997
62 . error Probably a misconfiguration in the floating point environment, \
63 or maybe a machine without IEEE 754 floating point support.
66 # There is no = operator for numbers.
73 # There is no === operator for numbers either.
74 .if !(12345 === 12345)