--- a/Float.st Mon Apr 27 19:04:46 2015 +0200
+++ b/Float.st Mon Apr 27 19:04:59 2015 +0200
@@ -209,12 +209,12 @@
In contrast to ShortFloats (32bit) and LongFloats (>=64bit).
WARNING:
- The layout of Float instances is known by the runtime system and the compiler;
- you may not add instance variables here.
- Also, subclassing is complicated by the fact, that the VM creates floats/shortFloats,
- and does some float-checks by an identity compare with the Float-class.
- (i.e. your subclasses instances may not be recognized as float-like objects,
- thus mixed mode arithmetic will always coerce them, effectively slowing things down).
+ The layout of Float instances is known by the runtime system and the compiler;
+ you may not add instance variables here.
+ Also, subclassing is complicated by the fact, that the VM creates floats/shortFloats,
+ and does some float-checks by an identity compare with the Float-class.
+ (i.e. your subclasses instances may not be recognized as float-like objects,
+ thus mixed mode arithmetic will always coerce them, effectively slowing things down).
Notice, that Floats are defined as Byte-array to prevent the garbage collector
from going into the value ... otherwise I needed a special case in many places.
@@ -229,29 +229,29 @@
instances.
Mixed mode arithmetic:
- float op float -> float
- float op fix -> float
- float op fraction -> float
- float op integer -> float
- float op shortFloat -> float
- float op longFloat -> longFloat
- float op complex -> complex
+ float op float -> float
+ float op fix -> float
+ float op fraction -> float
+ float op integer -> float
+ float op shortFloat -> float
+ float op longFloat -> longFloat
+ float op complex -> complex
Representation:
- 64bit double precision IEEE floats
- 53 bit mantissa,
- 11 bit exponent,
- 15 decimal digits (approx)
+ 64bit double precision IEEE floats
+ 53 bit mantissa,
+ 11 bit exponent,
+ 15 decimal digits (approx)
Range and Precision of Storage Formats: see LimitedPrecisionReal >> documentation
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- Number
- ShortFloat LongFloat Fraction FixedPoint Integer Complex
- FloatArray DoubleArray
+ Number
+ ShortFloat LongFloat Fraction FixedPoint Integer Complex
+ FloatArray DoubleArray
"
!
@@ -290,10 +290,14 @@
binary stored in a device independent format."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ ERROR("trying to instantiate a float");
+#else
OBJ newFloat;
__qMKFLOAT(newFloat, 0.0);
RETURN (newFloat);
+#endif /* not SCHTEAM */
%}
!
@@ -359,18 +363,21 @@
"creates a double, given the four native float bytes as an integer"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
REGISTER union {
- unsigned int i;
- float f;
+ unsigned int i;
+ float f;
} r;
r.i = __unsignedLongIntVal( anInteger );
RETURN( __MKFLOAT((double)(r.f)) );
+#endif
%}
"
- ShortFloat fromIEEE32Bit:(ShortFloat pi digitBytesMSB:true) asInteger
+ ShortFloat fromIEEE32Bit:(ShortFloat pi digitBytesMSB:true) asInteger
"
!
@@ -378,21 +385,25 @@
"creates a double, given the four native float bytes as an integer"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
__uint64__ __unsignedLongLongIntVal(OBJ);
REGISTER union {
- __uint64__ u64;
- double d;
+ __uint64__ u64;
+ double d;
} r;
if (__unsignedLong64IntVal(anInteger, &r.u64)) {
- RETURN( __MKFLOAT(r.d) );
+ RETURN( __MKFLOAT(r.d) );
}
+#endif
%}.
self primitiveFailed.
"
- Float fromIEEE64Bit:(Float pi digitBytesMSB:true) asInteger
+ Float fromIEEE64Bit:(Float pi digitBytesMSB:true) asInteger
"
!
@@ -406,6 +417,9 @@
"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
REGISTER union {
unsigned char b[4];
@@ -413,17 +427,17 @@
float f;
} r;
-#ifdef __LSBFIRST__
+# ifdef __LSBFIRST__
r.b[3] = __intVal( b2 );
r.b[2] = __intVal( b1 );
r.b[1] = __intVal( b4 );
r.b[0] = __intVal( b3 );
-#else
+# else
r.b[0] = __intVal( b2 );
r.b[1] = __intVal( b1 );
r.b[2] = __intVal( b4 );
r.b[3] = __intVal( b3 );
-#endif
+# endif
if( (r.l & 0xff800000) != 0x80000000 )
{
if( (r.l & 0x7f800000) > 0x01000000 )
@@ -433,6 +447,7 @@
RETURN( __MKFLOAT(r.f) );
}
+#endif
%}.
^ nil
! !
@@ -785,6 +800,11 @@
"return the product of the receiver and the argument."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.times(aNumber) );
+ }
+#else
/*
* notice:
@@ -817,6 +837,7 @@
goto retResult;
}
}
+#endif
%}.
^ aNumber productFromFloat:self
!
@@ -825,7 +846,11 @@
"return the sum of the receiver and the argument, aNumber"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.plus(aNumber) );
+ }
+#else
/*
* notice:
* the following inline code handles some common cases,
@@ -857,6 +882,7 @@
goto retResult;
}
}
+#endif
%}.
^ aNumber sumFromFloat:self
!
@@ -865,6 +891,11 @@
"return the difference of the receiver and the argument, aNumber"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.minus(aNumber) );
+ }
+#else
/*
* notice:
@@ -897,6 +928,7 @@
goto retResult;
}
}
+#endif
%}.
^ aNumber differenceFromFloat:self
!
@@ -905,6 +937,11 @@
"return the quotient of the receiver and the argument, aNumber"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.quotient(aNumber) );
+ }
+#else
/*
* notice:
@@ -938,6 +975,7 @@
goto retResult;
}
}
+#endif
%}.
((aNumber == 0) or:[aNumber = 0.0]) ifTrue:[
"
@@ -953,6 +991,9 @@
reimplemented here for speed"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ return context._RETURN( self.abs() );
+#else
OBJ newFloat;
double val =__floatVal(self);
@@ -962,6 +1003,7 @@
RETURN ( newFloat );
}
RETURN (self);
+#endif
%}.
"
@@ -974,11 +1016,15 @@
"return the receiver negated"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ return context._RETURN( self.negated() );
+#else
OBJ newFloat;
double rslt = - __floatVal(self);
__qMKFLOAT(newFloat, rslt);
RETURN ( newFloat );
+#endif
%}.
!
@@ -1142,7 +1188,8 @@
__qMKSFLOAT(newFloat, fVal);
RETURN ( newFloat );
-%}
+%}.
+ self primitiveFailed
!
asTrueFraction
@@ -1157,7 +1204,7 @@
|shifty sign expPart exp fraction fractionPart result zeroBitsCount|
self isFinite ifFalse:[
- ^ self asMetaNumber
+ ^ self asMetaNumber
"/ ^ self class
"/ raise:#domainErrorSignal
"/ receiver:self
@@ -1170,9 +1217,9 @@
shifty := LargeInteger basicNew numberOfDigits:8.
UninterpretedBytes isBigEndian ifTrue:[
"/ shifty := ((self longWordAt: 1) bitShift: 32) + (self longWordAt: 2).
- 1 to:8 do:[:i | shifty digitAt:(9-i) put:(self basicAt:i)].
+ 1 to:8 do:[:i | shifty digitAt:(9-i) put:(self basicAt:i)].
] ifFalse:[
- 1 to:8 do:[:i | shifty digitAt:i put:(self basicAt:i)].
+ 1 to:8 do:[:i | shifty digitAt:i put:(self basicAt:i)].
].
" Extract the sign and the biased exponent "
@@ -1193,19 +1240,19 @@
the number of trailing zero bits in the fraction to minimize
the (huge) time otherwise spent in #gcd:. "
exp negative ifTrue: [
- result := sign * (fraction bitShift: exp negated)
+ result := sign * (fraction bitShift: exp negated)
] ifFalse:[
- zeroBitsCount := fraction lowBit - 1.
- exp := exp - zeroBitsCount.
- exp <= 0 ifTrue: [
- zeroBitsCount := zeroBitsCount + exp.
- "exp := 0." " Not needed; exp not refernced again "
- result := sign * (fraction bitShift:zeroBitsCount negated)
- ] ifFalse: [
- result := Fraction
- numerator: (sign * (fraction bitShift: zeroBitsCount negated))
- denominator: (1 bitShift:exp)
- ]
+ zeroBitsCount := fraction lowBit - 1.
+ exp := exp - zeroBitsCount.
+ exp <= 0 ifTrue: [
+ zeroBitsCount := zeroBitsCount + exp.
+ "exp := 0." " Not needed; exp not refernced again "
+ result := sign * (fraction bitShift:zeroBitsCount negated)
+ ] ifFalse: [
+ result := Fraction
+ numerator: (sign * (fraction bitShift: zeroBitsCount negated))
+ denominator: (1 bitShift:exp)
+ ]
].
"Low cost validation omitted after extensive testing"
@@ -1221,7 +1268,7 @@
3e37 asTrueFraction
2e37 asTrueFraction
1e37 asTrueFraction
- 1e30 asTrueFraction
+ 1e30 asTrueFraction
Float NaN asTrueFraction
Float infinity asTrueFraction
"
@@ -1245,7 +1292,11 @@
"return true, if the argument is greater"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.ltP(aNumber) );
+ }
+#else
/*
* notice:
* the following inline code handles some common cases,
@@ -1266,6 +1317,7 @@
RETURN ( (__floatVal(self) < (double)(__shortFloatVal(aNumber))) ? true : false );
}
}
+#endif
%}.
^ aNumber lessFromFloat:self
!
@@ -1274,7 +1326,11 @@
"return true, if the argument is greater or equal"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.leP(aNumber) );
+ }
+#else
/*
* notice:
* the following inline code handles some common cases,
@@ -1295,6 +1351,7 @@
RETURN ( (__floatVal(self) <= (double)(__shortFloatVal(aNumber))) ? true : false );
}
}
+#endif
%}.
^ self retry:#<= coercing:aNumber
!
@@ -1304,6 +1361,11 @@
as the receiver, false otherwise"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.eqNrP(aNumber) );
+ }
+#else
/*
* notice:
@@ -1327,6 +1389,7 @@
} else {
RETURN (false);
}
+#endif
%}.
^ aNumber equalFromFloat:self
!
@@ -1335,7 +1398,11 @@
"return true, if the argument is less"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.gtP(aNumber) );
+ }
+#else
/*
* notice:
* the following inline code handles some common cases,
@@ -1356,6 +1423,7 @@
RETURN ( (__floatVal(self) > (double)(__shortFloatVal(aNumber))) ? true : false );
}
}
+#endif
%}.
^ self retry:#> coercing:aNumber
!
@@ -1364,7 +1432,11 @@
"return true, if the argument is less or equal"
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.geP(aNumber) );
+ }
+#else
/*
* notice:
* the following inline code handles some common cases,
@@ -1385,6 +1457,7 @@
RETURN ( (__floatVal(self) >= (double)(__shortFloatVal(aNumber))) ? true : false );
}
}
+#endif
%}.
^ self retry:#>= coercing:aNumber
!
@@ -1614,6 +1687,11 @@
Raises an exception, if the receiver is less or equal to zero."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.log() );
+ }
+#else
double val, rslt;
OBJ newFloat;
@@ -1634,6 +1712,7 @@
}
}
}
+#endif
%}.
"
an invalid value for logarithm
@@ -1653,6 +1732,11 @@
Raises an exception, if the receiver is less or equal to zero."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.log10() );
+ }
+#else
double val, rslt;
OBJ newFloat;
@@ -1673,6 +1757,7 @@
}
}
}
+#endif
%}.
"
an invalid value for logarithm
@@ -1775,25 +1860,25 @@
^ self printStringWithFormat:DefaultPrintFormat
"
- Float pi printString.
- 1.0 printString
- 1.234 printString
- 1e10 printString
- 1.2e3 printString
- 1.2e30 printString
- (1.0 uncheckedDivide:0) printString
- (0.0 uncheckedDivide:0) printString
- self pi printString.
-
- DecimalPointCharacter := $,.
- 1.234 printString.
- 1.0 printString.
- 1e10 printString.
- 1.2e3 printString.
- 1.2e30 printString.
- (1.0 uncheckedDivide:0) printString.
- (0.0 uncheckedDivide:0) printString.
- DecimalPointCharacter := $.
+ Float pi printString.
+ 1.0 printString
+ 1.234 printString
+ 1e10 printString
+ 1.2e3 printString
+ 1.2e30 printString
+ (1.0 uncheckedDivide:0) printString
+ (0.0 uncheckedDivide:0) printString
+ self pi printString.
+
+ DecimalPointCharacter := $,.
+ 1.234 printString.
+ 1.0 printString.
+ 1e10 printString.
+ 1.2e3 printString.
+ 1.2e30 printString.
+ (1.0 uncheckedDivide:0) printString.
+ (0.0 uncheckedDivide:0) printString.
+ DecimalPointCharacter := $.
"
!
@@ -1814,12 +1899,12 @@
int len;
if (__isStringLike(format)) {
- fmt = (char *) __stringVal(format);
+ fmt = (char *) __stringVal(format);
} else {
- /*
- * in case we get called with garbage ...
- */
- fmt = ".15";
+ /*
+ * in case we get called with garbage ...
+ */
+ fmt = ".15";
}
/*
@@ -1838,33 +1923,33 @@
__END_PROTECT_REGISTERS__
if (len >= 0 && len < sizeof(buffer)-3) {
- /*
- * kludge to make integral float f prints as "f.0" (not as "f" as printf does)
- * (i.e. look if string contains '.' or 'e' and append '.0' if not)
- */
- for (cp = buffer; *cp; cp++) {
- if ((*cp == '.') || (*cp == ',') || (*cp == 'E') || (*cp == 'e')) break;
- }
- if (!*cp && (cp[-1] >= '0') && (cp[-1] <= '9')) {
- if (__isCharacter(@global(DecimalPointCharacterForPrinting))) {
- *cp++ = __intVal(__characterVal(@global(DecimalPointCharacterForPrinting)));
- } else {
- *cp++ = '.';
- }
- *cp++ = '0';
- *cp = '\0';
- } else {
- if (cp && ((*cp == '.') || (*cp == ','))) {
- if (__isCharacter(@global(DecimalPointCharacterForPrinting))) {
- *cp = __intVal(__characterVal(@global(DecimalPointCharacterForPrinting)));
- }
- }
- }
-
- s = __MKSTRING(buffer);
- if (s != nil) {
- RETURN (s);
- }
+ /*
+ * kludge to make integral float f prints as "f.0" (not as "f" as printf does)
+ * (i.e. look if string contains '.' or 'e' and append '.0' if not)
+ */
+ for (cp = buffer; *cp; cp++) {
+ if ((*cp == '.') || (*cp == ',') || (*cp == 'E') || (*cp == 'e')) break;
+ }
+ if (!*cp && (cp[-1] >= '0') && (cp[-1] <= '9')) {
+ if (__isCharacter(@global(DecimalPointCharacterForPrinting))) {
+ *cp++ = __intVal(__characterVal(@global(DecimalPointCharacterForPrinting)));
+ } else {
+ *cp++ = '.';
+ }
+ *cp++ = '0';
+ *cp = '\0';
+ } else {
+ if (cp && ((*cp == '.') || (*cp == ','))) {
+ if (__isCharacter(@global(DecimalPointCharacterForPrinting))) {
+ *cp = __intVal(__characterVal(@global(DecimalPointCharacterForPrinting)));
+ }
+ }
+ }
+
+ s = __MKSTRING(buffer);
+ if (s != nil) {
+ RETURN (s);
+ }
}
%}.
"
@@ -1877,24 +1962,24 @@
^ ObjectMemory allocationFailureSignal raise.
"
- 1.0 printString
- 1.234 printString
- 1e10 printString
- 1.2e3 printString
- 1.2e30 printString
- (1.0 uncheckedDivide:0) printString
- (0.0 uncheckedDivide:0) printString
- self pi printString.
-
- DecimalPointCharacter := $,.
- 1.234 printString.
- 1.0 printString.
- 1e10 printString.
- 1.2e3 printString.
- 1.2e30 printString.
- (1.0 uncheckedDivide:0) printString.
- (0.0 uncheckedDivide:0) printString.
- DecimalPointCharacter := $.
+ 1.0 printString
+ 1.234 printString
+ 1e10 printString
+ 1.2e3 printString
+ 1.2e30 printString
+ (1.0 uncheckedDivide:0) printString
+ (0.0 uncheckedDivide:0) printString
+ self pi printString.
+
+ DecimalPointCharacter := $,.
+ 1.234 printString.
+ 1.0 printString.
+ 1e10 printString.
+ 1.2e3 printString.
+ 1.2e30 printString.
+ (1.0 uncheckedDivide:0) printString.
+ (0.0 uncheckedDivide:0) printString.
+ DecimalPointCharacter := $.
"
!
@@ -2238,11 +2323,11 @@
%}.
"
- 1.0 isFinite
- self NaN isFinite
- self infinity isFinite
- (0.0 uncheckedDivide: 0.0) isFinite
- (1.0 uncheckedDivide: 0.0) isFinite
+ 1.0 isFinite
+ self NaN isFinite
+ self infinity isFinite
+ (0.0 uncheckedDivide: 0.0) isFinite
+ (1.0 uncheckedDivide: 0.0) isFinite
"
!
@@ -2297,18 +2382,18 @@
%}.
"
- self NaN isNaN
- 1.0 isNaN
- (0.0 uncheckedDivide: 0.0) isNaN
- (1.0 uncheckedDivide: 0.0) isNaN
- (-1.0 uncheckedDivide: 0.0) isNaN
+ self NaN isNaN
+ 1.0 isNaN
+ (0.0 uncheckedDivide: 0.0) isNaN
+ (1.0 uncheckedDivide: 0.0) isNaN
+ (-1.0 uncheckedDivide: 0.0) isNaN
"
!
isNegativeZero
"many systems have two float.Pnt zeros"
-%{ /* NOCONTEXT */
+%{ /* NOCONTEXT */
#if defined(__BORLANDC__)
union { double d; int i[2]; } __u;
@@ -2338,12 +2423,12 @@
%}.
"
- 0.0 negative
- -0.0 negative
- 1.0 negative
- -1.0 negative
- (1.0 uncheckedDivide: 0.0) negative
- (-1.0 uncheckedDivide: 0.0) negative
+ 0.0 negative
+ -0.0 negative
+ 1.0 negative
+ -1.0 negative
+ (1.0 uncheckedDivide: 0.0) negative
+ (-1.0 uncheckedDivide: 0.0) negative
"
!
@@ -2374,12 +2459,12 @@
%}.
"
- 0.0 positive
- -0.0 positive
- 1.0 positive
- -1.0 positive
- (1.0 uncheckedDivide: 0.0) positive
- (-1.0 uncheckedDivide: 0.0) positive
+ 0.0 positive
+ -0.0 positive
+ 1.0 positive
+ -1.0 positive
+ (1.0 uncheckedDivide: 0.0) positive
+ (-1.0 uncheckedDivide: 0.0) positive
"
!
@@ -2409,15 +2494,20 @@
Raises an exception, if the receiver is not in -1..1"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.acos() );
+ }
+#else
double val, rslt;
OBJ newFloat;
val = __floatVal(self);
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+# ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
if ((val >= -1.0) && (val <= 1.0))
-#endif
+# endif
{
__threadErrno = 0;
rslt = acos(val);
@@ -2429,6 +2519,7 @@
}
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2499,15 +2590,20 @@
Raises an exception, if the receiver is not in -1..1"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.asin() );
+ }
+#else
double val, rslt;
OBJ newFloat;
val = __floatVal(self);
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+# ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
if ((val >= -1.0) && (val <= 1.0))
-#endif
+# endif
{
__threadErrno = 0;
rslt = asin(val);
@@ -2519,6 +2615,7 @@
}
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2584,6 +2681,11 @@
"return the arctangent of the receiver (as radians)"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.atan() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2597,6 +2699,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2705,6 +2808,11 @@
"return the cosine of the receiver (interpreted as radians)"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.cos() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2718,6 +2826,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2733,6 +2842,11 @@
"return the hyperbolic cosine of the receiver"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.cosh() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2746,6 +2860,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2759,6 +2874,11 @@
"return the sine of the receiver (interpreted as radians)"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.sin() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2772,6 +2892,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2787,6 +2908,11 @@
"return the hyperbolic sine of the receiver"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.sinh() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2800,6 +2926,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2813,6 +2940,11 @@
"return the tangens of the receiver (interpreted as radians)"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.tan() );
+ }
+#else
double rslt;
OBJ newFloat;
@@ -2826,6 +2958,7 @@
RETURN ( newFloat );
}
}
+#endif
%}.
^ self class
raise:#domainErrorSignal
@@ -2871,6 +3004,9 @@
|val|
%{
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
double dVal;
dVal = ceil(__floatVal(self));
@@ -2881,6 +3017,7 @@
RETURN ( __mkSmallInteger( (INT) dVal ) );
}
__qMKFLOAT(val, dVal);
+#endif
%}.
^ val asInteger
!
@@ -2892,12 +3029,18 @@
It may be useful, if the result is to be further used in another float-operation."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.ceiling() );
+ }
+#else
double dVal;
OBJ v;
dVal = ceil(__floatVal(self));
__qMKFLOAT(v, dVal);
RETURN (v);
+#endif
%}
"
0.5 ceilingAsFloat
@@ -2912,6 +3055,9 @@
|val|
%{
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
double dVal;
dVal = floor(__floatVal(self));
@@ -2922,6 +3068,7 @@
RETURN ( __mkSmallInteger( (INT) dVal ) );
}
__qMKFLOAT(val, dVal);
+#endif
%}.
^ val asInteger
@@ -2940,12 +3087,18 @@
It may be useful, if the result is to be further used in another float-operation."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.floor() );
+ }
+#else
double dVal;
OBJ v;
dVal = floor(__floatVal(self));
__qMKFLOAT(v, dVal);
RETURN (v);
+#endif
%}
"
@@ -3008,6 +3161,9 @@
|val|
%{
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
double dVal;
dVal = __floatVal(self);
@@ -3023,6 +3179,7 @@
RETURN ( __mkSmallInteger( (INT) dVal ) );
}
__qMKFLOAT(val, dVal);
+#endif
%}.
^ val asInteger
@@ -3046,6 +3203,11 @@
|val|
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.round() );
+ }
+#else
double dVal;
OBJ v;
@@ -3057,6 +3219,7 @@
}
__qMKFLOAT(v, dVal);
RETURN (v);
+#endif
%}
"
@@ -3073,6 +3236,9 @@
|val|
%{
+#ifdef __SCHTEAM__
+ ERROR("unimplemented");
+#else
double dVal;
dVal = __floatVal(self);
@@ -3089,6 +3255,7 @@
RETURN ( __mkSmallInteger( (INT) dVal ) );
}
__qMKFLOAT(val, dVal);
+#endif
%}.
^ val asInteger
@@ -3109,6 +3276,11 @@
float-operation."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (aNumber.isNumber()) {
+ return context._RETURN( self.truncate() );
+ }
+#else
double dVal;
OBJ v;
@@ -3120,6 +3292,7 @@
}
__qMKFLOAT(v, dVal);
RETURN (v);
+#endif
%}
"
@@ -3134,11 +3307,11 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.214 2015-03-25 19:18:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.215 2015-04-27 17:04:59 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.214 2015-03-25 19:18:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.215 2015-04-27 17:04:59 cg Exp $'
! !