summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-14 03:17:50 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-14 03:17:50 +0000
commit1264f7bf3d2f2cfafce50daa4e8c118fbb4a71cf (patch)
tree00c390ea402d550fae57dd0c95eed01f3248b076 /util.c
parentafad07e38ad6b613246b1e4730b9157094ad457e (diff)
downloadruby-1264f7bf3d2f2cfafce50daa4e8c118fbb4a71cf.tar.gz
ruby-1264f7bf3d2f2cfafce50daa4e8c118fbb4a71cf.tar.xz
ruby-1264f7bf3d2f2cfafce50daa4e8c118fbb4a71cf.zip
* util.c (ruby_strtod): strtod("0", &end); => end should point '\0'.
[ruby-dev:23498] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/util.c b/util.c
index d89e08de5..4ef34063b 100644
--- a/util.c
+++ b/util.c
@@ -772,8 +772,8 @@ ruby_strtod(string, endPtr)
}
/*
- * Count the number of digits in the mantissa (including the decimal
- * point), and also locate the decimal point.
+ * Count the number of digits in the mantissa
+ * and also locate the decimal point.
*/
for ( ; c = *p; p += 1) {
@@ -805,16 +805,14 @@ ruby_strtod(string, endPtr)
*/
pExp = p;
- p = pMant; /* valid if mantSize > 0 */
+ if (mantSize) {
+ p = pMant;
+ }
if (mantSize > 18) {
fracExp += (mantSize - 18);
mantSize = 18;
}
- if (mantSize == 0) {
- fraction = 0.0;
- p = string;
- }
- else {
+ {
int frac1, frac2;
frac1 = 0;
for ( ; mantSize > 9; mantSize -= 1) {