
(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}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 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}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ x (sin y))))
double code(double x, double y, double z) {
return fma(cos(y), z, (x + sin(y)));
}
function code(x, y, z) return fma(cos(y), z, Float64(x + sin(y))) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, x + \sin y\right)
\end{array}
Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* (cos y) z))))
(if (<= t_0 -4.0)
(+ z x)
(if (<= t_0 -0.2)
(sin y)
(if (<= t_0 1e-10) (+ y (+ z x)) (if (<= t_0 1.0) (sin y) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = (x + sin(y)) + (cos(y) * z);
double tmp;
if (t_0 <= -4.0) {
tmp = z + x;
} else if (t_0 <= -0.2) {
tmp = sin(y);
} else if (t_0 <= 1e-10) {
tmp = y + (z + x);
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = z + x;
}
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) :: t_0
real(8) :: tmp
t_0 = (x + sin(y)) + (cos(y) * z)
if (t_0 <= (-4.0d0)) then
tmp = z + x
else if (t_0 <= (-0.2d0)) then
tmp = sin(y)
else if (t_0 <= 1d-10) then
tmp = y + (z + x)
else if (t_0 <= 1.0d0) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.sin(y)) + (Math.cos(y) * z);
double tmp;
if (t_0 <= -4.0) {
tmp = z + x;
} else if (t_0 <= -0.2) {
tmp = Math.sin(y);
} else if (t_0 <= 1e-10) {
tmp = y + (z + x);
} else if (t_0 <= 1.0) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.sin(y)) + (math.cos(y) * z) tmp = 0 if t_0 <= -4.0: tmp = z + x elif t_0 <= -0.2: tmp = math.sin(y) elif t_0 <= 1e-10: tmp = y + (z + x) elif t_0 <= 1.0: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(Float64(x + sin(y)) + Float64(cos(y) * z)) tmp = 0.0 if (t_0 <= -4.0) tmp = Float64(z + x); elseif (t_0 <= -0.2) tmp = sin(y); elseif (t_0 <= 1e-10) tmp = Float64(y + Float64(z + x)); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + sin(y)) + (cos(y) * z); tmp = 0.0; if (t_0 <= -4.0) tmp = z + x; elseif (t_0 <= -0.2) tmp = sin(y); elseif (t_0 <= 1e-10) tmp = y + (z + x); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.2], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-10], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + \cos y \cdot z\\
\mathbf{if}\;t\_0 \leq -4:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.2:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 10^{-10}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -4 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6480.4
Applied rewrites80.4%
if -4 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.20000000000000001 or 1.00000000000000004e-10 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
Taylor expanded in y around 0
lower-+.f64N/A
+-commutativeN/A
lower-+.f643.3
Applied rewrites3.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6498.0
Applied rewrites98.0%
Taylor expanded in x around 0
Applied rewrites96.0%
if -0.20000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1.00000000000000004e-10Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification85.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -3.3e+85)
(fma (cos y) z (+ y x))
(if (<= z 2.5e-30)
(fma 1.0 z (+ x (sin y)))
(if (<= z 1.52e+174) (* x (+ 1.0 (/ t_0 x))) t_0)))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -3.3e+85) {
tmp = fma(cos(y), z, (y + x));
} else if (z <= 2.5e-30) {
tmp = fma(1.0, z, (x + sin(y)));
} else if (z <= 1.52e+174) {
tmp = x * (1.0 + (t_0 / x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -3.3e+85) tmp = fma(cos(y), z, Float64(y + x)); elseif (z <= 2.5e-30) tmp = fma(1.0, z, Float64(x + sin(y))); elseif (z <= 1.52e+174) tmp = Float64(x * Float64(1.0 + Float64(t_0 / x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3.3e+85], N[(N[Cos[y], $MachinePrecision] * z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e-30], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.52e+174], N[(x * N[(1.0 + N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, y + x\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{+174}:\\
\;\;\;\;x \cdot \left(1 + \frac{t\_0}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.2999999999999999e85Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6490.4
Applied rewrites90.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.4
Applied rewrites90.4%
if -3.2999999999999999e85 < z < 2.49999999999999986e-30Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites96.5%
if 2.49999999999999986e-30 < z < 1.52000000000000004e174Initial program 99.9%
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
lower-+.f64N/A
+-commutativeN/A
lower-+.f6457.6
Applied rewrites57.6%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-neg-inN/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
distribute-frac-neg2N/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites89.0%
Taylor expanded in z around inf
Applied rewrites88.7%
if 1.52000000000000004e174 < z Initial program 100.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f64100.0
Applied rewrites100.0%
Final simplification94.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ 1.0 (/ 1.0 x))))
(if (<= z -4.4)
(fma (cos y) z t_0)
(if (<= z 1.02e-22) (fma 1.0 z (+ x (sin y))) (+ t_0 (* (cos y) z))))))
double code(double x, double y, double z) {
double t_0 = 1.0 / (1.0 / x);
double tmp;
if (z <= -4.4) {
tmp = fma(cos(y), z, t_0);
} else if (z <= 1.02e-22) {
tmp = fma(1.0, z, (x + sin(y)));
} else {
tmp = t_0 + (cos(y) * z);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(1.0 / Float64(1.0 / x)) tmp = 0.0 if (z <= -4.4) tmp = fma(cos(y), z, t_0); elseif (z <= 1.02e-22) tmp = fma(1.0, z, Float64(x + sin(y))); else tmp = Float64(t_0 + Float64(cos(y) * z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4], N[(N[Cos[y], $MachinePrecision] * z + t$95$0), $MachinePrecision], If[LessEqual[z, 1.02e-22], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\frac{1}{x}}\\
\mathbf{if}\;z \leq -4.4:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, t\_0\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \cos y \cdot z\\
\end{array}
\end{array}
if z < -4.4000000000000004Initial program 100.0%
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lift-cos.f64N/A
*-commutativeN/A
lower-fma.f6499.2
Applied rewrites99.2%
if -4.4000000000000004 < z < 1.02000000000000002e-22Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites99.4%
if 1.02000000000000002e-22 < z Initial program 99.9%
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6499.7
Applied rewrites99.7%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (cos y) z (/ 1.0 (/ 1.0 x))))) (if (<= z -4.4) t_0 (if (<= z 1.02e-22) (fma 1.0 z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(cos(y), z, (1.0 / (1.0 / x)));
double tmp;
if (z <= -4.4) {
tmp = t_0;
} else if (z <= 1.02e-22) {
tmp = fma(1.0, z, (x + sin(y)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(cos(y), z, Float64(1.0 / Float64(1.0 / x))) tmp = 0.0 if (z <= -4.4) tmp = t_0; elseif (z <= 1.02e-22) tmp = fma(1.0, z, Float64(x + sin(y))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4], t$95$0, If[LessEqual[z, 1.02e-22], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\cos y, z, \frac{1}{\frac{1}{x}}\right)\\
\mathbf{if}\;z \leq -4.4:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.4000000000000004 or 1.02000000000000002e-22 < z Initial program 100.0%
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6499.5
Applied rewrites99.5%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lift-cos.f64N/A
*-commutativeN/A
lower-fma.f6499.5
Applied rewrites99.5%
if -4.4000000000000004 < z < 1.02000000000000002e-22Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites99.4%
(FPCore (x y z) :precision binary64 (if (<= z -3.3e+85) (fma (cos y) z (+ y x)) (if (<= z 5e+116) (fma 1.0 z (+ x (sin y))) (* (cos y) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.3e+85) {
tmp = fma(cos(y), z, (y + x));
} else if (z <= 5e+116) {
tmp = fma(1.0, z, (x + sin(y)));
} else {
tmp = cos(y) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -3.3e+85) tmp = fma(cos(y), z, Float64(y + x)); elseif (z <= 5e+116) tmp = fma(1.0, z, Float64(x + sin(y))); else tmp = Float64(cos(y) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -3.3e+85], N[(N[Cos[y], $MachinePrecision] * z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+116], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, y + x\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y \cdot z\\
\end{array}
\end{array}
if z < -3.2999999999999999e85Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6490.4
Applied rewrites90.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.4
Applied rewrites90.4%
if -3.2999999999999999e85 < z < 5.00000000000000025e116Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites93.0%
if 5.00000000000000025e116 < z Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6493.3
Applied rewrites93.3%
Final simplification92.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (sin y))))
(if (<= y -0.0175)
t_0
(if (<= y 0.49)
(+
(+ y x)
(*
z
(fma
(* y y)
(fma
(* y y)
(fma y (* y -0.001388888888888889) 0.041666666666666664)
-0.5)
1.0)))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -0.0175) {
tmp = t_0;
} else if (y <= 0.49) {
tmp = (y + x) + (z * fma((y * y), fma((y * y), fma(y, (y * -0.001388888888888889), 0.041666666666666664), -0.5), 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -0.0175) tmp = t_0; elseif (y <= 0.49) tmp = Float64(Float64(y + x) + Float64(z * fma(Float64(y * y), fma(Float64(y * y), fma(y, Float64(y * -0.001388888888888889), 0.041666666666666664), -0.5), 1.0))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0175], t$95$0, If[LessEqual[y, 0.49], N[(N[(y + x), $MachinePrecision] + N[(z * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * -0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -0.0175:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.49:\\
\;\;\;\;\left(y + x\right) + z \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.017500000000000002 or 0.48999999999999999 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6469.0
Applied rewrites69.0%
if -0.017500000000000002 < y < 0.48999999999999999Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Final simplification85.1%
(FPCore (x y z) :precision binary64 (if (<= z 5e+116) (fma 1.0 z (+ x (sin y))) (* (cos y) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= 5e+116) {
tmp = fma(1.0, z, (x + sin(y)));
} else {
tmp = cos(y) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 5e+116) tmp = fma(1.0, z, Float64(x + sin(y))); else tmp = Float64(cos(y) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 5e+116], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y \cdot z\\
\end{array}
\end{array}
if z < 5.00000000000000025e116Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites90.2%
if 5.00000000000000025e116 < z Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6493.3
Applied rewrites93.3%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6469.6
Applied rewrites69.6%
herbie shell --seed 2024238
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))