DOMjudge/checktestdata

Specifying precision of reals

Closed this issue · 2 comments

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).

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].

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]|.

👍

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
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIXvyTjqitNyaQtLXj55-ZfsPagUAWeWks5q1j42gaJpZM4KYahq.