
(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 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}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + sin(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 * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* z (cos y)) (+ x (sin y)))))
(if (<= t_0 -50.0)
(+ x z)
(if (<= t_0 -0.002)
(sin y)
(if (<= t_0 0.0005) (+ y (+ x z)) (if (<= t_0 1.0) (sin y) (+ x z)))))))
double code(double x, double y, double z) {
double t_0 = (z * cos(y)) + (x + sin(y));
double tmp;
if (t_0 <= -50.0) {
tmp = x + z;
} else if (t_0 <= -0.002) {
tmp = sin(y);
} else if (t_0 <= 0.0005) {
tmp = y + (x + z);
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = (z * cos(y)) + (x + sin(y))
if (t_0 <= (-50.0d0)) then
tmp = x + z
else if (t_0 <= (-0.002d0)) then
tmp = sin(y)
else if (t_0 <= 0.0005d0) then
tmp = y + (x + z)
else if (t_0 <= 1.0d0) then
tmp = sin(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * Math.cos(y)) + (x + Math.sin(y));
double tmp;
if (t_0 <= -50.0) {
tmp = x + z;
} else if (t_0 <= -0.002) {
tmp = Math.sin(y);
} else if (t_0 <= 0.0005) {
tmp = y + (x + z);
} else if (t_0 <= 1.0) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = (z * math.cos(y)) + (x + math.sin(y)) tmp = 0 if t_0 <= -50.0: tmp = x + z elif t_0 <= -0.002: tmp = math.sin(y) elif t_0 <= 0.0005: tmp = y + (x + z) elif t_0 <= 1.0: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(Float64(z * cos(y)) + Float64(x + sin(y))) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(x + z); elseif (t_0 <= -0.002) tmp = sin(y); elseif (t_0 <= 0.0005) tmp = Float64(y + Float64(x + z)); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * cos(y)) + (x + sin(y)); tmp = 0.0; if (t_0 <= -50.0) tmp = x + z; elseif (t_0 <= -0.002) tmp = sin(y); elseif (t_0 <= 0.0005) tmp = y + (x + z); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, -0.002], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 0.0005], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y + \left(x + \sin y\right)\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;x + z\\
\mathbf{elif}\;t\_0 \leq -0.002:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 0.0005:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -50 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6471.8
Applied rewrites71.8%
if -50 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -2e-3 or 5.0000000000000001e-4 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6496.5
Applied rewrites96.5%
Taylor expanded in x around 0
lower-sin.f6493.9
Applied rewrites93.9%
if -2e-3 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 5.0000000000000001e-4Initial 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 simplification77.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma x (* z (/ (cos y) x)) x)))
(if (<= x -2.25e-31)
t_0
(if (<= x 9.5e-82) (+ (sin y) (* z (cos y))) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(x, (z * (cos(y) / x)), x);
double tmp;
if (x <= -2.25e-31) {
tmp = t_0;
} else if (x <= 9.5e-82) {
tmp = sin(y) + (z * cos(y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, Float64(z * Float64(cos(y) / x)), x) tmp = 0.0 if (x <= -2.25e-31) tmp = t_0; elseif (x <= 9.5e-82) tmp = Float64(sin(y) + Float64(z * cos(y))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -2.25e-31], t$95$0, If[LessEqual[x, 9.5e-82], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, z \cdot \frac{\cos y}{x}, x\right)\\
\mathbf{if}\;x \leq -2.25 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.2500000000000002e-31 or 9.4999999999999996e-82 < x Initial program 99.9%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in x around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6496.7
Applied rewrites96.7%
if -2.2500000000000002e-31 < x < 9.4999999999999996e-82Initial program 99.8%
Taylor expanded in x around 0
lower-sin.f6495.3
Applied rewrites95.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma x (* z (/ (cos y) x)) x))) (if (<= x -2.25e-31) t_0 (if (<= x 9.5e-82) (fma z (cos y) (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(x, (z * (cos(y) / x)), x);
double tmp;
if (x <= -2.25e-31) {
tmp = t_0;
} else if (x <= 9.5e-82) {
tmp = fma(z, cos(y), sin(y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, Float64(z * Float64(cos(y) / x)), x) tmp = 0.0 if (x <= -2.25e-31) tmp = t_0; elseif (x <= 9.5e-82) tmp = fma(z, cos(y), sin(y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -2.25e-31], t$95$0, If[LessEqual[x, 9.5e-82], N[(z * N[Cos[y], $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, z \cdot \frac{\cos y}{x}, x\right)\\
\mathbf{if}\;x \leq -2.25 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.2500000000000002e-31 or 9.4999999999999996e-82 < x Initial program 99.9%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in x around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6496.7
Applied rewrites96.7%
if -2.2500000000000002e-31 < x < 9.4999999999999996e-82Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6495.3
Applied rewrites95.3%
(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 99.9%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))) (t_1 (fma x (* z (/ (cos y) x)) x)))
(if (<= z -1.3e+148)
t_0
(if (<= z -5.2e-19)
t_1
(if (<= z 2.1e-40) (+ x (sin y)) (if (<= z 5.6e+131) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double t_1 = fma(x, (z * (cos(y) / x)), x);
double tmp;
if (z <= -1.3e+148) {
tmp = t_0;
} else if (z <= -5.2e-19) {
tmp = t_1;
} else if (z <= 2.1e-40) {
tmp = x + sin(y);
} else if (z <= 5.6e+131) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * cos(y)) t_1 = fma(x, Float64(z * Float64(cos(y) / x)), x) tmp = 0.0 if (z <= -1.3e+148) tmp = t_0; elseif (z <= -5.2e-19) tmp = t_1; elseif (z <= 2.1e-40) tmp = Float64(x + sin(y)); elseif (z <= 5.6e+131) tmp = t_1; else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.3e+148], t$95$0, If[LessEqual[z, -5.2e-19], t$95$1, If[LessEqual[z, 2.1e-40], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+131], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := \mathsf{fma}\left(x, z \cdot \frac{\cos y}{x}, x\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-40}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+131}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3e148 or 5.6000000000000001e131 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6491.0
Applied rewrites91.0%
if -1.3e148 < z < -5.20000000000000026e-19 or 2.10000000000000018e-40 < z < 5.6000000000000001e131Initial program 100.0%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6489.2
Applied rewrites89.2%
if -5.20000000000000026e-19 < z < 2.10000000000000018e-40Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6494.8
Applied rewrites94.8%
Final simplification91.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -6.5e+33)
t_0
(if (<= z 2.2e-40) (+ x (sin y)) (if (<= z 4.4e+108) (+ x z) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -6.5e+33) {
tmp = t_0;
} else if (z <= 2.2e-40) {
tmp = x + sin(y);
} else if (z <= 4.4e+108) {
tmp = x + z;
} else {
tmp = t_0;
}
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 = z * cos(y)
if (z <= (-6.5d+33)) then
tmp = t_0
else if (z <= 2.2d-40) then
tmp = x + sin(y)
else if (z <= 4.4d+108) then
tmp = x + z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -6.5e+33) {
tmp = t_0;
} else if (z <= 2.2e-40) {
tmp = x + Math.sin(y);
} else if (z <= 4.4e+108) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -6.5e+33: tmp = t_0 elif z <= 2.2e-40: tmp = x + math.sin(y) elif z <= 4.4e+108: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -6.5e+33) tmp = t_0; elseif (z <= 2.2e-40) tmp = Float64(x + sin(y)); elseif (z <= 4.4e+108) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -6.5e+33) tmp = t_0; elseif (z <= 2.2e-40) tmp = x + sin(y); elseif (z <= 4.4e+108) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+33], t$95$0, If[LessEqual[z, 2.2e-40], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+108], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-40}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+108}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.49999999999999993e33 or 4.4000000000000003e108 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6483.2
Applied rewrites83.2%
if -6.49999999999999993e33 < z < 2.20000000000000009e-40Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6492.9
Applied rewrites92.9%
if 2.20000000000000009e-40 < z < 4.4000000000000003e108Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6477.8
Applied rewrites77.8%
Final simplification86.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (sin y))))
(if (<= y -0.195)
t_0
(if (<= y 0.235) (+ z (fma y (fma y (* z -0.5) 1.0) x)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -0.195) {
tmp = t_0;
} else if (y <= 0.235) {
tmp = z + fma(y, fma(y, (z * -0.5), 1.0), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -0.195) tmp = t_0; elseif (y <= 0.235) tmp = Float64(z + fma(y, fma(y, Float64(z * -0.5), 1.0), x)); 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.195], t$95$0, If[LessEqual[y, 0.235], N[(z + N[(y * N[(y * N[(z * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -0.195:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.235:\\
\;\;\;\;z + \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot -0.5, 1\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.19500000000000001 or 0.23499999999999999 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6452.7
Applied rewrites52.7%
if -0.19500000000000001 < y < 0.23499999999999999Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification76.4%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6464.7
Applied rewrites64.7%
Final simplification64.7%
(FPCore (x y z) :precision binary64 (+ x y))
double code(double x, double y, double z) {
return x + 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 + y
end function
public static double code(double x, double y, double z) {
return x + y;
}
def code(x, y, z): return x + y
function code(x, y, z) return Float64(x + y) end
function tmp = code(x, y, z) tmp = x + y; end
code[x_, y_, z_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6454.4
Applied rewrites54.4%
Taylor expanded in z around 0
lower-+.f6434.4
Applied rewrites34.4%
herbie shell --seed 2024214
(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))))