bt2: use `_extract_value()` on comparison
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 27 Jun 2019 23:38:59 +0000 (19:38 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jun 2019 02:47:25 +0000 (22:47 -0400)
After further discussions, we realized that there was a better way to
address the issue that commit 7bb4180 is fixing.

The real issue was that we were unconditionally converting the `other`
object to the `complex` type even when neither objects were of the
`complex` type. This was causing problem because of the lost of
precision when storing very large integer value in a variable of
`complex` type.

The better solution is to convert both objects to the type of the wider
object, and that is what Python does automatically. To enable that, we
simply need to convert the `other` object to it's corresponding standard
numeric type [1]. This commit uses the existing `_extract_value()`
method to achieve that.

[1]: https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib658d1fdaf41a0ee592212a101fa4ad0ea952eb4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1561
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>

No differences found
This page took 0.025797 seconds and 4 git commands to generate.