equal
deleted
inserted
replaced
482 where 15 bits are available in the exponent (i bit is ignored): |
482 where 15 bits are available in the exponent (i bit is ignored): |
483 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
483 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
484 " |
484 " |
485 %{ |
485 %{ |
486 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
486 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
487 RETURN (__MKSMALLINT(15)); |
487 RETURN (__mkSmallInteger(15)); |
488 } |
488 } |
489 if (sizeof(LONGFLOAT) == 12) { /* i386 */ |
489 if (sizeof(LONGFLOAT) == 12) { /* i386-32bit */ |
490 RETURN (__MKSMALLINT(15)); |
490 RETURN (__mkSmallInteger(15)); |
491 } |
491 } |
492 if (sizeof(LONGFLOAT) == 16) { /* sparc */ |
492 if (sizeof(LONGFLOAT) == 16) { /* sparc, i386-64bit */ |
493 RETURN (__MKSMALLINT(15)); |
493 RETURN (__mkSmallInteger(15)); |
494 } |
494 } |
495 %}. |
495 %}. |
496 "systems without longFloat support use doubles instead" |
496 "systems without longFloat support use doubles instead" |
497 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
497 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
498 ^ Float numBitsInExponent |
498 ^ Float numBitsInExponent |
510 where 1 bit is used for the integer part in the mantissa: |
510 where 1 bit is used for the integer part in the mantissa: |
511 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
511 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
512 " |
512 " |
513 %{ |
513 %{ |
514 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
514 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
515 RETURN (__MKSMALLINT(1)); |
515 RETURN (__mkSmallInteger(1)); |
516 } |
516 } |
517 if (sizeof(LONGFLOAT) == 12) { /* i386 */ |
517 if (sizeof(LONGFLOAT) == 12) { /* i386 */ |
518 RETURN (__MKSMALLINT(1)); |
518 RETURN (__mkSmallInteger(1)); |
519 } |
519 } |
520 if (sizeof(LONGFLOAT) == 16) { /* sparc */ |
520 if (sizeof(LONGFLOAT) == 16) { /* sparc */ |
521 RETURN (__MKSMALLINT(0)); |
521 RETURN (__mkSmallInteger(0)); |
522 } |
522 } |
523 %}. |
523 %}. |
524 "systems without longFloat support use doubles instead" |
524 "systems without longFloat support use doubles instead" |
525 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
525 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
526 ^ Float numBitsInIntegerPart |
526 ^ Float numBitsInIntegerPart |
541 where 1+112 bits are available in the mantissa: |
541 where 1+112 bits are available in the mantissa: |
542 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
542 00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm |
543 " |
543 " |
544 %{ |
544 %{ |
545 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
545 if (sizeof(LONGFLOAT) == 10) { /* i386 - WIN32 */ |
546 RETURN (__MKSMALLINT(64)); |
546 RETURN (__mkSmallInteger(64)); |
547 } |
547 } |
548 if (sizeof(LONGFLOAT) == 12) { /* i386 */ |
548 if (sizeof(LONGFLOAT) == 12) { /* i386 */ |
549 RETURN (__MKSMALLINT(64)); |
549 RETURN (__mkSmallInteger(64)); |
550 } |
550 } |
551 if (sizeof(LONGFLOAT) == 16) { /* sparc */ |
551 if (sizeof(LONGFLOAT) == 16) { /* sparc */ |
552 RETURN (__MKSMALLINT(112)); |
552 RETURN (__mkSmallInteger(112)); |
553 } |
553 } |
554 %}. |
554 %}. |
555 "systems without longFloat support use doubles instead" |
555 "systems without longFloat support use doubles instead" |
556 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
556 self basicNew basicSize == Float basicNew basicSize ifTrue:[ |
557 ^ Float numBitsInMantissa |
557 ^ Float numBitsInMantissa |
675 |
675 |
676 OBJ newFloat; |
676 OBJ newFloat; |
677 LONGFLOAT result, val; |
677 LONGFLOAT result, val; |
678 |
678 |
679 if (__isSmallInteger(aNumber)) { |
679 if (__isSmallInteger(aNumber)) { |
680 if (aNumber != __MKSMALLINT(0)) { |
680 if (aNumber != __mkSmallInteger(0)) { |
681 result = __longFloatVal(self) / (LONGFLOAT)(__intVal(aNumber)); |
681 result = __longFloatVal(self) / (LONGFLOAT)(__intVal(aNumber)); |
682 retResult: |
682 retResult: |
683 __qMKLFLOAT(newFloat, result); |
683 __qMKLFLOAT(newFloat, result); |
684 RETURN ( newFloat ); |
684 RETURN ( newFloat ); |
685 } |
685 } |
824 fVal = __longFloatVal(self); |
824 fVal = __longFloatVal(self); |
825 #ifdef WIN32 |
825 #ifdef WIN32 |
826 if (! isnanl(fVal)) |
826 if (! isnanl(fVal)) |
827 #endif |
827 #endif |
828 if ((fVal >= (LONGFLOAT)_MIN_INT) && (fVal <= (LONGFLOAT)_MAX_INT)) { |
828 if ((fVal >= (LONGFLOAT)_MIN_INT) && (fVal <= (LONGFLOAT)_MAX_INT)) { |
829 RETURN ( __MKSMALLINT( (INT)fVal) ); |
829 RETURN ( __mkSmallInteger( (INT)fVal) ); |
830 } |
830 } |
831 %}. |
831 %}. |
832 ^ super asInteger |
832 ^ super asInteger |
833 |
833 |
834 " |
834 " |
1531 */ |
1531 */ |
1532 if (__isSmallInteger(index)) { |
1532 if (__isSmallInteger(index)) { |
1533 indx = __intVal(index) - 1; |
1533 indx = __intVal(index) - 1; |
1534 if (((unsigned)(indx)) < sizeof(LONGFLOAT)) { |
1534 if (((unsigned)(indx)) < sizeof(LONGFLOAT)) { |
1535 cp = (unsigned char *)(& (__LongFloatInstPtr(self)->f_longfloatvalue)); |
1535 cp = (unsigned char *)(& (__LongFloatInstPtr(self)->f_longfloatvalue)); |
1536 RETURN ( __MKSMALLINT(cp[indx] & 0xFF) ); |
1536 RETURN ( __mkSmallInteger(cp[indx] & 0xFF) ); |
1537 } |
1537 } |
1538 } |
1538 } |
1539 %}. |
1539 %}. |
1540 ^ self indexNotIntegerOrOutOfBounds:index |
1540 ^ self indexNotIntegerOrOutOfBounds:index |
1541 ! |
1541 ! |
1600 To hide this at one place, this method knows about that, and returns |
1600 To hide this at one place, this method knows about that, and returns |
1601 values as if this filler wasnt present." |
1601 values as if this filler wasnt present." |
1602 |
1602 |
1603 %{ /* NOCONTEXT */ |
1603 %{ /* NOCONTEXT */ |
1604 |
1604 |
1605 RETURN (__MKSMALLINT(sizeof(LONGFLOAT))); |
1605 RETURN (__mkSmallInteger(sizeof(LONGFLOAT))); |
1606 %}. |
1606 %}. |
1607 ! ! |
1607 ! ! |
1608 |
1608 |
1609 !LongFloat methodsFor:'special access'! |
1609 !LongFloat methodsFor:'special access'! |
1610 |
1610 |
1618 |
1618 |
1619 %{ /* NOCONTEXT */ |
1619 %{ /* NOCONTEXT */ |
1620 |
1620 |
1621 #if defined(LONG_frexp) |
1621 #if defined(LONG_frexp) |
1622 LONGFLOAT LONG_frexp(); |
1622 LONGFLOAT LONG_frexp(); |
1623 INT exp; |
1623 int exp; |
1624 |
1624 |
1625 __threadErrno = 0; |
1625 __threadErrno = 0; |
1626 LONG_frexp( __longFloatVal(self), &exp); |
1626 LONG_frexp( __longFloatVal(self), &exp); |
1627 if (__threadErrno == 0) { |
1627 if (__threadErrno == 0) { |
1628 RETURN (__MKSMALLINT(exp)); |
1628 RETURN (__mkSmallInteger(exp)); |
1629 } |
1629 } |
1630 #endif |
1630 #endif |
1631 %}. |
1631 %}. |
1632 ^ super exponent |
1632 ^ super exponent |
1633 |
1633 |
1721 typically, 80 or 96 is returned here, |
1721 typically, 80 or 96 is returned here, |
1722 but who knows ..." |
1722 but who knows ..." |
1723 |
1723 |
1724 %{ /* NOCONTEXT */ |
1724 %{ /* NOCONTEXT */ |
1725 |
1725 |
1726 RETURN (__MKSMALLINT (sizeof(LONGFLOAT) * 8)); |
1726 RETURN (__mkSmallInteger (sizeof(LONGFLOAT) * 8)); |
1727 %} |
1727 %} |
1728 |
1728 |
1729 " |
1729 " |
1730 LongFloat basicNew numberOfBits |
1730 LongFloat basicNew numberOfBits |
1731 1.2 asLongFloat numberOfBits |
1731 1.2 asLongFloat numberOfBits |
2256 #if defined(LONG_ceil) |
2256 #if defined(LONG_ceil) |
2257 LONGFLOAT lVal; |
2257 LONGFLOAT lVal; |
2258 |
2258 |
2259 lVal = LONG_ceil(__longFloatVal(self)); |
2259 lVal = LONG_ceil(__longFloatVal(self)); |
2260 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2260 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2261 RETURN ( __MKSMALLINT( (INT) lVal ) ); |
2261 RETURN ( __mkSmallInteger( (INT) lVal ) ); |
2262 } |
2262 } |
2263 __qMKLFLOAT(val, lVal); |
2263 __qMKLFLOAT(val, lVal); |
2264 #endif |
2264 #endif |
2265 %}. |
2265 %}. |
2266 val notNil ifTrue:[ |
2266 val notNil ifTrue:[ |
2308 #if defined(LONG_floor) |
2308 #if defined(LONG_floor) |
2309 LONGFLOAT lVal; |
2309 LONGFLOAT lVal; |
2310 |
2310 |
2311 lVal = LONG_floor(__longFloatVal(self)); |
2311 lVal = LONG_floor(__longFloatVal(self)); |
2312 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2312 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2313 RETURN ( __MKSMALLINT( (INT) lVal ) ); |
2313 RETURN ( __mkSmallInteger( (INT) lVal ) ); |
2314 } |
2314 } |
2315 __qMKLFLOAT(val, lVal); |
2315 __qMKLFLOAT(val, lVal); |
2316 #endif |
2316 #endif |
2317 %}. |
2317 %}. |
2318 val notNil ifTrue:[ |
2318 val notNil ifTrue:[ |
2367 } |
2367 } |
2368 /* |
2368 /* |
2369 * ST-80 (and X3J20) returns integer. |
2369 * ST-80 (and X3J20) returns integer. |
2370 */ |
2370 */ |
2371 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2371 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2372 RETURN ( __MKSMALLINT( (INT) lVal ) ); |
2372 RETURN ( __mkSmallInteger( (INT) lVal ) ); |
2373 } |
2373 } |
2374 __qMKLFLOAT(v, lVal); |
2374 __qMKLFLOAT(v, lVal); |
2375 RETURN (v); |
2375 RETURN (v); |
2376 #endif |
2376 #endif |
2377 %}. |
2377 %}. |
2429 |
2429 |
2430 /* |
2430 /* |
2431 * ST-80 (and X3J20) returns integer. |
2431 * ST-80 (and X3J20) returns integer. |
2432 */ |
2432 */ |
2433 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2433 if ((lVal >= (LONGFLOAT)_MIN_INT) && (lVal <= (LONGFLOAT)_MAX_INT)) { |
2434 RETURN ( __MKSMALLINT( (INT) lVal ) ); |
2434 RETURN ( __mkSmallInteger( (INT) lVal ) ); |
2435 } |
2435 } |
2436 __qMKLFLOAT(val, lVal); |
2436 __qMKLFLOAT(val, lVal); |
2437 #endif |
2437 #endif |
2438 %}. |
2438 %}. |
2439 val notNil ifTrue:[ |
2439 val notNil ifTrue:[ |
2482 ! ! |
2482 ! ! |
2483 |
2483 |
2484 !LongFloat class methodsFor:'documentation'! |
2484 !LongFloat class methodsFor:'documentation'! |
2485 |
2485 |
2486 version |
2486 version |
2487 ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.50 2005-01-25 14:51:17 cg Exp $' |
2487 ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.51 2005-07-08 17:15:01 cg Exp $' |
2488 ! ! |
2488 ! ! |
2489 |
2489 |
2490 LongFloat initialize! |
2490 LongFloat initialize! |