DOMjudge / checktestdata

checks integrity of test data in programming contests like the ACM ICPC
Other
22 stars 25 forks source link

Specifying precision of reals #5

Closed austrin closed 7 years ago

austrin commented 7 years ago

Feature request: for the FLOAT command, it would be very good if it was possible to specify the number of allowed digits after the decimal point, since input specifications are not really complete without such bounds. It should then be possible both to specify an upper bound on the number of decimals, and an exact bound (probably it is easiest to think of it as specifying a range).

eldering commented 7 years ago

That sounds reasonable. What about the following proposal: add a new matching function FLOATP(<expr> min, <expr> max, <value> mindigits, <value> maxdigits, [, <variable> name [, option]]). Both mindigits and maxdigits must have non-negative integer values. In this case a floating point number in scientific representation must have exactly one nonzero digit before the decimal dot. Both in scientific and fixed notation, the number of digits after the decimal dot must be in the interval [mindigits,maxdigits].

austrin commented 7 years ago

On 2016-10-19 17:58, Jaap Eldering wrote:

That sounds reasonable. What about the following proposal: add a new matching function |FLOATP( min, max, mindigits, maxdigits, [,

name [, option]])|. Both |mindigits| and |maxdigits| must have non-negative integer values. In this case a floating point number in scientific representation must have exactly one nonzero digit before the decimal dot. Both in scientific and fixed notation, the number of digits after the decimal dot must be in the interval |[mindigits,maxdigits]|.

:+1:

In scientific notation, it would probably even make sense to require the digit before the decimal dot to be 0 (or alternatively, to be non-zero) -- allowing any digit doesn't quite normalize the representation but leaves a slack of 1 digit in terms of precision.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DOMjudge/checktestdata/issues/5#issuecomment-254857790, or mute the thread https://github.com/notifications/unsubscribe-auth/AIXvyTjqitNyaQtLXj55-ZfsPagUAWeWks5q1j42gaJpZM4KYahq.