Reported-by: Masatake YAMATO <yamato@redhat.com>
Addresses: https://github.com/util-linux/util-linux/pull/2531#discussion_r1373797202
Signed-off-by: Karel Zak <kzak@redhat.com>
{
int type;
int l = node_get_datatype(n->left),
- r = node_get_datatype(n->right);
+ r = node_get_datatype(n->right);
if (l == r)
type = l;
type = l;
else
type = l;
+
+ /* Always prefer float before number */
+ if (type == SCOLS_DATA_U64
+ && (r == SCOLS_DATA_FLOAT || l == SCOLS_DATA_FLOAT))
+ type = SCOLS_DATA_FLOAT;
}
DBG(FPARAM, ul_debugobj(n, " expr datatype: %d", type));