bugGNU Octave - Bugs: bug #44272, dlmwrite makes inaccurate floating...

 
 

bug #44272: dlmwrite makes inaccurate floating point conversions

Submitter:  None
Submitted:  Mon 16 Feb 2015 12:01:46 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Lars Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 16 Feb 2015 03:30:48 PM UTC, comment #1: 

This is a consequence of the limited precision that all IEEE-754 floating point numbers have.  In Octave, for example, try


format long
x = 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1
  x =  1.000000000000000
x - 1
  ans =   -1.11022302462516e-16


On the other hand,


x = dlmread ("test.csv")
  x =  66.5940000000000
x - 66.594
  ans = 0


So the limited precision precision works both ways with dlmwrite/dlmread.



Rik <rik5>
Group administrator
Mon 16 Feb 2015 12:01:46 PM UTC, original submission:  

Hello,


dlmwrite("test.csv", 66.594)


results in "66.59399999999999"

I suspect their is an inaccuracy in floating point conversion. There are several specific floating point numbers with the same issue.

Operating system:
ubuntu 14.04, 64-bit

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #33101:  test.csv added by None (18B - application/x-csv)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-16 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed
    2015-02-16 None Attached File- Added test.csv, #33101

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code