
(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 12 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 (+ (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 + x\right)
\end{array}
Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.6e-37) (not (<= x 1.5e-59))) (fma (/ (* (cos y) z) x) x x) (fma (cos y) z (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.6e-37) || !(x <= 1.5e-59)) {
tmp = fma(((cos(y) * z) / x), x, x);
} else {
tmp = fma(cos(y), z, sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -5.6e-37) || !(x <= 1.5e-59)) tmp = fma(Float64(Float64(cos(y) * z) / x), x, x); else tmp = fma(cos(y), z, sin(y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.6e-37], N[Not[LessEqual[x, 1.5e-59]], $MachinePrecision]], N[(N[(N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision] * x + x), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-37} \lor \neg \left(x \leq 1.5 \cdot 10^{-59}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\cos y \cdot z}{x}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
\end{array}
\end{array}
if x < -5.6000000000000002e-37 or 1.5e-59 < x Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around -inf
mul-1-negN/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites97.6%
if -5.6000000000000002e-37 < x < 1.5e-59Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6496.8
Applied rewrites96.8%
Final simplification97.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -24.0)
t_0
(if (<= z 8e-57) (fma 1.0 x (sin y)) (if (<= z 3.5e+133) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -24.0) {
tmp = t_0;
} else if (z <= 8e-57) {
tmp = fma(1.0, x, sin(y));
} else if (z <= 3.5e+133) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -24.0) tmp = t_0; elseif (z <= 8e-57) tmp = fma(1.0, x, sin(y)); elseif (z <= 3.5e+133) tmp = Float64(z + 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, -24.0], t$95$0, If[LessEqual[z, 8e-57], N[(1.0 * x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+133], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -24:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(1, x, \sin y\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+133}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -24 or 3.4999999999999998e133 < z Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
Applied rewrites68.5%
Taylor expanded in z around inf
Applied rewrites84.4%
if -24 < z < 7.99999999999999964e-57Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites94.3%
if 7.99999999999999964e-57 < z < 3.4999999999999998e133Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6484.3
Applied rewrites84.3%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e+56) (not (<= z 3.5e+133))) (* (cos y) z) (fma 1.0 z (+ (sin y) x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e+56) || !(z <= 3.5e+133)) {
tmp = cos(y) * z;
} else {
tmp = fma(1.0, z, (sin(y) + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e+56) || !(z <= 3.5e+133)) tmp = Float64(cos(y) * z); else tmp = fma(1.0, z, Float64(sin(y) + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e+56], N[Not[LessEqual[z, 3.5e+133]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+56} \lor \neg \left(z \leq 3.5 \cdot 10^{+133}\right):\\
\;\;\;\;\cos y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
\end{array}
\end{array}
if z < -3.69999999999999997e56 or 3.4999999999999998e133 < z Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
Applied rewrites65.9%
Taylor expanded in z around inf
Applied rewrites86.5%
if -3.69999999999999997e56 < z < 3.4999999999999998e133Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites96.3%
Final simplification92.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e+56) (not (<= z 3.5e+133))) (* (cos y) z) (+ z x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e+56) || !(z <= 3.5e+133)) {
tmp = cos(y) * z;
} 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) :: tmp
if ((z <= (-3.7d+56)) .or. (.not. (z <= 3.5d+133))) then
tmp = cos(y) * z
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e+56) || !(z <= 3.5e+133)) {
tmp = Math.cos(y) * z;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.7e+56) or not (z <= 3.5e+133): tmp = math.cos(y) * z else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e+56) || !(z <= 3.5e+133)) tmp = Float64(cos(y) * z); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.7e+56) || ~((z <= 3.5e+133))) tmp = cos(y) * z; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e+56], N[Not[LessEqual[z, 3.5e+133]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision], N[(z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+56} \lor \neg \left(z \leq 3.5 \cdot 10^{+133}\right):\\
\;\;\;\;\cos y \cdot z\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -3.69999999999999997e56 or 3.4999999999999998e133 < z Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
Applied rewrites65.9%
Taylor expanded in z around inf
Applied rewrites86.5%
if -3.69999999999999997e56 < z < 3.4999999999999998e133Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6474.9
Applied rewrites74.9%
Final simplification78.9%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.25e+33) (not (<= y 29000.0)))
(+ z x)
(fma
(fma
(fma
(fma (* y y) -0.001388888888888889 0.041666666666666664)
(* y y)
-0.5)
(* y y)
1.0)
z
(+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e+33) || !(y <= 29000.0)) {
tmp = z + x;
} else {
tmp = fma(fma(fma(fma((y * y), -0.001388888888888889, 0.041666666666666664), (y * y), -0.5), (y * y), 1.0), z, (x + y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.25e+33) || !(y <= 29000.0)) tmp = Float64(z + x); else tmp = fma(fma(fma(fma(Float64(y * y), -0.001388888888888889, 0.041666666666666664), Float64(y * y), -0.5), Float64(y * y), 1.0), z, Float64(x + y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.25e+33], N[Not[LessEqual[y, 29000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * -0.001388888888888889 + 0.041666666666666664), $MachinePrecision] * N[(y * y), $MachinePrecision] + -0.5), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+33} \lor \neg \left(y \leq 29000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, -0.001388888888888889, 0.041666666666666664\right), y \cdot y, -0.5\right), y \cdot y, 1\right), z, x + y\right)\\
\end{array}
\end{array}
if y < -1.24999999999999993e33 or 29000 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.5
Applied rewrites43.5%
if -1.24999999999999993e33 < y < 29000Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.2
Applied rewrites96.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.2
Applied rewrites96.2%
Final simplification71.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.25e+33) (not (<= y 29000.0))) (+ z x) (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e+33) || !(y <= 29000.0)) {
tmp = z + x;
} else {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.25e+33) || !(y <= 29000.0)) tmp = Float64(z + x); else tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.25e+33], N[Not[LessEqual[y, 29000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+33} \lor \neg \left(y \leq 29000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -1.24999999999999993e33 or 29000 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.5
Applied rewrites43.5%
if -1.24999999999999993e33 < y < 29000Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6496.0
Applied rewrites96.0%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+34) (not (<= y 29000.0))) (+ z x) (fma (fma (* -0.5 y) z 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+34) || !(y <= 29000.0)) {
tmp = z + x;
} else {
tmp = fma(fma((-0.5 * y), z, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.6e+34) || !(y <= 29000.0)) tmp = Float64(z + x); else tmp = fma(fma(Float64(-0.5 * y), z, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.6e+34], N[Not[LessEqual[y, 29000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+34} \lor \neg \left(y \leq 29000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -1.5999999999999999e34 or 29000 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.5
Applied rewrites43.5%
if -1.5999999999999999e34 < y < 29000Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6495.9
Applied rewrites95.9%
Final simplification71.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -110000000000.0) (not (<= y 5000.0))) (+ z x) (fma (fma (* -0.16666666666666666 y) y 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -110000000000.0) || !(y <= 5000.0)) {
tmp = z + x;
} else {
tmp = fma(fma((-0.16666666666666666 * y), y, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -110000000000.0) || !(y <= 5000.0)) tmp = Float64(z + x); else tmp = fma(fma(Float64(-0.16666666666666666 * y), y, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -110000000000.0], N[Not[LessEqual[y, 5000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -110000000000 \lor \neg \left(y \leq 5000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -1.1e11 or 5e3 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6442.9
Applied rewrites42.9%
if -1.1e11 < y < 5e3Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
Taylor expanded in y around inf
Applied rewrites97.8%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.2e+32) (not (<= y 1.05e+28))) (+ z x) (+ (+ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.2e+32) || !(y <= 1.05e+28)) {
tmp = z + x;
} else {
tmp = (y + x) + 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 ((y <= (-9.2d+32)) .or. (.not. (y <= 1.05d+28))) then
tmp = z + x
else
tmp = (y + x) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.2e+32) || !(y <= 1.05e+28)) {
tmp = z + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.2e+32) or not (y <= 1.05e+28): tmp = z + x else: tmp = (y + x) + z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.2e+32) || !(y <= 1.05e+28)) tmp = Float64(z + x); else tmp = Float64(Float64(y + x) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.2e+32) || ~((y <= 1.05e+28))) tmp = z + x; else tmp = (y + x) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.2e+32], N[Not[LessEqual[y, 1.05e+28]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+32} \lor \neg \left(y \leq 1.05 \cdot 10^{+28}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + z\\
\end{array}
\end{array}
if y < -9.1999999999999998e32 or 1.04999999999999995e28 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6442.5
Applied rewrites42.5%
if -9.1999999999999998e32 < y < 1.04999999999999995e28Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6493.6
Applied rewrites93.6%
Final simplification71.0%
(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-+.f6467.2
Applied rewrites67.2%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (+ z y))
double code(double x, double y, double z) {
return z + y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + y
end function
public static double code(double x, double y, double z) {
return z + y;
}
def code(x, y, z): return z + y
function code(x, y, z) return Float64(z + y) end
function tmp = code(x, y, z) tmp = z + y; end
code[x_, y_, z_] := N[(z + y), $MachinePrecision]
\begin{array}{l}
\\
z + y
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6456.1
Applied rewrites56.1%
Taylor expanded in y around 0
Applied rewrites27.6%
Final simplification27.6%
herbie shell --seed 2024321
(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))))