On 11/7/2019 9:31 PM, Eduardo Habkost wrote:
On Thu, Nov 07, 2019 at 02:24:52PM +0800, Tao Xu wrote:
On 11/7/2019 4:53 AM, Eduardo Habkost wrote:
On Mon, Oct 28, 2019 at 03:52:12PM +0800, Tao Xu wrote:
Add tests for time input such as zero, around limit of precision,
signed upper limit, actual upper limit, beyond limits, time suffixes,
and etc.

Signed-off-by: Tao Xu <tao3...@intel.com>
---
[...]
+    /* Close to signed upper limit 0x7ffffffffffffc00 (53 msbs set) */
+    qdict = keyval_parse("time1=9223372036854774784," /* 7ffffffffffffc00 */
+                         "time2=9223372036854775295", /* 7ffffffffffffdff */
+                         NULL, &error_abort);
+    v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
+    qobject_unref(qdict);
+    visit_start_struct(v, NULL, NULL, 0, &error_abort);
+    visit_type_time(v, "time1", &time, &error_abort);
+    g_assert_cmphex(time, ==, 0x7ffffffffffffc00);
+    visit_type_time(v, "time2", &time, &error_abort);
+    g_assert_cmphex(time, ==, 0x7ffffffffffffc00);

I'm confused by this test case and the one below[1].  Are these
known bugs?  Shouldn't we document them as known bugs?

Because do_strtosz() or do_strtomul() actually parse with strtod(), so the
precision is 53 bits, so in these cases, 7ffffffffffffdff and
fffffffffffffbff are rounded.

My questions remain: why isn't this being treated like a bug?

Hi Markus,

I am confused about the code here too. Because in do_strtosz(), the upper limit is

val * mul >= 0xfffffffffffffc00

So some data near 53 bit may be rounded. Is there a bug?

Reply via email to