Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
12 Views

isinf(9e96DF), isinf(9e384DD), isinf(9e6144DL) get wrong result

isinf() for large finite decimal floating-point values thinks that they are infinite.
In looking at , it appears that isinf() only works for float, double,
and long double. So, when presented with _Decimal32, _Decimal64, _Decimal128
values, they get converted to float, double, and long double. Since decimal FP
has a larger exponent range than binary FP, some large finite DFP values get
converted into BFP infinities. WG14 N1312 (the DFP tech report) says that
isinf() is supposed to work with all six real floating types.

The same problem applies to isnan(), isnormal(), isfinite(), fpclassify(), signbit().
0 Kudos
3 Replies
Highlighted
New Contributor II
12 Views

If you use, isinfd32, isinfd64, isinfd128 for the respective types in Post title, they all return 0, though isinf it seems returns 1.

For above functions, you need to use . And so, have to use -limf in the link-line, as icc does not seem to take it by default for the .c files.

icc 75876.c -limf

Also, from standard it looks, Decimalxx types are supported only for C files, i.e, .c files, and not .cpp, and they give some error for .cpp.

Following is sample program <75876.c>

/////75876.c///////////

[bash]#include 
#include 
//#define __STDC_WANT_DEC_FP__
int main()
{
printf("%dn",isinfd128(9e6144DL));
return 1;
}





[/bash]
0 Kudos
Highlighted
Beginner
12 Views

So, you have confirmed that isinf() is doing the wrong thing with decimal FP values in C programs.
WG14 N1312 (the Decimal FP Technical Report) in section 9.3 has: "All classification macros
specified in C99 7.12.3 are also extended to handle decimal floating-point types."
0 Kudos
Highlighted
New Contributor II
12 Views

You seem to be right in this too.. I examined the Technical Report, and the result is not as expected.

I have filed bug to developer for a fix, and keep you updated on the progress.

0 Kudos