#175 closed defect (done)
Format of doubles and floats leads to inconsistency
Reported by: | gkronber | Owned by: | gkronber |
---|---|---|---|
Priority: | high | Milestone: | HeuristicLab 3.3.0 |
Component: | Core | Version: | 3.0 |
Keywords: | Cc: |
Description
This ticket overrides ticket #174. While searching for the cause of #174 it was discovered that whenever we transform a floating point number into a string (for instance when serializing or when showing the value in a GUI component) it is likely that the value which is read back is different from the original value.
The underlying cause for this is that the resulting string contains only a part of the digits of the original floating point representation and when reading the string back in it can be altered lightly to create a valid floating point number (base 10 numbers can be periodic in base 2).
This defect was already predicted by swinkler because he solved the same problem in HL2.
Change History (6)
comment:1 Changed 17 years ago by gkronber
- Owner changed from swagner to gkronber
- Status changed from new to assigned
comment:2 Changed 17 years ago by gkronber
- created a branch (r336:r337) and worked on the ticket (changesets r338 r339 r340 r341 r342 r343)
- merged changes of the branch into the trunk with r344
- merged changes of the branch and fixed floating point serialization in the stable versions of plugins HeuristicLab.Functions and HeuristicLab.DataAnalysis in the HL3 stable branch
comment:3 Changed 17 years ago by gkronber
- Resolution set to fixed
- Status changed from assigned to closed
comment:4 Changed 16 years ago by swagner
- Milestone changed from 3.0 to Iteration 0
Milestone 3.0 deleted
comment:5 Changed 14 years ago by swagner
- Milestone changed from Iteration 0 to Current
Milestone Iteration 0 deleted
comment:11 Changed 14 years ago by swagner
- Milestone changed from Current to HeuristicLab 3.3.0
Milestone Current deleted
Luckily .NET provides the format string r for "round-trip" that adds two additional digits and guarantees that "guarantees that a numeric value converted to a string will be parsed back into the same numeric value." (http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx)