495 " |
495 " |
496 1.0 class isAbstract |
496 1.0 class isAbstract |
497 " |
497 " |
498 ! |
498 ! |
499 |
499 |
|
500 isIEEEFormat |
|
501 "return true, if this machine represents floats in IEEE format. |
|
502 Currently, no support is provided for non-ieee machines |
|
503 to convert their floats into this (which is only relevant, |
|
504 if such a machine wants to send floats as binary to some other |
|
505 machine). |
|
506 Machines with non-IEEE format are VAXed and IBM370-type systems |
|
507 (among others). Today, most systems use IEEE format floats." |
|
508 |
|
509 %{ |
|
510 #ifdef __s390__ |
|
511 RETURN(false); |
|
512 #endif |
|
513 %}. |
|
514 |
|
515 ^ true "/ this may be a lie |
|
516 ! |
|
517 |
500 numBitsInExponent |
518 numBitsInExponent |
501 "return the number of bits in the exponent" |
519 "return the number of bits in the exponent" |
502 |
520 |
503 ^ self subclassResponsibility |
521 ^ self subclassResponsibility |
504 ! |
522 ! |
661 Time millisecondsToRun:[ |
679 Time millisecondsToRun:[ |
662 1000000 timesRepeat:[ |
680 1000000 timesRepeat:[ |
663 (2.0 timesTwoPower: 150) |
681 (2.0 timesTwoPower: 150) |
664 ] |
682 ] |
665 ] |
683 ] |
|
684 " |
|
685 ! ! |
|
686 |
|
687 !LimitedPrecisionReal methodsFor:'bytes access'! |
|
688 |
|
689 digitBytes |
|
690 "answer the float's digit bytes im IEEE format. |
|
691 Use the native machine byte ordering." |
|
692 |
|
693 |sz "{ Class:SmallInteger }" |
|
694 bytes| |
|
695 |
|
696 sz := self basicSize. |
|
697 bytes := ByteArray new:sz. |
|
698 1 to:sz do:[:i| |
|
699 bytes at:i put:(self basicAt:i). |
|
700 ]. |
|
701 ^ bytes |
|
702 |
|
703 " |
|
704 Float pi digitBytes |
|
705 ShortFloat pi digitBytes |
|
706 " |
|
707 ! |
|
708 |
|
709 digitBytesMSB:msb |
|
710 "answer the float's digit bytes im IEEE format. |
|
711 If msb == true, use MSB byte order, otherwise LSB byte order." |
|
712 |
|
713 |sz "{ Class:SmallInteger }" |
|
714 bytes| |
|
715 |
|
716 self class isIEEEFormat ifFalse:[self error:'unsupported operation']. |
|
717 |
|
718 sz := self basicSize. |
|
719 bytes := ByteArray new:sz. |
|
720 |
|
721 (UninterpretedBytes isBigEndian == msb) ifTrue:[ |
|
722 1 to:sz do:[:i| |
|
723 bytes at:i put:(self basicAt:i). |
|
724 ]. |
|
725 ] ifFalse:[ |
|
726 "reverse the bytes" |
|
727 1 to:sz do:[:i| |
|
728 bytes at:sz-i+1 put:(self basicAt:i). |
|
729 ]. |
|
730 ]. |
|
731 ^ bytes |
|
732 |
|
733 " |
|
734 Float pi digitBytesMSB:false |
|
735 Float pi digitBytesMSB:true |
|
736 ShortFloat pi digitBytesMSB:false |
|
737 ShortFloat pi digitBytesMSB:true |
666 " |
738 " |
667 ! ! |
739 ! ! |
668 |
740 |
669 !LimitedPrecisionReal methodsFor:'coercing & converting'! |
741 !LimitedPrecisionReal methodsFor:'coercing & converting'! |
670 |
742 |
1278 ! ! |
1350 ! ! |
1279 |
1351 |
1280 !LimitedPrecisionReal class methodsFor:'documentation'! |
1352 !LimitedPrecisionReal class methodsFor:'documentation'! |
1281 |
1353 |
1282 version |
1354 version |
1283 ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.80 2014-12-11 14:10:25 cg Exp $' |
1355 ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.81 2014-12-16 12:20:28 stefan Exp $' |
1284 ! |
1356 ! |
1285 |
1357 |
1286 version_CVS |
1358 version_CVS |
1287 ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.80 2014-12-11 14:10:25 cg Exp $' |
1359 ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.81 2014-12-16 12:20:28 stefan Exp $' |
1288 ! ! |
1360 ! ! |
1289 |
1361 |
1290 |
1362 |
1291 LimitedPrecisionReal initialize! |
1363 LimitedPrecisionReal initialize! |