![]() So you might think that the latter gives the shortest string representation in this case. If we round x to 17 significant digits we get 5.9604644775390625e-08, which does round back to x. If we round x to 16 significant digits we get 5.960464477539062e-08, which does not round back to x. ![]() For an example of a weird corner case, consider x = 1 / 2**24. Note that there are some subtleties here: it is not true that the value of shortest string defined above is always the same as the result of rounding x to a suitable number of decimal digits. These requirements uniquely determine the value of repr(x), though they don’t uniquely determine the form: e.g., they leave open whether to express the repr of 1_0000_0000_0000_0000.0 as 10000000000000000.0 or as 1000000000000000. if there are two equally close values, the one with even last digit must be chosen.if there’s more than one such shortest value, the closest to x must be chosen.for a given positive float x, the value of repr(x) must be the shortest (in the sense of the “length” just defined) decimal value that rounds back to x under the round-ties-to-even rounding mode.define the “length” of a positive decimal value d as the smallest positive integer f such that d can be written in the form d = m * 10**e, with m and e integers and m It’s not 100% clear to me what sort of docs you’re looking for here. I’m new to these things and unsure about some details, can you help me with a link to appr.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |