From 32c97093db85c827ccbbf4cd4255190718863232 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 23 Jun 2015 22:51:24 +0100 Subject: seq: handle exponents more consistently src/seq.c (scan_arg): Set precision and width _after_ exponentiation. For example, this will make '1.1e1 12' and '11 1.2e1' equivalent. One can still set the precision by specifying extra precision on the start value, or more naturally with a precision on a step value. * tests/misc/seq-precision.sh: Add new cases. --- tests/misc/seq-precision.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/misc/seq-precision.sh') diff --git a/tests/misc/seq-precision.sh b/tests/misc/seq-precision.sh index e6a2bd7b8..b8382ca19 100755 --- a/tests/misc/seq-precision.sh +++ b/tests/misc/seq-precision.sh @@ -58,4 +58,22 @@ seq 1 .1 0x2 | head -n2 > out || fail=1 printf "%s\n" 1.0 1.1 > exp || framework_failure_ compare exp out || fail=1 +# Ensure consistent handling of precision/width for exponents + +seq 1.1e1 12 > out || fail=1 +printf "%s\n" 11 12 > exp || framework_failure_ +compare exp out || fail=1 + +seq 11 1.2e1 > out || fail=1 +printf "%s\n" 11 12 > exp || framework_failure_ +compare exp out || fail=1 + +seq -w 1.1e4 | head -n1 > out || fail=1 +printf "%s\n" 00001 > exp || framework_failure_ +compare exp out || fail=1 + +seq -w 1.10000e5 1.10000e5 > out || fail=1 +printf "%s\n" 110000 > exp || framework_failure_ +compare exp out || fail=1 + Exit $fail -- cgit v1.2.3-54-g00ecf