On Sat, 25 Mar 2017 09:50:46 -0400, "J.P. Grossman" <jpg@alum.mit.edu> wrote:
Could you expand on what "flaws, defects, and failures" you found? Also, did you use es = 1 or es = 3?
I can vary size and es arbitrarily. For every operation, my implementation converts posits to IEEE doubles, performs the operation, and converts the result back to a posit by figuring out the number of fraction bits based on the exponent, and rounding the scaled fraction to an integer. For very large numbers, when the number of fraction bits is 0, and the exponent may have to be rounded as well, the results may be wrong. I'll have to look further for that; but I doubt if it would have made any difference for this test. (In the following, I'm quoting tersely, as I'm retyping from my work laptop which is a walled garden, but I've verified the signs of all numbers and exponents). For Posit<32,3>: 27 significant digits found Addition/Subtraction neither rounds nor chops. Sticky bit used incorrectly or not at all. FLAW: lack(s) of guard digits or failure(s) to correctly round or chop. Square root is neither chopped nor correctly rounded. Observed errors run from -5.0e-01 to 8.5e+00 ulps. SERIOUS DEFECT: sqrt gets too many last digits wrong. FAILURE: multiplication gets too many last digits wrong. FLAW: Underflow can stick at an allegedly positive value PseudZero that prints out as 2.37389e-66 [according to Gistafson, the above is not a flaw, we'll discount that - LB] Since comparison denies Z = 0, evaluating (Z+Z)/Z should be safe. What the machine gets for (Z+Z)/Z is 1.0e+00 This is a DEFECT. FAILURE: Comparisons involving +--5.26561e+64, +-1.05312e+65 and +-9.49557e-66 are confused by Overflow. SERIOUS DEFECT: Comparison alleges that Z = -5.265615e+64 is too far from sqrt(Z) ^ 2 (2.49999985098838806e-01). [the above I don't understand; the sign seems to be wrong] DEFECT: Badly unbalanced range; UfThold * V = -5.0e-01 is too far from 1. Using Posit<32,1> adds one defect and one serious defect: SERIOUS DEFECT: Range is too narrow, U1^4 Underflows. [U1 is min x : 1-x not equal to 1] DEFECT: computing 5.0e+00 ^ 1.1e+01 yielded 4.8827904e+07 which compared unequal to correct 4.8828416e+07; they differ by -5.12e+02 Indeed, the precision loss with increasing exponent is too sharp in Posit<32,1>. Leo