sysinfo/fp68k.txt misc. 68881/882/040 FPU info IEEE floating point types subnormal Real, 0 mantissa integer bit. denormal Normal exp (not 0/subnormal/INF/NaN), but integer bit is 0. The Intel FPU does not handle this. normal Real, above exp floor, '1.' integer in mantissa; 1.0 is at 1/2 valid range, 3F8/3FF/3FFF8 (S/D/X). INF Infinite - at exp ceiling, all zeroes following. NaN Not-a-Number - at exp ceiling, signal(quiet) bit, non-zero man. Sizes, '1.' integer implied single/S 32 bits: sign.1 exp.8 man.23; 24 total bits mantissa double/D 64 bits: sign.1 exp.11 man.52; 53 total bits mantissa Sizes, integer-explicit extended/X 80 bits: sign.1 exp.15 man.64; 64 total bits mantissa long double 96 bits: two unused bytes after exp for 32-bit alignment packed decimal 96 bits Format (17-digit mantissa) S = man sign E = exp sign C = control X = exp M = man SECC XXXX XXXX XXXX TTTT CCCC CCCC MMMM MMMM ... Glue Apple/IBM PowerPC (deprecated) double double 128 bits: sum high+low >105 total bits mantissa Various exceptions - most can be turned off index bit name 14? 2 bad format 48 1 unordered condition 49 3 inexact error 50 4 divide by zero 51 5 underflow error 52 7 operand error 53 6 overflow error 54 0 signaling NAN 55 n/a unimplemented data type FPSR conditional predication bitmask #4 IEEE non-aware #3 NaN (unordered) #2 Negative #1 Positive (no condition bits on) #0 Zero Rounding The 68881 has the same rounding and precision modes (S/D/X) as Intel. Unlike Intel, the 68881 makes use of three rounding bits for accuracy. These are: Guard, Round and Sticky. The FPU rounds when storing (FPx). NaN load values NOTE: FPSP in NetBSD does not set this (t_operr) 001 root - sign copied at first 002 add/subtract 004 divide 008 multiply 009 modulo (SANE) 033 sin/cos/tan (SANE) 034 acos/asin (math lib) 036 logarithm (SANE) 037 power (SANE) 038 compund/annuity (non-NCEG) 042 gamma (SANE) 255 std QNaN/initial (all ones positive) Add/Subtract NaN order INF-INF -NAN(002) INF+-INF NAN(002) Quirks sqrt(-0) Intel result: -0; same on 68881? Various SANE Functions (in interpreter) ::exp2(double_t n) { !isfinite(n) ? n >; n>=16384 ? INF >; n|0==>x; n-=x; n*n ==> s oddpoly(n,s,-1.523098106341779462e-5, .02665544475689997673, 18.97838386125113054, 1372.201370995018779) ==> n scalb(2*n/((s+213.2829591390430817)*s +3959.336226071100526-n)+1,x) } ::log2(n) { !isfinite(n) ? n >; n<=0 ? n ? -nan(36):-INF >; nexp(n) ==> e; nfra(n) ==> n if (n<.7071067811865475355) ## .5~/2 {n+=n; e-=1} n-=1 =0 ? e >; n/= n+2; n*n ==> s oddpoly(n,s,.002827064759880235567, .01818284789116497536, .1077109054851084084, 1.247016105029232686, -6.419405568907133719, 5.641063644979311328) /((s-2.8764776622921654)*s +1.955043680438308967)+e } ::log10(n) { log2(n)/3.3219280948873623478 ## log2(10) } ::tanh(n) { ##sinh(n)/cosh(n) !isfinite(n) ? n >; n<=4e-10 ? 0 >; ##2**-31 n>16 ? 1 >; exp1(-n*2) ==> r copysign(r/(r+2),n) } ## the rest are incomplete ::sin(n) { +n=NaN ? n >; +n=INF ? sNaN(n,33) >; frem(n,2*pi) ==> n >=pi ? -sin(n-pi) >; n>=pi/2 ? cos(n-(pi/2)) >; oddpoly(n,n*n,..) } ## cos(n) is sin(pi/2+n) ::cos(n) { +n=NaN ? n >; +n=INF ? sNaN(n,33) >; +frem(n,2*pi) ==> n evenpoly(n,n*n,..) } ::tan(n) { ## !isfinite(n) ==> nan(33) sin(n)/cos(n) } ::asin(n) { atan(n/sqrt(1-n*n)) } ::acos(n) atan(sqrt(1-n*n)/n) } ::sinh(n) { exp(n)/2-exp(-n)/2 } ::cosh(n) { exp(n)/2+exp(-n)/2 }