SmallInteger.st
changeset 6344 f49b43e5b724
parent 6144 35b772717356
child 6400 3746d31f044a
equal deleted inserted replaced
6343:3e35a55af7c5 6344:f49b43e5b724
  2834      to print a number/and for conversion to a LargeInteger.
  2834      to print a number/and for conversion to a LargeInteger.
  2835      Implemented that way, to allow for tiny systems without a Float class
  2835      Implemented that way, to allow for tiny systems without a Float class
  2836      (i.e. without log)."
  2836      (i.e. without log)."
  2837 
  2837 
  2838     self <= 0 ifTrue:[
  2838     self <= 0 ifTrue:[
  2839 	self error:'logarithm of negative integer'
  2839         ^ self class
       
  2840             raise:#domainErrorSignal
       
  2841             receiver:self
       
  2842             selector:#intlog10
       
  2843             arguments:#()
       
  2844             errorString:'logarithm of negative integer'
  2840     ].
  2845     ].
  2841     self < 10 ifTrue:[^ 1].
  2846     self < 10 ifTrue:[^ 1].
  2842     self < 100 ifTrue:[^ 2].
  2847     self < 100 ifTrue:[^ 2].
  2843     self < 1000 ifTrue:[^ 3].
  2848     self < 1000 ifTrue:[^ 3].
  2844     self < 10000 ifTrue:[^ 4].
  2849     self < 10000 ifTrue:[^ 4].
  2846     self < 1000000 ifTrue:[^ 6].
  2851     self < 1000000 ifTrue:[^ 6].
  2847     self < 10000000 ifTrue:[^ 7].
  2852     self < 10000000 ifTrue:[^ 7].
  2848     self < 100000000 ifTrue:[^ 8].
  2853     self < 100000000 ifTrue:[^ 8].
  2849     self < 1000000000 ifTrue:[^ 9].
  2854     self < 1000000000 ifTrue:[^ 9].
  2850     ^ 10
  2855     ^ 10
       
  2856 
       
  2857     "
       
  2858       -1 intlog10
       
  2859     "
  2851 ! !
  2860 ! !
  2852 
  2861 
  2853 !SmallInteger methodsFor:'modulo arithmetic'!
  2862 !SmallInteger methodsFor:'modulo arithmetic'!
  2854 
  2863 
  2855 asUnsigned
  2864 asUnsigned
  3343 ! !
  3352 ! !
  3344 
  3353 
  3345 !SmallInteger class methodsFor:'documentation'!
  3354 !SmallInteger class methodsFor:'documentation'!
  3346 
  3355 
  3347 version
  3356 version
  3348     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.140 2001-11-05 15:32:32 james Exp $'
  3357     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.141 2001-12-19 14:25:28 stefan Exp $'
  3349 ! !
  3358 ! !