Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

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

tydeman
Beginner
316 Views
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
Milind_Kulkarni__Int
New Contributor II
316 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
tydeman
Beginner
316 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
Milind_Kulkarni__Int
New Contributor II
316 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
Reply