LongFloat.st
changeset 16780 f5458df271ed
parent 16662 81b5f9f4b0b8
child 17108 8be2937c7fb7
equal deleted inserted replaced
16779:148f0fa5ad67 16780:f5458df271ed
   498     "answer the number of bits in the exponent
   498     "answer the number of bits in the exponent
   499      i386: This is an 80bit longfloat stored in 96 bits (upper 16 bits are unused),
   499      i386: This is an 80bit longfloat stored in 96 bits (upper 16 bits are unused),
   500            where 15 bits are available in the exponent (i bit is ignored):
   500            where 15 bits are available in the exponent (i bit is ignored):
   501         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   501         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   502      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   502      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   503            where 1+63 bits are available in the mantissa:
   503            where 15 bits are available in the exponent:
   504         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   504         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   505     "
   505      sparc & others: This is an 128bit longfloat,
   506 %{
   506            where 15 bits are available in the exponent:
   507     if (sizeof(LONGFLOAT) == 10) {
   507         00000000 00000000 seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm ...
   508         RETURN (__mkSmallInteger(15));  /* i386 - WIN32 */
   508     "
   509     }
   509 %{  /* NOCONTEXT */
   510     if (sizeof(LONGFLOAT) == 12) {
   510 #if defined(__x86__) || defined(__x86_64__)
   511         RETURN (__mkSmallInteger(15));  /* i386 */
   511     if (sizeof(LONGFLOAT) == 10) {      /* i386 - WIN32: 80bit floats */ 
   512     }
   512         RETURN (__mkSmallInteger(15));  
       
   513     }
       
   514     if (sizeof(LONGFLOAT) == 12) {      /* i386 - some unixes: 96bit floats */
       
   515         RETURN (__mkSmallInteger(15));  
       
   516     }
       
   517     if (sizeof(LONGFLOAT) == 16) {      /* amd64, i386-64bit */
       
   518         RETURN (__mkSmallInteger(15));  
       
   519     }
       
   520 #else
   513     if (sizeof(LONGFLOAT) == 16) {
   521     if (sizeof(LONGFLOAT) == 16) {
   514 #ifdef __x86_64__
       
   515         RETURN (__mkSmallInteger(15));  /* amd64, i386-64bit */
       
   516 #else
       
   517         RETURN (__mkSmallInteger(15));  /* sparc */
   522         RETURN (__mkSmallInteger(15));  /* sparc */
   518 #endif
   523     }
   519     }
   524 #endif
   520 %}.
   525 %}.
   521     "systems without longFloat support use doubles instead"
   526     "systems without longFloat support use doubles instead"
   522     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   527     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   523         ^ Float numBitsInExponent
   528         ^ Float numBitsInExponent
   524     ].
   529     ].
   535            where 1 bit is used for the integer part in the mantissa:
   540            where 1 bit is used for the integer part in the mantissa:
   536         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   541         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   537      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   542      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   538            where 1+63 bits are available in the mantissa:
   543            where 1+63 bits are available in the mantissa:
   539         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   544         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   540     "
   545      sparc & others: This is an 128bit longfloat,
   541 %{
   546            where 112 bits are available in the mantissa:
   542     if (sizeof(LONGFLOAT) == 10) {
   547         00000000 00000000 seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm ...
   543         RETURN (__mkSmallInteger(1));   /* i386 - WIN32 */
   548     "
   544     }
   549 %{  /* NOCONTEXT */
   545     if (sizeof(LONGFLOAT) == 12) {
   550 #if defined(__x86__) || defined(__x86_64__)
   546         RETURN (__mkSmallInteger(1));   /* i386 */
   551     if (sizeof(LONGFLOAT) == 10) {      /* i386 - WIN32: 80bit floats */
       
   552         RETURN (__mkSmallInteger(1));   
       
   553     }
       
   554     if (sizeof(LONGFLOAT) == 12) {      /* i386 - some other unixes: 96bit floats*/ 
       
   555         RETURN (__mkSmallInteger(1));   
   547     }
   556     }
   548     if (sizeof(LONGFLOAT) == 16) {
   557     if (sizeof(LONGFLOAT) == 16) {
   549 #ifdef __x86_64__
   558         RETURN (__mkSmallInteger(1));   /* amd64, i386-64bit */
   550         RETURN (__mkSmallInteger(1));   /* amd64 */
   559     }
   551 #else
   560 #else
       
   561     if (sizeof(LONGFLOAT) == 16) {
   552         RETURN (__mkSmallInteger(0));   /* sparc */
   562         RETURN (__mkSmallInteger(0));   /* sparc */
   553 #endif
   563     }
   554     }
   564 #endif
   555 %}.
   565 %}.
   556     "systems without longFloat support use doubles instead"
   566     "systems without longFloat support use doubles instead"
   557     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   567     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   558         ^ Float numBitsInIntegerPart
   568         ^ Float numBitsInIntegerPart
   559     ].
   569     ].
   571         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   581         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   572      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   582      x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
   573            where 1+63 bits are available in the mantissa:
   583            where 1+63 bits are available in the mantissa:
   574         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   584         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   575      sparc: This is an 128bit longfloat,
   585      sparc: This is an 128bit longfloat,
   576            where 1+112 bits are available in the mantissa:
   586            where 112 bits are available in the mantissa:
   577         00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   587         00000000 00000000 seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
   578     "
   588     "
   579 %{
   589 %{  /* NOCONTEXT */
   580     if (sizeof(LONGFLOAT) == 10) {
   590 #if defined(__x86__) || defined(__x86_64__)
   581         RETURN (__mkSmallInteger(63));  /* i386 - WIN32 */
   591     if (sizeof(LONGFLOAT) == 10) {      /* i386 - WIN32: 80bit */
   582     }
   592         RETURN (__mkSmallInteger(64));  
   583     if (sizeof(LONGFLOAT) == 12) {
   593     }
   584         RETURN (__mkSmallInteger(63));  /* i386 */
   594     if (sizeof(LONGFLOAT) == 12) {      /* i386 some unixes: 96bit */
       
   595         RETURN (__mkSmallInteger(64));  
   585     }
   596     }
   586     if (sizeof(LONGFLOAT) == 16) {
   597     if (sizeof(LONGFLOAT) == 16) {
   587 #ifdef __x86_64__
   598         RETURN (__mkSmallInteger(64));  /* amd64, i386-64bit */
   588         RETURN (__mkSmallInteger(63));  /* amd64 */
   599     }
   589 #else
   600 #else
       
   601     if (sizeof(LONGFLOAT) == 16) {
   590         RETURN (__mkSmallInteger(112)); /* sparc */
   602         RETURN (__mkSmallInteger(112)); /* sparc */
   591 #endif
   603     }
   592     }
   604 #endif
   593 %}.
   605 %}.
   594     "systems without longFloat support use doubles instead"
   606     "systems without longFloat support use doubles instead"
   595     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   607     self basicNew basicSize == Float basicNew basicSize ifTrue:[
   596         ^ Float numBitsInMantissa
   608         ^ Float numBitsInMantissa
   597     ].
   609     ].
  2689 ! !
  2701 ! !
  2690 
  2702 
  2691 !LongFloat class methodsFor:'documentation'!
  2703 !LongFloat class methodsFor:'documentation'!
  2692 
  2704 
  2693 version
  2705 version
  2694     ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.83 2014-06-30 14:20:31 stefan Exp $'
  2706     ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.84 2014-07-17 11:54:05 cg Exp $'
  2695 !
  2707 !
  2696 
  2708 
  2697 version_CVS
  2709 version_CVS
  2698     ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.83 2014-06-30 14:20:31 stefan Exp $'
  2710     ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.84 2014-07-17 11:54:05 cg Exp $'
  2699 ! !
  2711 ! !
  2700 
  2712 
  2701 
  2713 
  2702 LongFloat initialize!
  2714 LongFloat initialize!