MantisBT - Core Inform
View Issue Details
0000547Core InformEquations, units, arithmeticpublic2011-02-09 15:302014-05-07 07:33
Laroquod 
graham 
normalmildalways
closedfixed 
x86Mac OS X10.6
6G60 
6L02 
(serious/mild) Game compiles but misbehaves
0000547: Printing routines for arithmetic values with units depend on scale factors being powers of ten
The attached source gives

- - - -
"500KB plus 700KB" = filesize: 1.1729MB
- - - -

rather than the expected

- - - -
"500KB plus 700KB" = filesize: 1.1719MB
- - - -

The inexactness is due to flooring in the printing routine, e.g.:

- - - -
ran = rem*100/1024; print ran; rem = rem - ran*1024/100;
- - - -

Base ten scale factors are unaffected.
There is a room.
Filesize is a kind of value. 1KB specifies a filesize. 1MB specifies a filesize scaled up by 1024.
When play begins:
showme 500KB plus 700KB.
Taken, by request, from http://www.intfiction.org/forum/viewtopic.php?f=7&t=1864. [^]
No tags attached.
related to 0000548closed graham Printing routines for arithmetic values with units do not change units for large negative values 
Issue History
2011-02-09 15:30EmacsUserNew Issue
2011-02-09 15:30EmacsUserReporterEmacsUser => Laroquod
2011-02-09 15:32EmacsUserIssue cloned0000548
2011-02-09 15:32EmacsUserRelationship addedrelated to 0000548
2011-02-12 18:40jmcgrewStatusnew => acknowledged
2011-02-13 20:23EmacsUserStatusacknowledged => confirmed
2014-04-03 03:13grahamNote Added: 0002610
2014-04-03 03:13grahamStatusconfirmed => resolved
2014-04-03 03:13grahamResolutionopen => fixed
2014-04-03 03:13grahamAssigned To => graham
2014-05-07 07:32jmcgrewFixed in Version => 6L02
2014-05-07 07:33jmcgrewStatusresolved => closed

Notes
(0002610)
graham   
2014-04-03 03:13   
There's no very good solution to this problem in 16-bit integer arithmetic, when the scale factor is close to a power of 10. I've slightly improved the accuracy, but really the solution is to use Glulx or real numbers. For what it's worth, this calculation now prints 1.1711 MB on Z, 1.1718 MB on G.