Bug in printShowingDecimalPlaces: ??

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in printShowingDecimalPlaces: ??

Herbert König
Hi Folks,

is there a reason why Float>>printOn: aStream showingDecimalPlaces: placesDesired

always prints '0.0' or was it just forgotten to deal with the desired decimal places in this case? Nicolas?

Cheers

Herbert
 

Reply | Threaded
Open this post in threaded view
|

Re: Bug in printShowingDecimalPlaces: ??

David T. Lewis
On Sat, Nov 03, 2012 at 09:49:04PM +0100, Herbert K?nig wrote:
> Hi Folks,
>
> is there a reason why Float>>printOn: aStream showingDecimalPlaces:
> placesDesired
>
> always prints '0.0' or was it just forgotten to deal with the desired
> decimal places in this case? Nicolas?

Looks ok to me:

  ws := WriteStream on: ''.
  Float pi printOn: ws showingDecimalPlaces: 4.
  ws contents ==> '3.1416'

Where are you seeing the problem?

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Bug in printShowingDecimalPlaces: ??

Herbert König
Am 03.11.2012 22:09, schrieb David T. Lewis:
Looks ok to me:

  ws := WriteStream on: ''.
  Float pi printOn: ws showingDecimalPlaces: 4.
  ws contents ==> '3.1416'

Where are you seeing the problem?

only if you give it the value 0.0


Reply | Threaded
Open this post in threaded view
|

Re: Bug in printShowingDecimalPlaces: ??

Herbert König
Hi,

sorry email is not Twitter so:
only if you give it the value 0.0



this should read:

Sorry for not being clear enough, there is a special case for 0.0 in the method which just does:
aStream nextPutAll: '0.0'
So I wondered what was the intention of this.

Cheers,

Herbert


Reply | Threaded
Open this post in threaded view
|

Re: Bug in printShowingDecimalPlaces: ??

Bert Freudenberg
On 2012-11-03, at 22:17, Herbert König <[hidden email]> wrote:

> Sorry for not being clear enough, there is a special case for 0.0 in the method which just does:
> aStream nextPutAll: '0.0'
> So I wondered what was the intention of this.

Seems like a bug.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Bug in printShowingDecimalPlaces: ??

Nicolas Cellier
2012/11/5 Bert Freudenberg <[hidden email]>:

> On 2012-11-03, at 22:17, Herbert König <[hidden email]> wrote:
>
>> Sorry for not being clear enough, there is a special case for 0.0 in the method which just does:
>> aStream nextPutAll: '0.0'
>> So I wondered what was the intention of this.
>
> Seems like a bug.
>
> - Bert -
>

Agree, the copy-paste kind of bug ;)

Nicolas