[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Bug in math library
From: |
Marek Michalkiewicz |
Subject: |
Re: [avr-libc-dev] Bug in math library |
Date: |
Sat, 8 Jan 2005 23:26:15 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
On Sat, Jan 08, 2005 at 05:46:14PM -0400, Colin O'Flynn wrote:
> Anyway the other thing I thought of - if the hidden bit is set when zero
> detected, it might be easier to just check for 0x01 being present in that
> register.
Before fp_split: exponent = 0
After fp_split: exponent = 1, hidden = 0 (denormal)
Before fp_split: exponent = 1
After fp_split: exponent = 1, hidden = 1 (small, but still "normal")
So you can't just check for 0x01, it would be true in both cases.
> However it is that sort of thing that will probably get broken in the
> future... to be completely safe I would need to do this:
>
> clr __tmp_reg__
> OR __tmp_reg__, rB2
> OR __tmp_reg__, rB1
> OR __tmp_reg__, rB0
Be sure to check that __tmp_reg__ (r0) doesn't hold some important
value - fplib uses almost all available registers.
> Then the Z flag would be set if all those registers are zero. It is an
> increase from 1 to 4 instructions.
Not 4 - replace clr/or with mov. Depending on registers used, it
could also be possible to use sbiw/cpc - see "tstsi" pattern in GCC.
But some register containing zero is necessary - in fplib you can't
depend on __zero_reg__ (r1), but some other zero register might be
available (like rAE/rBE cleared in fp_split).
It depends how exactly you want to compare against zero - perhaps
check for denormal (test hidden bit with sbrc/sbrs) is sufficient?
Division by denormal can overflow too, just like division by zero.
Marek
- [avr-libc-dev] Bug in math library, Colin O'Flynn, 2005/01/08
- Re: [avr-libc-dev] Bug in math library, Marek Michalkiewicz, 2005/01/08
- Message not available
- Message not available
- Re: [avr-libc-dev] Bug in math library, Paul Schlie, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Paul Schlie, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Bob Paddock, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Colin O'Flynn, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Paul Schlie, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Colin O'Flynn, 2005/01/09
- Re: [avr-libc-dev] Bug in math library, Joerg Wunsch, 2005/01/09