Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* denormalized FP numbers causing exceptions
@ 2001-10-09 21:03 Robert M. Riches Jr.
  2001-10-09 22:22 ` Uncle George
  0 siblings, 1 reply; 4+ messages in thread
From: Robert M. Riches Jr. @ 2001-10-09 21:03 UTC (permalink / raw)
  To: axp-list

On Redhat 7.1, default GCC version 2.96, I'm getting floating
exceptions on what appear to be denormalized numbers.  The code
is the Bow (or rainbow) information retrieval toolkit, and it's
blowing up in the following code:

	  double scores_sum = 0;
	  for (ci = 0; ci < barrel->cdocs->length; ci++)
	    scores_sum += scores[ci];

It appears whenever an input to the '+=' operator is less than
10^300, 10^308, or so, I get the floating exception.  At least
one of the numbers is around 1, so the tiny numbers could be
rounded to zero and it wouldn't affect the final result.  I
suppose I could try to add code to change an array element to
zero if it was less than about 10^290, but this may hit the same
exception as the addition attempt.

Is there a compiler option to either not generate denormalized
numbers or to handle them gracefully?

Thanks.

Robert Riches
richesr1@inetarena.com
rriches@cse.ogi.edu




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: denormalized FP numbers causing exceptions
@ 2001-10-09 21:15 Robert M. Riches Jr.
  2001-10-09 21:35 ` Daniel Green
  0 siblings, 1 reply; 4+ messages in thread
From: Robert M. Riches Jr. @ 2001-10-09 21:15 UTC (permalink / raw)
  To: axp-list

Oops!  Make that 10^-300-10^-308:

On Redhat 7.1, default GCC version 2.96, I'm getting floating
exceptions on what appear to be denormalized numbers.  The code
is the Bow (or rainbow) information retrieval toolkit, and it's
blowing up in the following code:

	  double scores_sum = 0;
	  for (ci = 0; ci < barrel->cdocs->length; ci++)
	    scores_sum += scores[ci];

It appears whenever an input to the '+=' operator is less than
10^-300-10^-308, or so, I get the floating exception.  At least
one of the numbers is around 1, so the tiny numbers could be
rounded to zero and it wouldn't affect the final result.  I
suppose I could try to add code to change an array element to
zero if it was less than about 10^290, but this may hit the same
exception as the addition attempt.

Is there a compiler option to either not generate denormalized
numbers or to handle them gracefully?

Thanks.

Robert Riches
richesr1@inetarena.com
rriches@cse.ogi.edu




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: denormalized FP numbers causing exceptions
  2001-10-09 21:15 Robert M. Riches Jr.
@ 2001-10-09 21:35 ` Daniel Green
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Green @ 2001-10-09 21:35 UTC (permalink / raw)
  To: axp-list

I am not sure if you can tell the compiler to handle them better,  but
you can
and probably should check for them your self. Look at the fpclassify
function.
It will tell you if have and fp number problems.  If it returns that
your number
is normalized, then you can continue.

There are about eight different states that a floating point number can
have;
quiet signaling
signaling
positive denormalized
negative denormalized
positive zero
negative zero
positive normal
negative normal

Hope this helps,
Dan


"Robert M. Riches Jr." wrote:

> Oops!  Make that 10^-300-10^-308:
>
> On Redhat 7.1, default GCC version 2.96, I'm getting floating
> exceptions on what appear to be denormalized numbers.  The code
> is the Bow (or rainbow) information retrieval toolkit, and it's
> blowing up in the following code:
>
>           double scores_sum = 0;
>           for (ci = 0; ci < barrel->cdocs->length; ci++)
>             scores_sum += scores[ci];
>
> It appears whenever an input to the '+=' operator is less than
> 10^-300-10^-308, or so, I get the floating exception.  At least
> one of the numbers is around 1, so the tiny numbers could be
> rounded to zero and it wouldn't affect the final result.  I
> suppose I could try to add code to change an array element to
> zero if it was less than about 10^290, but this may hit the same
> exception as the addition attempt.
>
> Is there a compiler option to either not generate denormalized
> numbers or to handle them gracefully?
>
> Thanks.
>
> Robert Riches
> richesr1@inetarena.com
> rriches@cse.ogi.edu
>
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: denormalized FP numbers causing exceptions
  2001-10-09 21:03 denormalized FP numbers causing exceptions Robert M. Riches Jr.
@ 2001-10-09 22:22 ` Uncle George
  0 siblings, 0 replies; 4+ messages in thread
From: Uncle George @ 2001-10-09 22:22 UTC (permalink / raw)
  To: axp-list

try cc -mieee

all denorns are trapped. the -mieee option sets u with the ieee
standards of float numbers & exception handling. u should be aware that
there is a cost, as denorms are processed via kernel software. but at
least u keep goin'
/gat

"Robert M. Riches Jr." wrote:

> On Redhat 7.1, default GCC version 2.96, I'm getting floating
> exceptions on what appear to be denormalized numbers.  The code
> is the Bow (or rainbow) information retrieval toolkit, and it's
> blowing up in the following code:
>
>           double scores_sum = 0;
>           for (ci = 0; ci < barrel->cdocs->length; ci++)
>             scores_sum += scores[ci];
>
> It appears whenever an input to the '+=' operator is less than
> 10^300, 10^308, or so, I get the floating exception.  At least
> one of the numbers is around 1, so the tiny numbers could be
> rounded to zero and it wouldn't affect the final result.  I
> suppose I could try to add code to change an array element to
> zero if it was less than about 10^290, but this may hit the same
> exception as the addition attempt.
>
> Is there a compiler option to either not generate denormalized
> numbers or to handle them gracefully?
>
> Thanks.
>
> Robert Riches
> richesr1@inetarena.com
> rriches@cse.ogi.edu
>
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-10-09 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-09 21:03 denormalized FP numbers causing exceptions Robert M. Riches Jr.
2001-10-09 22:22 ` Uncle George
  -- strict thread matches above, loose matches on Subject: below --
2001-10-09 21:15 Robert M. Riches Jr.
2001-10-09 21:35 ` Daniel Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox