- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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().
In looking at
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().
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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>
For above functions, you need to use
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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."
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."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page