?

Average Error: 0.1 → 0.1
Time: 10.7s
Precision: binary64
Cost: 19520

?

\[x \cdot \cos y + z \cdot \sin y \]
\[\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right) \]
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (fma x (cos y) (* z (sin y))))
double code(double x, double y, double z) {
	return (x * cos(y)) + (z * sin(y));
}
double code(double x, double y, double z) {
	return fma(x, cos(y), (z * sin(y)));
}
function code(x, y, z)
	return Float64(Float64(x * cos(y)) + Float64(z * sin(y)))
end
function code(x, y, z)
	return fma(x, cos(y), Float64(z * sin(y)))
end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x * N[Cos[y], $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y + z \cdot \sin y
\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right)

Error?

Derivation?

  1. Initial program 0.1

    \[x \cdot \cos y + z \cdot \sin y \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right)} \]
    Proof

    [Start]0.1

    \[ x \cdot \cos y + z \cdot \sin y \]

    fma-def [=>]0.1

    \[ \color{blue}{\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right)} \]
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \cos y, z \cdot \sin y\right) \]

Alternatives

Alternative 1
Error0.1
Cost13248
\[z \cdot \sin y + x \cdot \cos y \]
Alternative 2
Error10.1
Cost7250
\[\begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+91} \lor \neg \left(z \leq -6 \cdot 10^{-13}\right) \land \left(z \leq -1.2 \cdot 10^{-131} \lor \neg \left(z \leq 1.4 \cdot 10^{-36}\right)\right):\\ \;\;\;\;x + z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \cos y\\ \end{array} \]
Alternative 3
Error16.3
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-8} \lor \neg \left(y \leq 0.001\right):\\ \;\;\;\;z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 4
Error16.2
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-82} \lor \neg \left(x \leq 6 \cdot 10^{-111}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \sin y\\ \end{array} \]
Alternative 5
Error37.3
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{-207}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-220}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error30.8
Cost320
\[x + y \cdot z \]
Alternative 7
Error38.8
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023046 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Transform:aboutY from diagrams-lib-1.3.0.3"
  :precision binary64
  (+ (* x (cos y)) (* z (sin y))))