From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Wed, 30 Jan 2013 22:50:49 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: <20130130221845.CB4BAB82A@mail.bitblocks.com> References: <87c109280f2fc2bdaa0c68867f849daf@hamnavoe.com> <20130130221845.CB4BAB82A@mail.bitblocks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] emulated fp on arm Topicbox-Message-UUID: 11fe0f28-ead8-11e9-9d60-3106f5b1d025 > As ieee754 (1985): >=20 > When the sum of two operands with opposite signs (or the > difference of two operands with like signs) is exactly zero, > the sign of that sum (or difference) shall be + in all > rounding modes except round toward -INFINITY, in which mode > that sign shall be -. due to the emulator interface, both cases call fpisub. i've run a number of tests on this with relatively small numbers that are equal. and this seems to solve the problems without creating new ones. - erik ; diff -c fpi.c /sys/src/9/omap fpi.c:137,143 - /sys/src/9/omap/fpi.c:137,142 void fpisub(Internal *x, Internal *y, Internal *i) { - int exact; Internal *t; =20 if(y->e < x->e fpi.c:158,164 - /sys/src/9/omap/fpi.c:157,162 SetInfinity(i); return; } - exact =3D x->e =3D=3D y->e; matchexponents(x, y); i->e =3D y->e; i->h =3D y->h - x->h; fpi.c:167,179 - /sys/src/9/omap/fpi.c:165,172 i->l +=3D CarryBit; i->h--; } - if(i->h =3D=3D 0 && i->l =3D=3D 0){ + if(i->h =3D=3D 0 && i->l =3D=3D 0) SetZero(i); -=20 - /* canceling rule */ - if(x->s !=3D y->s && exact) - i->s =3D 0; /* 1 in round to -=E2=88=9E mode */ - } else while(i->e > 1 && (i->h & HiddenBit) =3D=3D 0) shift(i); }