1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
* Fix predicates
From: "Sisyphus" <sisyphus1@optusnet.com.au>
To: "philippe theveny" <philippe.theveny@inrialpes.fr>,
<Nathalie.Revol@ens-lyon.fr>
Subject: mpfi-1.4: Some surprises wrt nans
Date: Mon, 1 Feb 2010 21:26:01 +1100
Hi,
Here's the demo prog:
###############################
#include <stdio.h>
#include <mpfi.h>
#include <mpfi_io.h>
int main(void) {
mpfi_t x;
mpfi_init(x);
mpfi_out_str(stdout, 10, 0, x);
printf("\n%d %d %d %d %d %d\n",
mpfi_is_pos(x),
mpfi_is_strictly_pos(x),
mpfi_is_nonneg(x),
mpfi_is_neg(x),
mpfi_is_strictly_neg(x),
mpfi_is_nonpos(x));
return 0;
}
###############################
It shows that mpfi_is_pos(), mpfi_is_strictly_pos(), mpfi_is_nonneg(),
mpfi_is_neg(), mpfi_is_strictly_neg() and mpfi_is_nonpos() all return true
for nans.
I expected that they all would return false .... though there might be some
room for debate on that as regards nonpos and nonneg.
(Btw, there's no need for any patches - I can wait for the next release.
Main purpose of this post is just to make sure you're aware of this
behaviour.)
Cheers,
Rob
------
|