--- a/Float.st Tue Oct 02 10:15:17 2001 +0200
+++ b/Float.st Tue Oct 02 11:58:53 2001 +0200
@@ -573,20 +573,31 @@
%{ /* NOCONTEXT */
+ /*
+ * notice:
+ * the following inline code handles some common cases,
+ * and exists as an optimization, to speed up those cases.
+ *
+ * Conceptionally, (and for most other argument types),
+ * mixed arithmetic is implemented by double dispatching
+ * (see the message send at the bottom)
+ */
OBJ newFloat;
double result;
if (__isSmallInteger(aNumber)) {
- result = __floatVal(self) * (double)(__intVal(aNumber));
+ result = __floatVal(self) * (double)(__intVal(aNumber));
retResult:
- __qMKFLOAT(newFloat, result);
- RETURN ( newFloat );
- } else if (__isFloatLike(aNumber)) {
- result = __floatVal(self) * __floatVal(aNumber);
- goto retResult;
- } else if (__isShortFloat(aNumber)) {
- result = __floatVal(self) * (double)(__shortFloatVal(aNumber));
- goto retResult;
+ __qMKFLOAT(newFloat, result);
+ RETURN ( newFloat );
+ }
+ if (__isFloatLike(aNumber)) {
+ result = __floatVal(self) * __floatVal(aNumber);
+ goto retResult;
+ }
+ if (__isShortFloat(aNumber)) {
+ result = __floatVal(self) * (double)(__shortFloatVal(aNumber));
+ goto retResult;
}
%}.
^ aNumber productFromFloat:self
@@ -597,20 +608,31 @@
%{ /* NOCONTEXT */
+ /*
+ * notice:
+ * the following inline code handles some common cases,
+ * and exists as an optimization, to speed up those cases.
+ *
+ * Conceptionally, (and for most other argument types),
+ * mixed arithmetic is implemented by double dispatching
+ * (see the message send at the bottom)
+ */
OBJ newFloat;
double result;
if (__isSmallInteger(aNumber)) {
- result = __floatVal(self) + (double)(__intVal(aNumber));
+ result = __floatVal(self) + (double)(__intVal(aNumber));
retResult:
- __qMKFLOAT(newFloat, result);
- RETURN ( newFloat );
- } else if (__isFloatLike(aNumber)) {
- result = __floatVal(self) + __floatVal(aNumber);
- goto retResult;
- } else if (__isShortFloat(aNumber)) {
- result = __floatVal(self) + (double)(__shortFloatVal(aNumber));
- goto retResult;
+ __qMKFLOAT(newFloat, result);
+ RETURN ( newFloat );
+ }
+ if (__isFloatLike(aNumber)) {
+ result = __floatVal(self) + __floatVal(aNumber);
+ goto retResult;
+ }
+ if (__isShortFloat(aNumber)) {
+ result = __floatVal(self) + (double)(__shortFloatVal(aNumber));
+ goto retResult;
}
%}.
^ aNumber sumFromFloat:self
@@ -621,20 +643,31 @@
%{ /* NOCONTEXT */
+ /*
+ * notice:
+ * the following inline code handles some common cases,
+ * and exists as an optimization, to speed up those cases.
+ *
+ * Conceptionally, (and for most other argument types),
+ * mixed arithmetic is implemented by double dispatching
+ * (see the message send at the bottom)
+ */
OBJ newFloat;
double result;
if (__isSmallInteger(aNumber)) {
- result = __floatVal(self) - (double)(__intVal(aNumber));
+ result = __floatVal(self) - (double)(__intVal(aNumber));
retResult:
- __qMKFLOAT(newFloat, result);
- RETURN ( newFloat );
- } else if (__isFloatLike(aNumber)) {
- result = __floatVal(self) - __floatVal(aNumber);
- goto retResult;
- } else if (__isShortFloat(aNumber)) {
- result = __floatVal(self) - (double)(__shortFloatVal(aNumber));
- goto retResult;
+ __qMKFLOAT(newFloat, result);
+ RETURN ( newFloat );
+ }
+ if (__isFloatLike(aNumber)) {
+ result = __floatVal(self) - __floatVal(aNumber);
+ goto retResult;
+ }
+ if (__isShortFloat(aNumber)) {
+ result = __floatVal(self) - (double)(__shortFloatVal(aNumber));
+ goto retResult;
}
%}.
^ aNumber differenceFromFloat:self
@@ -645,6 +678,15 @@
%{ /* NOCONTEXT */
+ /*
+ * notice:
+ * the following inline code handles some common cases,
+ * and exists as an optimization, to speed up those cases.
+ *
+ * Conceptionally, (and for most other argument types),
+ * mixed arithmetic is implemented by double dispatching
+ * (see the message send at the bottom)
+ */
OBJ newFloat;
double result, val;
@@ -2113,6 +2155,6 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.117 2001-10-02 08:14:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.118 2001-10-02 09:58:46 cg Exp $'
! !
Float initialize!