some fixes: fif did loose too many bits; unnormalized form did not work
This commit is contained in:
		
							parent
							
								
									338fb5fb30
								
							
						
					
					
						commit
						37379d70ba
					
				
					 4 changed files with 12 additions and 4 deletions
				
			
		|  | @ -72,6 +72,10 @@ dbl_over:			trap(EFOVFL); | |||
| 			DBL->_s.p2++;	/* rounding up	*/ | ||||
| 			if (DBL->_s.p2 == 0L) { /* carry out	*/ | ||||
| 			    DBL->_s.p1.fract++; | ||||
| 
 | ||||
| 			    if (f->exp == 0 && (DBL->_s.p1.fract & ~DBL_MASK)) { | ||||
| 					f->exp++; | ||||
| 				} | ||||
| 			    if (DBL->_s.p1.fract & DBL_CARRYOUT) { /* carry out */ | ||||
| 				if (DBL->_s.p1.fract & 01) | ||||
| 				    DBL->_s.p2 = CARRYBIT; | ||||
|  | @ -148,6 +152,9 @@ sgl_over:			trap(EFOVFL); | |||
| #endif | ||||
| 			if (f->m1 & SGL_ROUNDUP) { | ||||
| 				SGL->fract++; | ||||
| 				if (f->exp == 0 && (f->m1 & ~SGL_MASK)) { | ||||
| 					f->exp++; | ||||
| 				} | ||||
| 			/* check normal */ | ||||
| 				if (SGL->fract & SGL_CARRYOUT)	{ | ||||
| 					SGL->fract >>= 1; | ||||
|  |  | |||
|  | @ -62,6 +62,7 @@ zero:			zrf_ext(to); | |||
| 		to->exp >>= SGL_EXPSHIFT; | ||||
| 	if (to->exp > 0) | ||||
| 		leadbit++;	/* will set Lead bit later	*/ | ||||
| 	else to->exp++; | ||||
| 
 | ||||
| 	to->m1 = get4(cpt1); | ||||
| 
 | ||||
|  |  | |||
|  | @ -42,8 +42,8 @@ struct fif4_returns *p; | |||
| 		p->fpart = 0; | ||||
| 		return; | ||||
| 	} | ||||
| 	b64_sft(&e1.m1, 64 - e1.exp); | ||||
| 	b64_sft(&e1.m1, e1.exp - 64);	/* "loose" low order bits */ | ||||
| 	b64_sft(&e1.m1, 63 - e1.exp); | ||||
| 	b64_sft(&e1.m1, e1.exp - 63);	/* "loose" low order bits */ | ||||
| 	compact(&e1,(_double *) &(p->ipart), sizeof(SINGLE)); | ||||
| 	p->fpart = sbf4(p->ipart, y); | ||||
| } | ||||
|  |  | |||
|  | @ -44,8 +44,8 @@ struct fif8_returns *p; | |||
| 		p->fpart.__double[1] = 0; | ||||
| 		return; | ||||
| 	} | ||||
| 	b64_sft(&e1.m1, 64 - e1.exp); | ||||
| 	b64_sft(&e1.m1, e1.exp - 64);	/* "loose" low order bits */ | ||||
| 	b64_sft(&e1.m1, 63 - e1.exp); | ||||
| 	b64_sft(&e1.m1, e1.exp - 63);	/* "loose" low order bits */ | ||||
| 	compact(&e1, &(p->ipart), sizeof(DOUBLE)); | ||||
| 	p->fpart = sbf8(p->ipart, y); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue