mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
libfmt: use fmtstrtod, not system strtod
http://codereview.appspot.com/96185
This commit is contained in:
parent
8e5ae416a7
commit
d17b040302
1 changed files with 4 additions and 4 deletions
|
@ -243,7 +243,7 @@ xdtoa(double f, char *s, int *exp, int *neg, int *ns)
|
||||||
* adjust conversion until strtod(s) == f exactly.
|
* adjust conversion until strtod(s) == f exactly.
|
||||||
*/
|
*/
|
||||||
for(i=0; i<10; i++) {
|
for(i=0; i<10; i++) {
|
||||||
g = strtod(s, nil);
|
g = fmtstrtod(s, nil);
|
||||||
if(f > g) {
|
if(f > g) {
|
||||||
if(xadd1(s, NSIGNIF)) {
|
if(xadd1(s, NSIGNIF)) {
|
||||||
/* gained a digit */
|
/* gained a digit */
|
||||||
|
@ -274,7 +274,7 @@ xdtoa(double f, char *s, int *exp, int *neg, int *ns)
|
||||||
c = s[i];
|
c = s[i];
|
||||||
if(c != '9') {
|
if(c != '9') {
|
||||||
s[i] = '9';
|
s[i] = '9';
|
||||||
g = strtod(s, nil);
|
g = fmtstrtod(s, nil);
|
||||||
if(g != f) {
|
if(g != f) {
|
||||||
s[i] = c;
|
s[i] = c;
|
||||||
break;
|
break;
|
||||||
|
@ -292,7 +292,7 @@ xdtoa(double f, char *s, int *exp, int *neg, int *ns)
|
||||||
ee--;
|
ee--;
|
||||||
xfmtexp(tmp+NSIGNIF, ee, 0);
|
xfmtexp(tmp+NSIGNIF, ee, 0);
|
||||||
}
|
}
|
||||||
g = strtod(tmp, nil);
|
g = fmtstrtod(tmp, nil);
|
||||||
if(g == f) {
|
if(g == f) {
|
||||||
strcpy(s, tmp);
|
strcpy(s, tmp);
|
||||||
e = ee;
|
e = ee;
|
||||||
|
@ -306,7 +306,7 @@ xdtoa(double f, char *s, int *exp, int *neg, int *ns)
|
||||||
c = s[i];
|
c = s[i];
|
||||||
if(c != '0') {
|
if(c != '0') {
|
||||||
s[i] = '0';
|
s[i] = '0';
|
||||||
g = strtod(s, nil);
|
g = fmtstrtod(s, nil);
|
||||||
if(g != f) {
|
if(g != f) {
|
||||||
s[i] = c;
|
s[i] = c;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue