ArithmeticValue.st
branchjv
changeset 17795 569eec7576f1
parent 17780 b6e42c92eba0
child 17797 71451ae83564
equal deleted inserted replaced
17794:da075fbea903 17795:569eec7576f1
   514      1.0 asFixedPoint:2
   514      1.0 asFixedPoint:2
   515      3.14159 asFixedPoint:2
   515      3.14159 asFixedPoint:2
   516      3.14159 asFixedPoint:3
   516      3.14159 asFixedPoint:3
   517      (3.14159 asFixedPoint:2) asFixedPoint:5
   517      (3.14159 asFixedPoint:2) asFixedPoint:5
   518     "
   518     "
       
   519 !
       
   520 
       
   521 asFixedPointRoundedToScale
       
   522     "return the receiver as fixedPoint number, rounded to its scale."
       
   523 
       
   524     ^ self asFixedPoint roundedToScale
       
   525 
       
   526     "
       
   527      0.3 asFixedPoint
       
   528      0.5 asFixedPoint
       
   529      (2/3) asFloat asFixedPoint
       
   530      (1/8) asFloat asFixedPoint
       
   531      3.14159 asFixedPoint
       
   532 
       
   533      0.3 asFixedPointRoundedToScale
       
   534      0.5 asFixedPointRoundedToScale
       
   535      (2/3) asFloat asFixedPointRoundedToScale
       
   536      (1/8) asFloat asFixedPointRoundedToScale
       
   537      3.14159 asFixedPointRoundedToScale
       
   538     "
       
   539 
       
   540     "Created: / 02-08-2010 / 13:32:16 / cg"
       
   541 !
       
   542 
       
   543 asFixedPointRoundedToScale:scale
       
   544     "return the receiver as fixedPoint number with the given
       
   545      number of post-decimal-digits, rounded to its scale"
       
   546 
       
   547     ^ (self asFixedPoint:scale) roundedToScale
       
   548 
       
   549     "Created: / 02-08-2010 / 13:33:11 / cg"
   519 !
   550 !
   520 
   551 
   521 asFloat
   552 asFloat
   522     "return a float with same value"
   553     "return a float with same value"
   523 
   554 
  1281 ! !
  1312 ! !
  1282 
  1313 
  1283 !ArithmeticValue class methodsFor:'documentation'!
  1314 !ArithmeticValue class methodsFor:'documentation'!
  1284 
  1315 
  1285 version
  1316 version
  1286     ^ '$Id: ArithmeticValue.st 10544 2010-07-12 16:20:36Z vranyj1 $'
  1317     ^ '$Id: ArithmeticValue.st 10564 2010-08-10 08:55:15Z vranyj1 $'
  1287 !
  1318 !
  1288 
  1319 
  1289 version_CVS
  1320 version_CVS
  1290     ^ 'Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.85 2010/03/06 10:06:53 cg Exp '
  1321     ^ 'Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.86 2010/08/02 11:33:27 cg Exp '
  1291 !
  1322 !
  1292 
  1323 
  1293 version_SVN
  1324 version_SVN
  1294     ^ '$Id: ArithmeticValue.st 10544 2010-07-12 16:20:36Z vranyj1 $'
  1325     ^ '$Id: ArithmeticValue.st 10564 2010-08-10 08:55:15Z vranyj1 $'
  1295 ! !
  1326 ! !
  1296 
  1327 
  1297 ArithmeticValue initialize!
  1328 ArithmeticValue initialize!
  1298 
  1329 
  1299 
  1330 
  1300 
  1331 
       
  1332