Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000150 [Squeak] Any minor always 09-16-04 23:44 12-04-04 16:53
Reporter KenCausey View Status public  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version Product Version
  Product Build
Summary 0000150: Number>>printShowingDecimalPlaces: output incorrect
Description 111.2 printShowingDecimalPlaces: 2 -> '111.20'

111111111111111 printShowingDecimalPlaces: 2 -> '1.11'
123e20 printShowingDecimalPlaces: 2 -> '1.23'
10 printShowingDecimalPlaces: 20 -> Error: subscript is out of bounds: 21

Pavel
Steps To Reproduce
Additional Information I transferred this from BFAV2 ID 24236 from a report by Pavel Krivanek <squeak1@continentalbrno.cz>
Attached Files  PrintShowingDecimalPlacesTest-dtl.1.cs [^] (943 bytes) 11-26-04 18:26
 PrintShowingDecimalPlacesFix-dtl.1.cs [^] (1,414 bytes) 11-26-04 18:26

- Relationships

SYSTEM WARNING: Creating default object from empty value

related to 0002187closed  Utilites class >> #floatPrecisionForDecimalPlaces: doesn't work for arguments bigger than 9 
related to 0001837closed  #printShowingDecimalPlaces: doesn't work for moderate or big numbers 

- Notes
(0000761 - 682 - 730 - 730 - 730 - 730 - 730)
lewis
11-26-04 18:28

I have attached a unit test that shows the problem, and a fix to resolve it.

The fix adds a range check for Utilities>>floatPrecisionForDecimalPlaces: and a default implementation that works when the parameter is out of range.

Implementation note:
I used #caseOf:otherwise: to implement this. The result is about 25% slower than the original unchecked method. I got very slightly faster performance by writing it with a bunch of #ifTrue: lines, but I think the caseOf approach is slightly less ugly.

All other implementations that I tried (including #at:ifAbsent:, and #on:do) were significantly slower, so I settled on #caseOf:otherwise: for clarity and reasonable speed.
 
(0000762 - 15 - 15 - 15 - 15 - 15 - 15)
MarcusDenker
11-26-04 18:38

fix is attached
 
(0000840 - 6 - 6 - 6 - 6 - 6 - 6)
MarcusDenker
12-04-04 16:53

in 3.9
 

- Issue History
Date Modified Username Field Change
09-16-04 23:44 KenCausey New Issue
11-26-04 18:25 lewis Issue Monitored: lewis
11-26-04 18:26 lewis File Added: PrintShowingDecimalPlacesTest-dtl.1.cs
11-26-04 18:26 lewis File Added: PrintShowingDecimalPlacesFix-dtl.1.cs
11-26-04 18:28 lewis Note Added: 0000761
11-26-04 18:38 MarcusDenker Resolution open => fixed
11-26-04 18:38 MarcusDenker Description Updated
11-26-04 18:38 MarcusDenker Additional Information Updated
11-26-04 18:38 MarcusDenker Status new => resolved
11-26-04 18:38 MarcusDenker Assigned To  => MarcusDenker
11-26-04 18:38 MarcusDenker Note Added: 0000762
11-26-04 18:38 MarcusDenker Assigned To MarcusDenker =>
12-04-04 16:53 MarcusDenker Status resolved => closed
12-04-04 16:53 MarcusDenker Note Added: 0000840
11-30-05 08:42 pmm Issue Monitored: pmm
12-19-05 15:51 ducasse Relationship added related to 0002187
12-19-05 15:52 ducasse Relationship added related to 0001837


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
69 total queries executed.
41 unique queries executed.
Powered by Mantis Bugtracker