モデルtax/Sales_Total_Quote_Taxには_deltaRound()、価格を四捨五入する方法があります。0.5を丸めるときに非決定的な動作を停止するために、小さなデルタを追加します。
/**
 * Round price based on previous rounding operation delta
 *
 * @param float $price
 * @param string $rate
 * @param bool $direction price including or excluding tax
 * @param string $type
 * @return float
 */
protected function _deltaRound($price, $rate, $direction, $type = 'regular')
{
    if ($price) {
        $rate = (string)$rate;
        $type = $type . $direction;
        // initialize the delta to a small number to avoid non-deterministic behavior with rounding of 0.5
        $delta = isset($this->_roundingDeltas[$type][$rate]) ? $this->_roundingDeltas[$type][$rate] : 0.000001;
        $price += $delta;
        $this->_roundingDeltas[$type][$rate] = $price - $this->_calculator->round($price);
        $price = $this->_calculator->round($price);
    }
    return $price;
}ただし、デルタは保存されます。そのような保存されたデルタが見つからない場合、それを構成します。どうして?私が知る限り、tarは同じ操作で異なる結果につながります。
$priceの3.595 があり、cachedがないとし$deltaます。メソッドを実行すると、$ delta = 0.000001が取得されます。次に、$price= 3.595001 $deltaを取得します。これは3.60に丸められるため、新しい-0.004999があります。そして、3.60を返します。
今以外はデルタがあるので、$price= 3.595 でもう一度やりましょう。$price= 3.595-0.004999 = 3.590001
丸めると3.59になります。さまざまな答え。
使用される丸めアルゴリズムは、少なくとも同じ引数で実行されるたびに同じ答えを返す必要がありますが、今回はそうではないようです。
