Average Error: 0.1 → 0.1
Time: 11.8s
Precision: binary64
Cost: 13248
\[x \cdot \cos y + z \cdot \sin y \]
\[z \cdot \sin y + x \cdot \cos y \]
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (+ (* z (sin y)) (* x (cos 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 (z * sin(y)) + (x * cos(y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * cos(y)) + (z * sin(y))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (z * sin(y)) + (x * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x * Math.cos(y)) + (z * Math.sin(y));
}
public static double code(double x, double y, double z) {
	return (z * Math.sin(y)) + (x * Math.cos(y));
}
def code(x, y, z):
	return (x * math.cos(y)) + (z * math.sin(y))
def code(x, y, z):
	return (z * math.sin(y)) + (x * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x * cos(y)) + Float64(z * sin(y)))
end
function code(x, y, z)
	return Float64(Float64(z * sin(y)) + Float64(x * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x * cos(y)) + (z * sin(y));
end
function tmp = code(x, y, z)
	tmp = (z * sin(y)) + (x * cos(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[(N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y + z \cdot \sin y
z \cdot \sin y + x \cdot \cos y

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

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

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

Alternatives

Alternative 1
Error10.1
Cost7512
\[\begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := x + t_0\\ t_2 := x \cdot \cos y\\ \mathbf{if}\;z \leq -1.0534156578752266 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0006250749902912553:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.07117478959281 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.6296287302526506 \cdot 10^{-145}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.3431943441470405 \cdot 10^{-118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.346609771289541 \cdot 10^{-75}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error19.2
Cost7384
\[\begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;z \leq -1.0534156578752266 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.0006250749902912553:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.260393229177624 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.6296287302526506 \cdot 10^{-145}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.3431943441470405 \cdot 10^{-118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.127550276082568 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error16.1
Cost6856
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -4.773562577435384 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.9709589350215084 \cdot 10^{-6}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.1
Cost6856
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -4.773562577435384 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.9709589350215084 \cdot 10^{-6}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error37.3
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2296590947315732 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.954327378733383 \cdot 10^{-108}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error30.5
Cost320
\[x + y \cdot z \]
Alternative 7
Error39.0
Cost64
\[x \]

Error

Reproduce

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