"Jonathan M. Lever" wrote: > > Hi, > > You may well know already, but var_range reports zero differently according to whether eplex is loaded. > > E.g. 1 lib(range). > 2 lib(ria). > 3 ria : (X :: 0 .. 10), var_range(X, L, H). > 4 lib(eplex). > 5 ria : (X :: 0 .. 10), var_range(X, L, H). > > 3 gives L = 0.0 whereas 5 gives L = -0.0 > > Doing something like ria:(L >= 0) is a workaround. > > Ran into this this week, as a test VarMin == 0.0 started failing. > Think it's the same in 5.4, 5.5 and prerelease. Probably not in 5.4. Since 5.5, "syntactic" comparisons (=/2, ==/2 etc) consider negative and positive zeros as different. This was a deliberate change to clean up the semantics. Since arithmetic computations will sometimes result in negative zeros, (here it is probably something like ceiling(-1.0e-6) giving -0.0) you should not use code that relies on the sign. Change the test to VarMin =:= 0.0 (the arithmetic comparisons treat the zeros as equal). Oh, and be aware that you are violating the old rule "never test floating point numbers for equality" :-) Cheers, JoachimReceived on Fri May 02 15:48:51 2003
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:21 PM GMT GMT