| Ticket UUID: | 1851567 | ||
| Title: | expr returns incorrect results on M68K architecture | ||
| Type: | Bug | Created on: | 2007-12-15 22:54:10 |
| Submitter: | teopetuk | Assigned to: | msofer |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 8 | Last modified: | 2007-12-20 21:39:17 |
| Status: | Closed | Closed by: | msofer |
| Resolution: | Invalid | Closed on: | 2007-12-20 14:39:17 |
| Version: | obsolete: 8.5b3 | ||
| Description: | ||||
Hi! expr in current HEAD returns the following on Motorola M68K architecture: % expr 0.1 0.000 % expr 1e-10 0e-12 The bug is triggered only when the final result is shown, and only when the resulting number is less than one in absolute value. Then expr replaces mantissa by zero. % expr (1.0/10) 0.000 % expr (1.0/10)*10 1.0 Also, expr.test fails with the following: expr.test Test file error: unable to alloc 3988184000 bytes (I don't know if it's the same bug or another one). 8.4.16 works fine and passes all the tests. | ||||
| User Comments: | ||||
dgp added on 2007-12-18 11:09:55:
Logged In: YES user_id=80530 Originator: NO Is this another symptom of 1851832? [email protected] added on 2007-12-18 15:00:38:
Logged In: NO Even if it's a symptom of 1851832 the current HEAD (with a patch from 1851832) doesn't cure it. msofer added on 2007-12-18 18:25:38:
Logged In: YES user_id=148712 Originator: NO I think Tcl_Objs are properly aligned, my guess is that the problem is in TclDoubleDigits(). I will not be able to look at this in the next few days. Please report more platform details - is this linux? What libc? teopetuk added on 2007-12-18 18:38:14:
Logged In: YES user_id=410366 Originator: YES Yes, it's Debian Linux, glibc version is 2.5. dgp added on 2007-12-18 23:29:39:
Logged In: YES user_id=80530 Originator: NO Wonder if this is an issue analogous to what we faced with the Nokia 770? Yet another wacky endian variation? http://wiki.tcl.tk/15408 teopetuk added on 2007-12-20 20:59:56:
Logged In: YES
user_id=410366
Originator: YES
It's a bug in frexp() function. The following program:
#include <math.h>
#include <stdio.h>
main() {
double v;
int e;
v = frexp(1.1, &e);
printf("%g, %d\n", v, e);
v = frexp(0.1, &e);
printf("%g, %d\n", v, e);
}
prints out
0.55, 1
0.05, -2147483647
which is obviously wrong. The result should be
0.55, 1
0.8, -3
So, there's no bug in Tcl itself.
| ||||
