[issue1725] -1e-1000 converted incorrectly

Mark Dickinson report at bugs.python.org
Thu Jan 3 04:05:28 CET 2008


Mark Dickinson added the comment:

Tracing the calls through ast_for_factor -> ast_for_atom -> parsenumber -> PyOS_ascii_atof -> 
PyOS_ascii_strtod -> strtod, it looks as though the cause is simply that strtod behaves differently on 
the two platforms.  I get that the following code:

#include <stdio.h>
#include <stdlib.h>

int main() {
  char *fail_pos;
  double x;
  
  x = strtod("-1e-1000", &fail_pos);
  printf("Result: %f\n", x);

  return 0;
}

produces 0.000000 on Linux (SuSE 10.2) and -0.000000 on OS X 10.4.11.

----------
nosy: +marketdickinson

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1725>
__________________________________


More information about the Python-bugs-list mailing list