equal
deleted
inserted
replaced
709 biasedExponent = 0 ifTrue: [ ^ mantissa]. |
709 biasedExponent = 0 ifTrue: [ ^ mantissa]. |
710 |
710 |
711 mantissa == 0 ifTrue:[ |
711 mantissa == 0 ifTrue:[ |
712 "/ INF or NAN |
712 "/ INF or NAN |
713 ^ self class |
713 ^ self class |
714 raise:#conversionErrorSignal |
714 raise:#domainErrorSignal |
715 receiver:self |
715 receiver:self |
716 selector:#asTrueFraction |
716 selector:#asTrueFraction |
717 arguments:#() |
717 arguments:#() |
718 errorString:'Cannot represent non-finite float as fraction'. |
718 errorString:'Cannot represent non-finite float as fraction'. |
719 "/ ^ self asMetaNumber. |
719 "/ ^ self asMetaNumber. |
746 |
746 |
747 LargeFloat NaN asTrueFraction -> error |
747 LargeFloat NaN asTrueFraction -> error |
748 LargeFloat infinity asTrueFraction -> error |
748 LargeFloat infinity asTrueFraction -> error |
749 LargeFloat negativeInfinity asTrueFraction -> error |
749 LargeFloat negativeInfinity asTrueFraction -> error |
750 " |
750 " |
|
751 |
|
752 "Modified: / 05-06-2019 / 20:06:20 / Claus Gittinger" |
751 ! |
753 ! |
752 |
754 |
753 coerce:aNumber |
755 coerce:aNumber |
754 "return the argument as a LargeFloat" |
756 "return the argument as a LargeFloat" |
755 |
757 |
810 ! ! |
812 ! ! |
811 |
813 |
812 !LargeFloat methodsFor:'converting'! |
814 !LargeFloat methodsFor:'converting'! |
813 |
815 |
814 asFloat |
816 asFloat |
815 "Convert to a IEEE 754 double precision floating point." |
817 "Convert to a IEEE 754 double precision floating point." |
816 |
818 |
817 precision > Float precision ifTrue: [^(self copy setPrecisionTo: Float precision) asFloat]. |
819 mantissa == 0 ifTrue:[^ Float NaN]. |
818 ^mantissa asFloat timesTwoPower: biasedExponent |
820 precision > Float precision ifTrue: [^(self copy setPrecisionTo: Float precision) asFloat]. |
|
821 ^mantissa asFloat timesTwoPower: biasedExponent |
|
822 |
|
823 "Modified: / 05-06-2019 / 20:06:36 / Claus Gittinger" |
819 ! |
824 ! |
820 |
825 |
821 asFraction |
826 asFraction |
822 ^self asTrueFraction |
827 ^self asTrueFraction |
823 ! |
828 ! |
2651 ! |
2656 ! |
2652 |
2657 |
2653 negative |
2658 negative |
2654 "return true if the receiver is negative" |
2659 "return true if the receiver is negative" |
2655 |
2660 |
2656 mantissa == 0 ifTrue:[ ^ biasedExponent negative]. |
2661 mantissa == 0 ifTrue:[ ^ biasedExponent negative]. "/ +/-INF |
2657 ^ mantissa negative |
2662 ^ mantissa negative |
|
2663 |
|
2664 "Modified (comment): / 05-06-2019 / 20:08:19 / Claus Gittinger" |
2658 ! |
2665 ! |
2659 |
2666 |
2660 positive |
2667 positive |
2661 ^mantissa positive |
2668 mantissa == 0 ifTrue:[^ biasedExponent positive]. "/ +/-INF |
|
2669 ^ mantissa positive |
|
2670 |
|
2671 "Modified (comment): / 05-06-2019 / 20:08:07 / Claus Gittinger" |
2662 ! |
2672 ! |
2663 |
2673 |
2664 sign |
2674 sign |
2665 "return the sign of the receiver" |
2675 "return the sign of the receiver" |
2666 |
2676 |