Artifacts Associated With Ticket 218195ffff
Ticket change [4ccf8623ad] (rid 126951) by nobody on 2000-10-26 00:54:22:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2371 Bug Version: 8.0.5 SubmitDate: '1999-07-16' LastModified: '2000-05-10' Severity: CRIT Status: Closed Submitter: techsupp ChangedBy: hobbs RelatedBugIDs: 3466 OS: SunOS Machine: Sparc FixedDate: '2000-10-25' ClosedDate: '2000-05-10' Name: andrew pickles Comments: I get the same results with version 8.1 under Solaris. Maybe the problem is in BLT vector set command? ReproducibleScript: if [catch {open $datafile r} fi] { puts stderr "Cannot open $datafile $fi" } else { binary scan [ read $fi 8 ] "II" nwav nspec if { $DEBUG} {puts "nwav=$nwav nspec=$nspec"} vector wave($nwav) flam($nwav) binary scan [read $fi [expr $nwav*4] ] "f*" record wave set $record binary scan [read $fi [expr $nwav*4] ] "f*" record flam set $record if { $DEBUG} { puts "flam: $flam(0) $flam(1) $flam(2) $flam($nwav-1)" } if { $DEBUG} { puts "3520 $flam(3520) $flam(3521) $flam(3522) $flam(3523) $flam(3524)" puts "3525 $flam(3525) $flam(3526) $flam(3527) $flam(3528) $flam(3529)" puts "3530 $flam(3530) $flam(3531) $flam(3532) $flam(3533) $flam(3534)" produces the following DEBUG output (numbers should be (I/100): I I/100. (I+1)/100. (I+2)/100. (I+3)/100. (I+4)/100. 3520 35.2000007629 35.2099990845 35.2200012207 35.2299995422 35.2400016785 3525 34.5 34.5598220825 7.1491230122e-33 7.64207832316e-33 8.13522171322e-33 3530 8.62817702418e-33 9.12132041423e-33 9.6142757252e-33 1.01074191153e-32 1.06003744262e-32 ObservedBehavior: The above script will fail to read the 3525th element from $datafile created with the following C code in binfile.c /* write a test binary file * compile with gcc -lm -lc -o binfile binfile.c */ #include <stdio.h> #include <stdlib.h> #define NCOL 4096 #define NROW 10 float data[NCOL]; void main() { FILE *fo; int nc=NCOL, nr=NROW, i, k; if( (fo = fopen("bin.test", "w+b")) == NULL) { printf("Cannot open bin.test\n"); exit(1); } fwrite(&nc, sizeof(int), 1, fo); fwrite(&nr, sizeof(int), 1, fo); for(i=0; i<NCOL; i++) data[i]=1150+i*5.0; fwrite(data,sizeof(float),NCOL,fo); for(i=0; i<NCOL; i++) data[i]=i/100.0; for(k=1; k<NROW; k++) fwrite(data,sizeof(float),NCOL,fo); fclose(fo); } DesiredBehavior: I'm using tcl/tk & BLT to read and display astronomical spectra from a binary file. It works for some spectra, but fails in strange ways for other data. binary scan fails for numbers in certain ranges. It seems to work for large float numbers, but fail for numbers in the range 0-100, and especially 0-1. I think some counter is overflowing, but don't know where ... C programs read the binary data OK. I can't run this code as it requires more than was provided for the Tcl parts. What exactly is the element that C supposedly gets right, and Tcl fails on? The user should see bug 3466 that relates to the handling of (un)signed data in binary scan, that is a feature and not a bug. -- 05/10/2000 hobbs - foundin initialized to: "final: 8.0.5"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "binary scan sometimes reads data incorrectly"
- type initialized to: "Bug"
Ticket change [dbc70aade0] (rid 108021) by welch on 2000-10-26 08:16:56:
- closedate changed to: "2000-10-26T01:16:56"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [5705d67169] (rid 94419) by dgp on 2001-04-21 02:53:33:
- closedate changed to: "2001-04-20T19:53:33"
- closer changed to: "dgp"
- subsystem changed to: "12. ByteArray Object"