cond-cmp-numeric.mk revision 1.3
11.3Srillig# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $ 21.1Srillig# 31.2Srillig# Tests for numeric comparisons in .if conditions. 41.1Srillig 51.3Srillig.MAKEFLAGS: -dc 61.3Srillig 71.3Srillig# The ${:U...} on the left-hand side is necessary for the parser. 81.3Srillig 91.3Srillig# Even if strtod(3) parses "INF" as +Infinity, make does not accept this 101.3Srillig# since it is not really a number; see TryParseNumber. 111.3Srillig.if !(${:UINF} > 1e100) 121.3Srillig. error 131.3Srillig.endif 141.3Srillig 151.3Srillig# Neither is NaN a number; see TryParseNumber. 161.3Srillig.if ${:UNaN} > NaN 171.3Srillig. error 181.3Srillig.endif 191.3Srillig 201.3Srillig# Since NaN is not parsed as a number, both operands are interpreted 211.3Srillig# as strings and are therefore equal. If they were parsed as numbers, 221.3Srillig# they would compare unequal, since NaN is unequal to any and everything, 231.3Srillig# including itself. 241.3Srillig.if !(${:UNaN} == NaN) 251.3Srillig. error 261.3Srillig.endif 271.1Srillig 281.1Srilligall: 291.1Srillig @:; 30