Index: ChangeLog =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/ChangeLog,v retrieving revision 1.384 diff -u -u -r1.384 ChangeLog --- ChangeLog 17 Jul 2004 21:52:31 -0000 1.384 +++ ChangeLog 20 Jul 2004 20:41:12 -0000 @@ -1,3 +1,8 @@ +2004-07-20 Joerg Wunsch + + * libm/fplib/strtod.S: fix parsing of a partial + exponent, fix *endp return value (savanna bug #2924) + 2004-07-17 Joerg Wunsch * libm/fplib/pow.S: localize labels, fix pow(N, 0). Index: libm/fplib/strtod.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/strtod.S,v retrieving revision 1.3 diff -u -u -r1.3 strtod.S --- libm/fplib/strtod.S 30 Sep 2003 23:05:20 -0000 1.3 +++ libm/fplib/strtod.S 20 Jul 2004 20:41:13 -0000 @@ -111,7 +111,7 @@ RCALL .L_scanDigits ; if T set now there must be a fraction failure : rA still 0! - BRTS 1f + BRTS 99f RCALL _U(__floatunssisf) BST rFlags,bitNegative @@ -132,10 +132,6 @@ RCALL .L_scanSign RCALL .L_scanExponent - BRTC 2f ; found something invalid exponent -1: - RJMP 99f -2: TST rA3 BREQ 3f SBRC rFlags,bitNegative ; set sign @@ -226,8 +222,8 @@ CPI ZL,0 CPC ZL,ZH BREQ 1f - ST Z+,rEndptrH - ST Z,rEndptrL + ST Z+,rEndptrL + ST Z,rEndptrH 1: LDI ZL,18-6 ; number of all 'pushed' registers - not pushed ones IN YL,_SFR_IO_ADDR(SPL) @@ -248,7 +244,7 @@ .L_underflow: RCALL _U(__fp_zero) #ifdef __ERRNO__ -1f: +1: extern errno LDI rB3,ERANGE STS errno,rB3 @@ -270,13 +266,12 @@ .L_scanExponent: - SET - RCALL _U(__fp_zero) ; initialize rA3::rA0 with 0 -1: ; scan until (possibly) decimal point found + CLR rA2 ; initialize rA3::rA2 with 0 + CLR rA3 +1: CPI rCh,'0' BRLT 10f BRNE 2f ; look for leading zeros - CLT SBRS rFlags,bitDigit RJMP 4f ; no valid digits yet -> skip zero 2: @@ -286,14 +281,13 @@ TST rA3 BRNE 3f ; overflow allready ; mul rA3::rA2 by 10 and add rCh - CLT ; digit validates fraction XCALL __mulhi_const_10 ; r25:r24 *= 10 ANDI rCh,0x0F ADD rA2,rCh adc rA3,__zero_reg__ 3: MOV rEndptrH,YH - MOV rEndptrL,YL ; valid float up to now + MOV rEndptrL,YL ; valid exponent up to now 4: LD rCh,Y+ RJMP 1b