LimitedPrecisionReal.st
changeset 17663 341b07be4e1b
parent 17655 b8f27b84fda3
child 18120 e3a375d5f6a8
child 18127 0fca3e1acc6e
equal deleted inserted replaced
17662:0fd098ccf3ff 17663:341b07be4e1b
   401 !
   401 !
   402 
   402 
   403 emin
   403 emin
   404     "return the smallest exponent"
   404     "return the smallest exponent"
   405 
   405 
   406     self subclassResponsibility
   406     ^ self subclassResponsibility
   407 
   407 
   408     "Created: / 7.9.2001 / 14:05:35 / cg"
   408     "
       
   409      Float emin  
       
   410      ShortFloat emin  
       
   411     "
   409 !
   412 !
   410 
   413 
   411 epsilon
   414 epsilon
   412     "return the maximum relative spacing"
   415     "return the maximum relative spacing"
   413 
   416 
   419       LongFloat epsilon   
   422       LongFloat epsilon   
   420     "
   423     "
   421 !
   424 !
   422 
   425 
   423 fmax
   426 fmax
   424     "return the largest value allowed"
   427     "The largest value allowed by instances of this class."
   425 
   428 
   426     self subclassResponsibility
   429     |radix|
   427 
   430 
   428     "Created: / 7.9.2001 / 14:06:56 / cg"
   431     radix := self radix.
       
   432     ^(self fromNumber: 1) -
       
   433             ((self fromNumber: radix) timesTwoPower: self precision negated - 1) * radix
       
   434             * ((self fromNumber: radix) timesTwoPower: self emax - 1)
       
   435 
       
   436     "
       
   437      Float fmax    
       
   438      ShortFloat fmax 
       
   439      LongFloat fmax  
       
   440     "
   429 !
   441 !
   430 
   442 
   431 fmin
   443 fmin
   432     "return the minimum value allowed"
   444     "The smallest value allowed by instances of this class."
   433 
   445 
   434     self subclassResponsibility
   446     ^ self subclassResponsibility
   435 
       
   436     "Created: / 7.9.2001 / 14:07:06 / cg"
       
   437 !
   447 !
   438 
   448 
   439 infinity
   449 infinity
   440     "return a float representing infinity"
   450     "return a float representing infinity"
   441 
   451 
  1076     ^ aNumber lessFromFloat:self asFloat
  1086     ^ aNumber lessFromFloat:self asFloat
  1077 
  1087 
  1078     "Modified: 17.4.1996 / 13:34:50 / cg"
  1088     "Modified: 17.4.1996 / 13:34:50 / cg"
  1079 ! !
  1089 ! !
  1080 
  1090 
  1081 
       
  1082 !LimitedPrecisionReal methodsFor:'copying'!
  1091 !LimitedPrecisionReal methodsFor:'copying'!
  1083 
  1092 
  1084 deepCopy
  1093 deepCopy
  1085     "return a deep copy of myself
  1094     "return a deep copy of myself
  1086      - because storing into floats is not recommended/allowed, its ok to return the receiver"
  1095      - because storing into floats is not recommended/allowed, its ok to return the receiver"
  1370 ! !
  1379 ! !
  1371 
  1380 
  1372 !LimitedPrecisionReal class methodsFor:'documentation'!
  1381 !LimitedPrecisionReal class methodsFor:'documentation'!
  1373 
  1382 
  1374 version
  1383 version
  1375     ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.83 2015-03-25 17:17:19 cg Exp $'
  1384     ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.84 2015-03-25 17:56:15 cg Exp $'
  1376 !
  1385 !
  1377 
  1386 
  1378 version_CVS
  1387 version_CVS
  1379     ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.83 2015-03-25 17:17:19 cg Exp $'
  1388     ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.84 2015-03-25 17:56:15 cg Exp $'
  1380 ! !
  1389 ! !
  1381 
  1390 
  1382 
  1391 
  1383 LimitedPrecisionReal initialize!
  1392 LimitedPrecisionReal initialize!