--- a/Float.st Mon Mar 31 11:12:58 2003 +0200
+++ b/Float.st Mon Mar 31 11:15:41 2003 +0200
@@ -601,7 +601,6 @@
^ true "/ this may be a lie
! !
-
!Float methodsFor:'arithmetic'!
* aNumber
@@ -727,31 +726,31 @@
double result, val;
if (__isSmallInteger(aNumber)) {
- if (aNumber != __MKSMALLINT(0)) {
- result = __floatVal(self) / ( (double)__intVal(aNumber)) ;
+ if (aNumber != __MKSMALLINT(0)) {
+ result = __floatVal(self) / ( (double)__intVal(aNumber)) ;
retResult:
- __qMKFLOAT(newFloat, result);
- RETURN ( newFloat );
- }
+ __qMKFLOAT(newFloat, result);
+ RETURN ( newFloat );
+ }
} else if (__isFloatLike(aNumber)) {
- val = __floatVal(aNumber);
- if (val != 0.0) {
- result = __floatVal(self) / val;
- goto retResult;
- }
+ val = __floatVal(aNumber);
+ if (val != 0.0) {
+ result = __floatVal(self) / val;
+ goto retResult;
+ }
} else if (__isShortFloat(aNumber)) {
- val = (double)(__shortFloatVal(aNumber));
- if (val != 0.0) {
- result = __floatVal(self) / val;
- goto retResult;
- }
+ val = (double)(__shortFloatVal(aNumber));
+ if (val != 0.0) {
+ result = __floatVal(self) / val;
+ goto retResult;
+ }
}
%}.
((aNumber == 0) or:[aNumber = 0.0]) ifTrue:[
- "
- No, you shalt not divide by zero
- "
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ "
+ No, you shalt not divide by zero
+ "
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ aNumber quotientFromFloat:self
!
@@ -1489,7 +1488,6 @@
"Modified: / 16.11.2001 / 14:14:49 / cg"
! !
-
!Float methodsFor:'printing & storing'!
printString
@@ -1789,7 +1787,6 @@
"
! !
-
!Float methodsFor:'testing'!
isFinite
@@ -2279,7 +2276,7 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.129 2002-11-26 11:41:23 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.130 2003-03-31 09:15:34 cg Exp $'
! !
Float initialize!
--- a/LargeInteger.st Mon Mar 31 11:12:58 2003 +0200
+++ b/LargeInteger.st Mon Mar 31 11:15:41 2003 +0200
@@ -1964,22 +1964,22 @@
shift "{ Class: SmallInteger }" |
anInteger == 0 ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext
+ ^ ZeroDivide raiseRequestWith:thisContext
].
self = anInteger ifTrue:[
- ^ Array with:1 with:0
+ ^ Array with:1 with:0
].
shift := self highBit - anInteger highBit.
dividend := LargeInteger digitBytes:digitByteArray copy. "/ self simpleDeepCopy sign:1.
shift < 0 ifTrue:[
- ^ Array with:0 with:dividend compressed.
+ ^ Array with:0 with:dividend compressed.
].
shift == 0 ifTrue:[
- divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy.
+ divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy.
] ifFalse:[
- divisor := anInteger bitShift:shift.
+ divisor := anInteger bitShift:shift.
].
quo := self class basicNew numberOfDigits:((shift // 8) + 1).
@@ -1987,14 +1987,14 @@
shift := shift + 1.
[shift > 0] whileTrue:[
- (dividend absLess:divisor) ifFalse:[
- digits bitSetAt:shift.
- (dividend absSubtract: divisor) ifFalse:[ "result == 0"
- ^ Array with:quo compressed with:dividend compressed
- ].
- ].
- shift := shift - 1.
- divisor div2.
+ (dividend absLess:divisor) ifFalse:[
+ digits bitSetAt:shift.
+ (dividend absSubtract: divisor) ifFalse:[ "result == 0"
+ ^ Array with:quo compressed with:dividend compressed
+ ].
+ ].
+ shift := shift - 1.
+ divisor div2.
].
^ Array with:quo compressed with:dividend compressed
@@ -2058,12 +2058,12 @@
ok|
aPositiveSmallInteger == 0 ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext
+ ^ ZeroDivide raiseRequestWith:thisContext
].
"This cannot happen (if always normalized)
self < aPositiveSmallInteger ifTrue:[
- ^ Array with:0 with:self
+ ^ Array with:0 with:self
].
"
count := digitByteArray size.
@@ -2078,72 +2078,72 @@
if (__isByteArray(__digits)
&& __isByteArray(newDigitByteArray)
&& __bothSmallInteger(count, aPositiveSmallInteger)) {
- unsigned INT rest = 0;
- int index = __intVal(count);
- int index0;
- unsigned INT divisor = __intVal(aPositiveSmallInteger);
- unsigned char *digitBytes = __ByteArrayInstPtr(__digits)->ba_element;
- unsigned char *resultBytes = __ByteArrayInstPtr(newDigitByteArray)->ba_element;
-
- index0 = index - 1;
-
- /*
- * divide short-wise
- */
- if (divisor <= 0xFFFF) {
- if ((index & 1) == 0) { /* even number of bytes */
- while (index > 1) {
- unsigned INT t;
- unsigned INT div;
-
- index -= 2;
+ unsigned INT rest = 0;
+ int index = __intVal(count);
+ int index0;
+ unsigned INT divisor = __intVal(aPositiveSmallInteger);
+ unsigned char *digitBytes = __ByteArrayInstPtr(__digits)->ba_element;
+ unsigned char *resultBytes = __ByteArrayInstPtr(newDigitByteArray)->ba_element;
+
+ index0 = index - 1;
+
+ /*
+ * divide short-wise
+ */
+ if (divisor <= 0xFFFF) {
+ if ((index & 1) == 0) { /* even number of bytes */
+ while (index > 1) {
+ unsigned INT t;
+ unsigned INT div;
+
+ index -= 2;
#if defined(__LSBFIRST) || defined(i386)
- t = *((unsigned short *)(&digitBytes[index]));
+ t = *((unsigned short *)(&digitBytes[index]));
#else
- t = digitBytes[index+1];
- t = (t << 8) | digitBytes[index];
+ t = digitBytes[index+1];
+ t = (t << 8) | digitBytes[index];
#endif
- t = t | (rest << 16);
- div = t / divisor;
- rest = t % divisor;
+ t = t | (rest << 16);
+ div = t / divisor;
+ rest = t % divisor;
#if defined(__LSBFIRST) || defined(i386)
- *((unsigned short *)(&resultBytes[index])) = (div & 0xFFFF);
+ *((unsigned short *)(&resultBytes[index])) = (div & 0xFFFF);
#else
- resultBytes[index+1] = div >> 8;
- resultBytes[index] = div /* & 0xFF */;
+ resultBytes[index+1] = div >> 8;
+ resultBytes[index] = div /* & 0xFF */;
#endif
- }
- }
- }
- while (index > 0) {
- unsigned INT t;
-
- index--;
- t = digitBytes[index];
- t = t | (rest << 8);
- resultBytes[index] = t / divisor;
- rest = t % divisor;
- }
- prevRest = __MKSMALLINT(rest);
-
- /*
- * no need to normalize ?
- */
- while ((index0 >= sizeof(INT)) && (resultBytes[index0]==0)) {
- index0--;
- }
-
- if (index0 > sizeof(INT)) {
- RETURN ( __ARRAY_WITH2(result, prevRest));
- }
- if ((index0 == sizeof(INT))
- && resultBytes[index0] >= 0x40) {
- RETURN ( __ARRAY_WITH2(result, prevRest));
- }
- /*
- * must compress
- */
- ok = true;
+ }
+ }
+ }
+ while (index > 0) {
+ unsigned INT t;
+
+ index--;
+ t = digitBytes[index];
+ t = t | (rest << 8);
+ resultBytes[index] = t / divisor;
+ rest = t % divisor;
+ }
+ prevRest = __MKSMALLINT(rest);
+
+ /*
+ * no need to normalize ?
+ */
+ while ((index0 >= sizeof(INT)) && (resultBytes[index0]==0)) {
+ index0--;
+ }
+
+ if (index0 > sizeof(INT)) {
+ RETURN ( __ARRAY_WITH2(result, prevRest));
+ }
+ if ((index0 == sizeof(INT))
+ && resultBytes[index0] >= 0x40) {
+ RETURN ( __ARRAY_WITH2(result, prevRest));
+ }
+ /*
+ * must compress
+ */
+ ok = true;
}
%}.
"
@@ -2151,7 +2151,7 @@
(could also do a primitiveFailure here)
"
ok ifFalse:[
- ^ self absDivMod:(LargeInteger value:aPositiveSmallInteger).
+ ^ self absDivMod:(LargeInteger value:aPositiveSmallInteger).
].
^ Array with:(result compressed) with:prevRest
@@ -3071,34 +3071,34 @@
shift "{ Class: SmallInteger }" |
anInteger == 0 ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext
+ ^ ZeroDivide raiseRequestWith:thisContext
].
self = anInteger ifTrue:[
- ^ 0
+ ^ 0
].
shift := self highBit - anInteger highBit.
dividend := LargeInteger digitBytes:digitByteArray copy. "/ self simpleDeepCopy sign:1.
shift < 0 ifTrue:[
- ^ dividend compressed.
+ ^ dividend compressed.
].
shift == 0 ifTrue:[
- divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy
+ divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy
] ifFalse:[
- divisor := anInteger bitShift:shift.
+ divisor := anInteger bitShift:shift.
].
shift := shift + 1.
[shift > 0] whileTrue:[
- (dividend absLess:divisor) ifFalse:[
- (dividend absSubtract: divisor) ifFalse:[ "result == 0"
- ^ dividend compressed
- ].
- ].
- shift := shift - 1.
- divisor div2.
+ (dividend absLess:divisor) ifFalse:[
+ (dividend absSubtract: divisor) ifFalse:[ "result == 0"
+ ^ dividend compressed
+ ].
+ ].
+ shift := shift - 1.
+ divisor div2.
].
^ dividend compressed
@@ -4408,5 +4408,5 @@
!LargeInteger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.166 2002-07-31 10:31:28 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.167 2003-03-31 09:15:27 cg Exp $'
! !
--- a/LimitedPrecisionReal.st Mon Mar 31 11:12:58 2003 +0200
+++ b/LimitedPrecisionReal.st Mon Mar 31 11:15:41 2003 +0200
@@ -224,7 +224,7 @@
"return the quotient of the receiver and the argument, aNumber"
((aNumber == 0) or:[aNumber = 0.0]) ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
"/ as soon as Float are float & Double are doubles,
"/ use:
@@ -690,7 +690,7 @@
!LimitedPrecisionReal class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.46 2002-11-26 09:33:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.47 2003-03-31 09:15:15 cg Exp $'
! !
LimitedPrecisionReal initialize!
--- a/LongFloat.st Mon Mar 31 11:12:58 2003 +0200
+++ b/LongFloat.st Mon Mar 31 11:15:41 2003 +0200
@@ -397,7 +397,7 @@
"
No, you shalt not divide by zero
"
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ aNumber quotientFromLongFloat:self
!
@@ -1034,5 +1034,5 @@
!LongFloat class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.20 2002-11-26 11:41:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.21 2003-03-31 09:15:06 cg Exp $'
! !
--- a/ShortFloat.st Mon Mar 31 11:12:58 2003 +0200
+++ b/ShortFloat.st Mon Mar 31 11:15:41 2003 +0200
@@ -436,7 +436,7 @@
"
No, you shalt not divide by zero
"
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ aNumber quotientFromShortFloat:self
!
@@ -1085,5 +1085,5 @@
!ShortFloat class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.69 2002-11-26 11:41:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.70 2003-03-31 09:14:57 cg Exp $'
! !
--- a/SmallInteger.st Mon Mar 31 11:12:58 2003 +0200
+++ b/SmallInteger.st Mon Mar 31 11:15:41 2003 +0200
@@ -520,7 +520,7 @@
%}.
aNumber isInteger ifTrue:[
aNumber == 0 ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ Fraction numerator:self denominator:aNumber
].
@@ -616,7 +616,7 @@
}
%}.
(aNumber = 0) ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ self retry:#// coercing:aNumber
@@ -688,7 +688,7 @@
}
%}.
(aNumber = 0) ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ self retry:#\\ coercing:aNumber
@@ -779,7 +779,7 @@
}
%}.
(aNumber = 0) ifTrue:[
- ^ DivisionByZeroSignal raiseRequestWith:thisContext.
+ ^ ZeroDivide raiseRequestWith:thisContext.
].
^ self retry:#quo: coercing:aNumber
@@ -3309,5 +3309,5 @@
!SmallInteger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.149 2002-07-31 10:30:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.150 2003-03-31 09:15:41 cg Exp $'
! !