Number.st
changeset 21536 c71b535bfcbb
parent 21142 d9692dfa814f
child 21634 312cdb36acc9
equal deleted inserted replaced
21535:f1ca40b3f545 21536:c71b535bfcbb
   943      7.2385 rounded:2
   943      7.2385 rounded:2
   944      7.2341 rounded:3
   944      7.2341 rounded:3
   945      7.2345 rounded:3
   945      7.2345 rounded:3
   946      7.2348 rounded:3
   946      7.2348 rounded:3
   947     "
   947     "
   948 !
       
   949 
       
   950 stringForReadout
       
   951     ^ self rounded printString
       
   952 ! !
   948 ! !
   953 
   949 
   954 
   950 
   955 !Number methodsFor:'coercing & converting'!
   951 !Number methodsFor:'coercing & converting'!
   956 
   952 
  1547     "return a string to display the receiver.
  1543     "return a string to display the receiver.
  1548      The output radix is usually 10, but can be changed by setting
  1544      The output radix is usually 10, but can be changed by setting
  1549      DefaultDisplayRadix (see Integer>>displayRadix:)"
  1545      DefaultDisplayRadix (see Integer>>displayRadix:)"
  1550 
  1546 
  1551     "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
  1547     "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
  1552     "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
  1548     "/ old ST80 means: draw-yourself on a GC.
  1553     (aGCOrStream isStream) ifFalse:[
  1549     (aGCOrStream isStream) ifFalse:[
  1554 	^ super displayOn:aGCOrStream
  1550         ^ super displayOn:aGCOrStream
  1555     ].
  1551     ].
  1556 
  1552 
  1557     (DefaultDisplayRadix isNil or:[DefaultDisplayRadix == 10]) ifTrue:[
  1553     (DefaultDisplayRadix isNil or:[DefaultDisplayRadix == 10]) ifTrue:[
  1558 	self printOn:aGCOrStream
  1554         self printOn:aGCOrStream
  1559     ] ifFalse:[
  1555     ] ifFalse:[
  1560 	self printOn:aGCOrStream base:DefaultDisplayRadix showRadix:true.
  1556         self printOn:aGCOrStream base:DefaultDisplayRadix showRadix:true.
  1561     ].
  1557     ].
  1562 
  1558 
  1563     "
  1559     "
  1564      Integer displayRadix:16. 12345
  1560      Integer displayRadix:16. 12345
  1565      Integer displayRadix:2.  12345
  1561      Integer displayRadix:2.  12345
  1566      Integer displayRadix:10. 12345
  1562      Integer displayRadix:10. 12345
  1567     "
  1563     "
       
  1564 
       
  1565     "Modified (comment): / 22-02-2017 / 16:52:16 / cg"
  1568 !
  1566 !
  1569 
  1567 
  1570 printOn:aStream
  1568 printOn:aStream
  1571     "append a printed description of the receiver to aStream"
  1569     "append a printed description of the receiver to aStream"
  1572 
  1570