Hello,
I am currently working on a formalised implementation of posits and posit arithmetic in the Coq programming language. My hope is that this will make it possible to write computer-checkable proofs of the correctness of some numerical algorithms making use of posits.
As part of this, I need to formally specify the rounding behaviour of posits, which has proven a bit tricky. For various reasons related to Coq, it is desirable to speak of rounding as a relation, so we might say that "x ~ f" if the real number x rounds to the posit f. The difficulty, then, is how this relation ought to be specified. For the usual bankers' rounding, this isn't too bad. x rounds to f if f is the unique closest float to x, or else if it is the closest float to x with even fractional part. The issue for the variant of bankers' rounding which posits demand is precisely what "closest" means. The algorithm given for posit rounding in the standard does not always round a real number to the (Euclidean) closest posit. For instance, in the posit-8 format, the number 144179.2 is contained between the posits 65536 and 262144, but is greater than 131072, the posit-9 obtained by suffixing a 1 bit to the 8-posit 65536. As such, 144179.2 will round to 262144, in spite of the fact that this is a greater (Euclidean) distance than that to 65536. As such, it's not quite clear to me what is meant by the "closest" posit.
I could certainly just implement the rounding algorithm, but this has some undesirable properties in the context of proving theorems about posits in Coq. As such, I was hoping that there was some sense in which the rounding rules for posits could be phrased in terms of a simple mathematical property relating real numbers to posits, rather than as an algorithm for performing rounding.
Best regards,
Morgan Arnold