
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x * sin(y)) + (z * 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 * sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x * math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x * sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x * sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sin y + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x * sin(y)) + (z * 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 * sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x * math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x * sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x * sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sin y + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma (sin y) x (* z (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), x, (z * cos(y)));
}
function code(x, y, z) return fma(sin(y), x, Float64(z * cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, x, z \cdot \cos y\right)
\end{array}
Initial program 99.7%
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (fma (cos y) z (* (sin y) x)))
double code(double x, double y, double z) {
return fma(cos(y), z, (sin(y) * x));
}
function code(x, y, z) return fma(cos(y), z, Float64(sin(y) * x)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, \sin y \cdot x\right)
\end{array}
Initial program 99.7%
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= y -4e+231)
(/ 1.0 (/ (/ 1.0 (cos y)) z))
(if (<= y -7.2e+24)
(* (sin y) x)
(if (<= y 0.0105)
(+
t_0
(*
y
(fma
(* x (* y y))
(fma
y
(* y (fma (* y y) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
x)))
t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (y <= -4e+231) {
tmp = 1.0 / ((1.0 / cos(y)) / z);
} else if (y <= -7.2e+24) {
tmp = sin(y) * x;
} else if (y <= 0.0105) {
tmp = t_0 + (y * fma((x * (y * y)), fma(y, (y * fma((y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (y <= -4e+231) tmp = Float64(1.0 / Float64(Float64(1.0 / cos(y)) / z)); elseif (y <= -7.2e+24) tmp = Float64(sin(y) * x); elseif (y <= 0.0105) tmp = Float64(t_0 + Float64(y * fma(Float64(x * Float64(y * y)), fma(y, Float64(y * fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e+231], N[(1.0 / N[(N[(1.0 / N[Cos[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.2e+24], N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 0.0105], N[(t$95$0 + N[(y * N[(N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * N[(y * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;y \leq -4 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{\cos y}}{z}}\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{+24}:\\
\;\;\;\;\sin y \cdot x\\
\mathbf{elif}\;y \leq 0.0105:\\
\;\;\;\;t\_0 + y \cdot \mathsf{fma}\left(x \cdot \left(y \cdot y\right), \mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.0000000000000002e231Initial program 99.4%
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
Applied rewrites99.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6467.2
Applied rewrites67.2%
lift-cos.f64N/A
lift-*.f64N/A
unpow1N/A
pow-flipN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
if -4.0000000000000002e231 < y < -7.19999999999999966e24Initial program 99.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-sin.f6468.0
Applied rewrites68.0%
if -7.19999999999999966e24 < y < 0.0105000000000000007Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.2%
if 0.0105000000000000007 < y Initial program 99.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6456.5
Applied rewrites56.5%
Final simplification80.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) x)))
(if (<= y -4e+231)
(/ 1.0 (/ (/ 1.0 (cos y)) z))
(if (<= y -4.8e+19)
t_0
(if (<= y 17.5)
(+
t_0
(fma
(* z (* y y))
(fma
(* y y)
(fma y (* y -0.001388888888888889) 0.041666666666666664)
-0.5)
z))
(* z (cos y)))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * x;
double tmp;
if (y <= -4e+231) {
tmp = 1.0 / ((1.0 / cos(y)) / z);
} else if (y <= -4.8e+19) {
tmp = t_0;
} else if (y <= 17.5) {
tmp = t_0 + fma((z * (y * y)), fma((y * y), fma(y, (y * -0.001388888888888889), 0.041666666666666664), -0.5), z);
} else {
tmp = z * cos(y);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) * x) tmp = 0.0 if (y <= -4e+231) tmp = Float64(1.0 / Float64(Float64(1.0 / cos(y)) / z)); elseif (y <= -4.8e+19) tmp = t_0; elseif (y <= 17.5) tmp = Float64(t_0 + fma(Float64(z * Float64(y * y)), fma(Float64(y * y), fma(y, Float64(y * -0.001388888888888889), 0.041666666666666664), -0.5), z)); else tmp = Float64(z * cos(y)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -4e+231], N[(1.0 / N[(N[(1.0 / N[Cos[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.8e+19], t$95$0, If[LessEqual[y, 17.5], N[(t$95$0 + N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * -0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot x\\
\mathbf{if}\;y \leq -4 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{\cos y}}{z}}\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 17.5:\\
\;\;\;\;t\_0 + \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot -0.001388888888888889, 0.041666666666666664\right), -0.5\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if y < -4.0000000000000002e231Initial program 99.4%
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
Applied rewrites99.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6467.2
Applied rewrites67.2%
lift-cos.f64N/A
lift-*.f64N/A
unpow1N/A
pow-flipN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
if -4.0000000000000002e231 < y < -4.8e19Initial program 99.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-sin.f6466.2
Applied rewrites66.2%
if -4.8e19 < y < 17.5Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
Applied rewrites97.1%
if 17.5 < y Initial program 99.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6455.3
Applied rewrites55.3%
Final simplification79.5%
(FPCore (x y z)
:precision binary64
(if (<= y -4e+231)
(/ 1.0 (/ (/ 1.0 (cos y)) z))
(if (<= y -0.016)
(* (sin y) x)
(if (<= y 0.0102)
(fma y (fma y (fma z -0.5 (* -0.16666666666666666 (* y x))) x) z)
(* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+231) {
tmp = 1.0 / ((1.0 / cos(y)) / z);
} else if (y <= -0.016) {
tmp = sin(y) * x;
} else if (y <= 0.0102) {
tmp = fma(y, fma(y, fma(z, -0.5, (-0.16666666666666666 * (y * x))), x), z);
} else {
tmp = z * cos(y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4e+231) tmp = Float64(1.0 / Float64(Float64(1.0 / cos(y)) / z)); elseif (y <= -0.016) tmp = Float64(sin(y) * x); elseif (y <= 0.0102) tmp = fma(y, fma(y, fma(z, -0.5, Float64(-0.16666666666666666 * Float64(y * x))), x), z); else tmp = Float64(z * cos(y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4e+231], N[(1.0 / N[(N[(1.0 / N[Cos[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -0.016], N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 0.0102], N[(y * N[(y * N[(z * -0.5 + N[(-0.16666666666666666 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{\cos y}}{z}}\\
\mathbf{elif}\;y \leq -0.016:\\
\;\;\;\;\sin y \cdot x\\
\mathbf{elif}\;y \leq 0.0102:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(z, -0.5, -0.16666666666666666 \cdot \left(y \cdot x\right)\right), x\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if y < -4.0000000000000002e231Initial program 99.4%
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
Applied rewrites99.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6467.2
Applied rewrites67.2%
lift-cos.f64N/A
lift-*.f64N/A
unpow1N/A
pow-flipN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
if -4.0000000000000002e231 < y < -0.016Initial program 99.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-sin.f6461.8
Applied rewrites61.8%
if -0.016 < y < 0.010200000000000001Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 0.010200000000000001 < y Initial program 99.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6456.5
Applied rewrites56.5%
Final simplification79.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= y -3.8e+231)
t_0
(if (<= y -0.016)
(* (sin y) x)
(if (<= y 0.0102)
(fma y (fma y (fma z -0.5 (* -0.16666666666666666 (* y x))) x) z)
t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (y <= -3.8e+231) {
tmp = t_0;
} else if (y <= -0.016) {
tmp = sin(y) * x;
} else if (y <= 0.0102) {
tmp = fma(y, fma(y, fma(z, -0.5, (-0.16666666666666666 * (y * x))), x), z);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (y <= -3.8e+231) tmp = t_0; elseif (y <= -0.016) tmp = Float64(sin(y) * x); elseif (y <= 0.0102) tmp = fma(y, fma(y, fma(z, -0.5, Float64(-0.16666666666666666 * Float64(y * x))), x), z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+231], t$95$0, If[LessEqual[y, -0.016], N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 0.0102], N[(y * N[(y * N[(z * -0.5 + N[(-0.16666666666666666 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+231}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -0.016:\\
\;\;\;\;\sin y \cdot x\\
\mathbf{elif}\;y \leq 0.0102:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(z, -0.5, -0.16666666666666666 \cdot \left(y \cdot x\right)\right), x\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.8000000000000001e231 or 0.010200000000000001 < y Initial program 99.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6458.7
Applied rewrites58.7%
if -3.8000000000000001e231 < y < -0.016Initial program 99.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-sin.f6461.8
Applied rewrites61.8%
if -0.016 < y < 0.010200000000000001Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification79.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) x)))
(if (<= y -0.016)
t_0
(if (<= y 1850000.0)
(fma y (fma y (fma z -0.5 (* -0.16666666666666666 (* y x))) x) z)
t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * x;
double tmp;
if (y <= -0.016) {
tmp = t_0;
} else if (y <= 1850000.0) {
tmp = fma(y, fma(y, fma(z, -0.5, (-0.16666666666666666 * (y * x))), x), z);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) * x) tmp = 0.0 if (y <= -0.016) tmp = t_0; elseif (y <= 1850000.0) tmp = fma(y, fma(y, fma(z, -0.5, Float64(-0.16666666666666666 * Float64(y * x))), x), z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -0.016], t$95$0, If[LessEqual[y, 1850000.0], N[(y * N[(y * N[(z * -0.5 + N[(-0.16666666666666666 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot x\\
\mathbf{if}\;y \leq -0.016:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1850000:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(z, -0.5, -0.16666666666666666 \cdot \left(y \cdot x\right)\right), x\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.016 or 1.85e6 < y Initial program 99.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-sin.f6451.3
Applied rewrites51.3%
if -0.016 < y < 1.85e6Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
Applied rewrites97.2%
Final simplification74.6%
(FPCore (x y z) :precision binary64 (if (<= x -7.2e+113) (* y x) z))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+113) {
tmp = y * x;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-7.2d+113)) then
tmp = y * x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+113) {
tmp = y * x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.2e+113: tmp = y * x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+113) tmp = Float64(y * x); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.2e+113) tmp = y * x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+113], N[(y * x), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+113}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -7.19999999999999984e113Initial program 99.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6446.2
Applied rewrites46.2%
Taylor expanded in y around inf
lower-*.f6430.7
Applied rewrites30.7%
if -7.19999999999999984e113 < x Initial program 99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6471.5
Applied rewrites71.5%
Taylor expanded in y around 0
Applied rewrites45.1%
*-rgt-identity45.1
Applied rewrites45.1%
Final simplification42.5%
(FPCore (x y z) :precision binary64 (fma y x z))
double code(double x, double y, double z) {
return fma(y, x, z);
}
function code(x, y, z) return fma(y, x, z) end
code[x_, y_, z_] := N[(y * x + z), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, z\right)
\end{array}
Initial program 99.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6451.9
Applied rewrites51.9%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-cos.f6463.0
Applied rewrites63.0%
Taylor expanded in y around 0
Applied rewrites40.1%
*-rgt-identity40.1
Applied rewrites40.1%
herbie shell --seed 2024216
(FPCore (x y z)
:name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, B"
:precision binary64
(+ (* x (sin y)) (* z (cos y))))