adf and sbf did not work with 0.0
This commit is contained in:
parent
44ce140103
commit
24c59f9f68
|
@ -18,6 +18,13 @@ _float s1,s2;
|
|||
EXTEND e1,e2;
|
||||
int swap = 0;
|
||||
|
||||
if (s1 == (_float) 0) {
|
||||
s1 = s2;
|
||||
return s1;
|
||||
}
|
||||
if (s2 == (_float) 0) {
|
||||
return s1;
|
||||
}
|
||||
extend((_double *)&s1,&e1,sizeof(SINGLE));
|
||||
extend((_double *)&s2,&e2,sizeof(SINGLE));
|
||||
/* if signs differ do subtraction */
|
||||
|
|
|
@ -17,6 +17,15 @@ _double s1,s2;
|
|||
{
|
||||
EXTEND e1,e2;
|
||||
short swap;
|
||||
|
||||
if (s1.__double[0] == 0 && s1.__double[1] == 0) {
|
||||
s1 = s2;
|
||||
return s1;
|
||||
}
|
||||
if (s2.__double[0] == 0 && s2.__double[1] == 0) {
|
||||
return s1;
|
||||
}
|
||||
|
||||
extend(&s1,&e1,sizeof(_double));
|
||||
extend(&s2,&e2,sizeof(_double));
|
||||
#ifdef PRT_EXT
|
||||
|
|
|
@ -22,25 +22,27 @@ _double d1,d2;
|
|||
*/
|
||||
long l1,l2;
|
||||
int sign1,sign2;
|
||||
int rv;
|
||||
|
||||
l1 = get4((char *)&d1);
|
||||
l2 = get4((char *)&d2);
|
||||
sign1 = SIGN(l1);
|
||||
sign2 = SIGN(l2);
|
||||
if (sign1 != sign2)
|
||||
if (sign1 != sign2) {
|
||||
return ((sign1 > 0) ? -1 : 1);
|
||||
}
|
||||
if (l1 != l2) { /* we can decide here */
|
||||
return sign1 * (l1 < l2 ? 1 : -1) ;
|
||||
rv = l1 < l2 ? 1 : -1;
|
||||
}
|
||||
else { /* decide in 2nd half */
|
||||
l1 = get4(((char *)&d1 + 4));
|
||||
l2 = get4(((char *)&d2 + 4));
|
||||
if (l1 == l2)
|
||||
return(0);
|
||||
if (l1 < 0)
|
||||
return l2 < 0 ? l2 > l1 : -1;
|
||||
if (l2 < 0)
|
||||
return 1;
|
||||
return l2 > l1 ? 1 : -1;
|
||||
if (l1 >= 0)
|
||||
rv = l1 < l2 || l2 < 0 ? 1 : -1;
|
||||
else if (l2 >= 0) rv = -1;
|
||||
else rv = l1 < l2 ? 1 : -1;
|
||||
}
|
||||
return sign1 * rv;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ _float s1,s2;
|
|||
/* s2 = -s2 */
|
||||
char unsigned *p;
|
||||
|
||||
if (s2 == (_float) 0) {
|
||||
return s1;
|
||||
}
|
||||
p = (char unsigned *) &s2;
|
||||
*p ^= 0x80; /* change sign of s2 */
|
||||
s1 = adf4(s2,s1);
|
||||
|
|
|
@ -25,6 +25,9 @@ _double s1,s2;
|
|||
#ifdef PRT_EXT
|
||||
fprintf(stderr,"SBF8 ():\n");
|
||||
#endif
|
||||
if (s2.__double[0] == 0 && s2.__double[1] == 0) {
|
||||
return s1;
|
||||
}
|
||||
p = (char unsigned *) &s2;
|
||||
*p ^= 0x80; /* change sign of s2 */
|
||||
s1 = adf8(s2,s1); /* add and return result */
|
||||
|
|
Loading…
Reference in a new issue