db Expression float precision issues?

Are there any known precision issues with yii\db\Expression?

Setting a amount of 0.0010 like in the following sample:

$this->fieldname = new Expression(’:amount’, [’:amount’ => 0.0010]);

results in 0.00001020 in the database.

$this->fieldname = $amount;

or

$this->wagered = new Expression($amount);

works fine (db value results in 0.0010).

As soon as I use the Expression $param, the value gets modified somehow (divided by 100?), how can I avoid this? The target field is a DECIMAL(20,10) field.

I’ve found the issue, it has nothing to do with the float precision.

The problem is setting an expression parameter with the same naming multiple times in a transaction.

$this->fieldA = new Expression(‘fieldA + :amount’, [’:amount’ => $amount]);

$this->fieldB = new Expression(‘fieldB + :amount’, [’:amount’ => $amount]);

If you execute this in a transaction, :amount will get overwritten.