summaryrefslogtreecommitdiff
path: root/Python/dtoa.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-01-13 19:02:37 +0000
committerMark Dickinson <dickinsm@gmail.com>2010-01-13 19:02:37 +0000
commit5818e0125395b88b5e3c69dacdb50d5562628cd2 (patch)
treed9cf611a57838ca5c42d9c0b76632c903d78a27d /Python/dtoa.c
parentb26d56ac18df454e373e01a405a622d412d5bd53 (diff)
downloadcpython-git-5818e0125395b88b5e3c69dacdb50d5562628cd2.tar.gz
Clarify that sulp expects a nonnegative input, but that +0.0 is fine.
Diffstat (limited to 'Python/dtoa.c')
-rw-r--r--Python/dtoa.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 504ad1f8cf..e953f09c01 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -1130,11 +1130,11 @@ quorem(Bigint *b, Bigint *S)
return q;
}
-/* version of ulp(x) that takes bc.scale into account.
+/* sulp(x) is a version of ulp(x) that takes bc.scale into account.
- Assuming that x is finite and nonzero, and x / 2^bc.scale is exactly
- representable as a double, sulp(x) is equivalent to 2^bc.scale * ulp(x /
- 2^bc.scale). */
+ Assuming that x is finite and nonnegative (positive zero is fine
+ here) and x / 2^bc.scale is exactly representable as a double,
+ sulp(x) is equivalent to 2^bc.scale * ulp(x / 2^bc.scale). */
static double
sulp(U *x, BCinfo *bc)
@@ -1147,8 +1147,10 @@ sulp(U *x, BCinfo *bc)
word1(&u) = 0;
return u.d;
}
- else
+ else {
+ assert(word0(x) || word1(x)); /* x != 0.0 */
return ulp(x);
+ }
}
/* The bigcomp function handles some hard cases for strtod, for inputs