https://github.com/pharo-project/pharo/issues/5542

On Sun, Dec 22, 2019 at 5:12 PM Serge Stinckwich <[email protected]>
wrote:

> Hi all,
> I'm having a look how floats are printed.
> Why we check two times if a Float is infinite ?
> A first time in:
>
> Float>>printOn: stream base: base
> ...
> self isInfinite
> ifTrue: [
> stream nextPutAll: 'Float infinity'.
> ^ self sign = -1 ifTrue: [ stream nextPutAll: ' negated' ] ].
> ...
>
> and a second time in:
>
> Float>>absPrintExactlyOn: aStream base: base
> ...
> self isInfinite ifTrue: [
> aStream nextPutAll: 'Float infinity'.
> ^ self].
> ...
>
> the same in Float>>absPrintInexactlyOn: aStream base: base
> ...
> self isInfinite ifTrue: [aStream nextPutAll: 'Float infinity'. ^ self].
> ...
>
> Apparently the last two methods are never called when number is infinite.
>
> I remove the second checks and apparently nothing breaks (all number tests
> are still green).
>
> Regards,
> --
> Serge Stinckwic
> h
>
> Int. Research Unit
>  on Modelling/Simulation of Complex Systems (UMMISCO)
> Sorbonne University
>  (SU)
> French National Research Institute for Sustainable Development (IRD)
> U
> niversity of Yaoundé I, Cameroon
> "Programs must be written for people to read, and only incidentally for
> machines to execute."
> https://twitter.com/SergeStinckwich
>


-- 
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for
machines to execute."
https://twitter.com/SergeStinckwich

Reply via email to