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

floating point operation result is out of range

Trying to compile gzip,

But I keep getting,


isnan.c(132): error: floating-point operation result is out of range
static memory_double nan = { L_(0.0) / L_(0.0) };
^

isnan.c(133): error: floating-point operation result is out of range
static DOUBLE plus_inf = L_(1.0) / L_(0.0);


This maybe a bug with the icc compiler.


0 Kudos
3 Replies
Highlighted
New Contributor II
47 Views

yes, this looks to be a bug with icc. Below is a small test-case:--

[bash]#include 

#include 

static long double nan = { 0.0L / 0.0L };

static long double plus_in = 1.0L / 0.0L;

static long double minus_in = -1.0L / 0.0L;

int main()

{

return 1;

}
[/bash]

This gives errors with icc, while gcc builds fine.

I am going to escalate to the developer, and will let you know the progress.

Regards
Milind
0 Kudos
Highlighted
New Contributor II
47 Views

Record number for issue is: DPD200155372.

I see that using instead of converts the errors into warnings. So, if possible, you can use as workaround for now, for the particular file where problem is being seen.

0 Kudos
Highlighted
New Contributor II
47 Views

I got a reply from developer:--

The situation described (i.e. that the compiler works differently between C and C++) is not a bug. It reflects the fact that run-time initialization of static objects is allowed in C++, but not in C. However, what is a bug is the fact that we reject it while GCC accepts it without a quiver, even in C.

It shouldn't be hard to drop divide-by-zero from the list of floating-point errors. The interesting question is whether that would have any side effects.



Also, I tried the following program which works interestingly, with non-static non-global variables:--

[bash]#include 
int main()
{
  long double nan = { 0.0L / 0.0L };
  long double plus_in = 1.0L / 0.0L;
  long double minus_in = -1.0L / 0.0L;


return 1;
}
[/bash]

Though I am in touch with the developer to correct the bug, which is not reported in gcc.
0 Kudos