The purpose of the modified compute_shortest in the paper, if I'm not mistaken, is to find an integer within the interval (a, c) with the fewest amount of significant figures and also closest to b, all properly rounded. Whether or not a and c are included in the interval is indicated by the accept_smaller and accept_larger boolean flags respectively.
So compute_shortest(a=1123, b=1234, c=1301, accept_smaller=false, accept_larger=false) would return (12, 2) indicating 12*10^2 = 1200, which is indeed within the interval (1123, 1301) and close to 1234.
What I'm confused about is something like compute_shortest(a=1000, b=1007, c=1234, accept_smaller=false, accept_larger=false). This would give (10, 2) which maps to 1000, but the lower bound a should be excluded, right?
It's this particular sentence in the proof of the modified compute_shortest that's flying over my head, where it is stated:
A return value of b_{i} is therefore legal if and only if a_{i} != b_{i} or all_a_zero_{i} is true, ...
Why would b_{i} be legal just because all the digits truncated off of a were zeros?
Any clarifications here would be appreciated, thanks.
The purpose of the modified
compute_shortestin the paper, if I'm not mistaken, is to find an integer within the interval(a, c)with the fewest amount of significant figures and also closest tob, all properly rounded. Whether or notaandcare included in the interval is indicated by theaccept_smallerandaccept_largerboolean flags respectively.So
compute_shortest(a=1123, b=1234, c=1301, accept_smaller=false, accept_larger=false)would return(12, 2)indicating 12*10^2 = 1200, which is indeed within the interval (1123, 1301) and close to 1234.What I'm confused about is something like
compute_shortest(a=1000, b=1007, c=1234, accept_smaller=false, accept_larger=false). This would give(10, 2)which maps to 1000, but the lower boundashould be excluded, right?It's this particular sentence in the proof of the modified
compute_shortestthat's flying over my head, where it is stated:Why would
b_{i}be legal just because all the digits truncated off ofawere zeros?Any clarifications here would be appreciated, thanks.