--- a/LongFloat.st Tue May 21 21:58:09 2013 +0100
+++ b/LongFloat.st Fri May 24 18:52:05 2013 +0100
@@ -125,7 +125,7 @@
#if defined(__GNUC__) || defined(WIN32)
# define LONGFLOAT long double
-# if defined(linux) || defined(WIN32)
+# if defined(linux) || defined(__osx__) || defined(WIN32)
# define LONG_ceil ceill
# define LONG_floor floorl
# define LONG_sqrt sqrtl
@@ -146,14 +146,15 @@
# define LONG_pow powl
# define LONG_isnan isnanl
# define LONG_isfinite isfinitel
+
+# if !defined(WIN32)
+# define LONG_asinh asinhl
+# define LONG_acosh acoshl
+# define LONG_atanh atanhl
+# endif /* linux */
+
# endif /* defined(linux) || defined(WIN32) */
-# if defined(linux)
-# define LONG_asinh asinhl
-# define LONG_acosh acoshl
-# define LONG_atanh atanhl
-# endif /* linux */
-
# if !defined(LONG_isnan)
/* This should be true for ISO C99 systems - even for newer linux systems */
# define LONG_isnan isnan
@@ -510,14 +511,18 @@
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
"
%{
- if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */
- RETURN (__mkSmallInteger(15));
+ if (sizeof(LONGFLOAT) == 10) {
+ RETURN (__mkSmallInteger(15)); /* i386 - WIN32 */
+ }
+ if (sizeof(LONGFLOAT) == 12) {
+ RETURN (__mkSmallInteger(15)); /* i386 */
}
- if (sizeof(LONGFLOAT) == 12) { /* i386 */
- RETURN (__mkSmallInteger(15));
- }
- if (sizeof(LONGFLOAT) == 16) { /* sparc, i386-64bit */
- RETURN (__mkSmallInteger(15));
+ if (sizeof(LONGFLOAT) == 16) {
+#ifdef __x86_64__
+ RETURN (__mkSmallInteger(15)); /* amd64, i386-64bit */
+#else
+ RETURN (__mkSmallInteger(15)); /* sparc */
+#endif
}
%}.
"systems without longFloat support use doubles instead"
@@ -538,14 +543,18 @@
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
"
%{
- if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */
- RETURN (__mkSmallInteger(1));
+ if (sizeof(LONGFLOAT) == 10) {
+ RETURN (__mkSmallInteger(1)); /* i386 - WIN32 */
+ }
+ if (sizeof(LONGFLOAT) == 12) {
+ RETURN (__mkSmallInteger(1)); /* i386 */
}
- if (sizeof(LONGFLOAT) == 12) { /* i386 */
- RETURN (__mkSmallInteger(1));
- }
- if (sizeof(LONGFLOAT) == 16) { /* sparc */
- RETURN (__mkSmallInteger(0));
+ if (sizeof(LONGFLOAT) == 16) {
+#ifdef __x86_64__
+ RETURN (__mkSmallInteger(1)); /* amd64 */
+#else
+ RETURN (__mkSmallInteger(0)); /* sparc */
+#endif
}
%}.
"systems without longFloat support use doubles instead"
@@ -569,14 +578,18 @@
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
"
%{
- if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */
- RETURN (__mkSmallInteger(64));
+ if (sizeof(LONGFLOAT) == 10) {
+ RETURN (__mkSmallInteger(64)); /* i386 - WIN32 */
+ }
+ if (sizeof(LONGFLOAT) == 12) {
+ RETURN (__mkSmallInteger(64)); /* i386 */
}
- if (sizeof(LONGFLOAT) == 12) { /* i386 */
- RETURN (__mkSmallInteger(64));
- }
- if (sizeof(LONGFLOAT) == 16) { /* sparc */
- RETURN (__mkSmallInteger(112));
+ if (sizeof(LONGFLOAT) == 16) {
+#ifdef __x86_64__
+ RETURN (__mkSmallInteger(64)); /* amd64 */
+#else
+ RETURN (__mkSmallInteger(112)); /* sparc */
+#endif
}
%}.
"systems without longFloat support use doubles instead"
@@ -590,6 +603,15 @@
"
!
+precision
+ "answer the precision of a LongFloat (in bits)
+ This is an IEEE float, where only the fraction from the normalized mantissa is stored
+ and so there is a hidden bit and the mantissa is actually represented by 64 binary digits
+ (although only 63 are needed in the binary representation)"
+
+ ^ 64
+!
+
radix
"answer the radix of a LongFloats exponent
This is an IEEE float, which is represented as binary"
@@ -2670,11 +2692,11 @@
!LongFloat class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.78 2013-03-31 20:46:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.79 2013-05-21 20:45:20 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.78 2013-03-31 20:46:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.79 2013-05-21 20:45:20 cg Exp $'
! !