Blame | Last modification | View Log | Download
# extendedThis is an 80-bit float format with a 1-bit sign, 15-bit exponent and 64-bitsignificand.# Format`extended` floats are stored in little endian. The "most significant bit" issign, the next 15 bits are exponent, and the next 64 bits encode the 64-bitsignificand (note that the top bit of the significand **is** stored explicitly).The exponent is stored with a bias of +16384 (so an exponent of 0 is stored asthe literal value 16384). Like the so-called "single" format this library uses,special values +0 ,-0, +inf, -inf, and NaN are stored with an exponent of -16384(literal stored as a 0), and the sign and top two bits of the significanddetermine which special value it is.```m is significande is exponents is sign- is any value (0 or 1, doesn't matter)seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm+0 00000000 00000000 00------ -------- -------- -------- -------- -------- -------- ---------0 10000000 00000000 00------ -------- -------- -------- -------- -------- -------- --------+inf 00000000 00000000 1------- -------- -------- -------- -------- -------- -------- --------+inf 10000000 00000000 1------- -------- -------- -------- -------- -------- -------- --------NaN -0000000 00000000 01------ -------- -------- -------- -------- -------- -------- --------1 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000002 01000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000001 11000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000pi 01000000 00000001 11001001 00001111 11011010 10100010 00100001 01101000 11000010 00110101```## Input/Output```x: HL points to the first operand (if any)y: DE points to the second operand (if any)t: IX points to the third operand (if any)z: BC points to the output```There is one notable exception:* `xcmp` takes float inputs, but returns output in the zero flag and carry flag## RoutinesThese float routines are for the most part prefixed with `x` to distinguishthem from the other float routines in this library. Most of them are in theirown file, but some files contain several routines. These cases are noted in thechart below.```xabs |x|xacos acos(x)xacosh acosh(x)xadd x+yxamean (x+y)/2xasin asin(x)xasinh asinh(x)xatan atan(x)xatanh atanh(x)xbg 1/BG(x,y) (reciprocal Borchardt-Gauss mean)xcis {cos(x), sin(x)}xcmp compare x to yxcos cos(x)xcosh cosh(x)xdiv x/yxdiv2 x/2xexp e^xxfma x*y+txgeomean sqrt(x*y)xinv 1/xxlg log2(x)xln log(x) (a.k.a. ln(x))xlog log_y(x)xlog10 log10(x)xmod1 x mod 1xmul x*yxmul2 x*2 (found in the extended/mul directory)xmul3 x*3 (found in the extended/mul directory)xmul5 x*5 (found in the extended/mul directory)xmul7 x*7 (found in the extended/mul directory)xmul10 x*10 (found in the extended/mul directory)xmul11 x*11 (found in the extended/mul directory)xmul13 x*13 (found in the extended/mul directory)xmul15 x*15 (found in the extended/mul directory)xmul17 x*17 (found in the extended/mul directory)xmul31 x*31 (found in the extended/mul directory)xneg -xxpow x^yxpow2 2^xxpow10 10^xxrand random number on [0,1), uniform distributionxrsub -x+yxsin sin(x)xsinh sinh(x)xsqrt sqrt(x)xsub x-yxtan tan(x)xtanh tanh(x)strtox "string" ==> extended floatxtostr string(x)xtoTI TIFloat(x)TItox TIFloat ==> extended```## Example UsageCalculate `10^(pi+e)`:```; Add pi+eld hl, const_pild de, const_eld bc, xOP1call xadd; BC points to the output, so want to load BC into HL, then call pow10ld h, bld l, ccall xpow10; result is at BC (which is the same as HL and xOP1 here)```