
(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 11 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 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%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (+ x (sin y)) (* z (cos y))))) (if (or (<= t_0 -0.2) (not (<= t_0 0.4))) (+ z x) (+ (+ z y) x))))
double code(double x, double y, double z) {
double t_0 = (x + sin(y)) + (z * cos(y));
double tmp;
if ((t_0 <= -0.2) || !(t_0 <= 0.4)) {
tmp = z + x;
} else {
tmp = (z + y) + 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)) + (z * cos(y))
if ((t_0 <= (-0.2d0)) .or. (.not. (t_0 <= 0.4d0))) then
tmp = z + x
else
tmp = (z + y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.sin(y)) + (z * Math.cos(y));
double tmp;
if ((t_0 <= -0.2) || !(t_0 <= 0.4)) {
tmp = z + x;
} else {
tmp = (z + y) + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.sin(y)) + (z * math.cos(y)) tmp = 0 if (t_0 <= -0.2) or not (t_0 <= 0.4): tmp = z + x else: tmp = (z + y) + x return tmp
function code(x, y, z) t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y))) tmp = 0.0 if ((t_0 <= -0.2) || !(t_0 <= 0.4)) tmp = Float64(z + x); else tmp = Float64(Float64(z + y) + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + sin(y)) + (z * cos(y)); tmp = 0.0; if ((t_0 <= -0.2) || ~((t_0 <= 0.4))) tmp = z + x; else tmp = (z + y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.2], N[Not[LessEqual[t$95$0, 0.4]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
\mathbf{if}\;t\_0 \leq -0.2 \lor \neg \left(t\_0 \leq 0.4\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + y\right) + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.20000000000000001 or 0.40000000000000002 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6468.7
Applied rewrites68.7%
if -0.20000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.40000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6488.7
Applied rewrites88.7%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.8e-32) (not (<= x 2.65e-40))) (fma 1.0 z (+ (sin y) x)) (fma (cos y) z (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e-32) || !(x <= 2.65e-40)) {
tmp = fma(1.0, z, (sin(y) + x));
} else {
tmp = fma(cos(y), z, sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -6.8e-32) || !(x <= 2.65e-40)) tmp = fma(1.0, z, Float64(sin(y) + x)); else tmp = fma(cos(y), z, sin(y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e-32], N[Not[LessEqual[x, 2.65e-40]], $MachinePrecision]], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-32} \lor \neg \left(x \leq 2.65 \cdot 10^{-40}\right):\\
\;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
\end{array}
\end{array}
if x < -6.79999999999999956e-32 or 2.6500000000000001e-40 < x Initial program 99.9%
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 rewrites87.6%
if -6.79999999999999956e-32 < x < 2.6500000000000001e-40Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6496.1
Applied rewrites96.1%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.8e+137) (not (<= z 4.4e+117))) (fma (cos y) z (+ x y)) (fma 1.0 z (+ (sin y) x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e+137) || !(z <= 4.4e+117)) {
tmp = fma(cos(y), z, (x + y));
} else {
tmp = fma(1.0, z, (sin(y) + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -5.8e+137) || !(z <= 4.4e+117)) tmp = fma(cos(y), z, Float64(x + y)); else tmp = fma(1.0, z, Float64(sin(y) + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.8e+137], N[Not[LessEqual[z, 4.4e+117]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+137} \lor \neg \left(z \leq 4.4 \cdot 10^{+117}\right):\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
\end{array}
\end{array}
if z < -5.79999999999999969e137 or 4.40000000000000028e117 < z Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6486.1
Applied rewrites86.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6486.1
Applied rewrites86.1%
if -5.79999999999999969e137 < z < 4.40000000000000028e117Initial 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 rewrites90.6%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.8e+16) (not (<= y 8.2e-21))) (+ (sin y) x) (+ (+ y x) (fma (* (fma 0.041666666666666664 (* y y) -0.5) z) (* y y) z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+16) || !(y <= 8.2e-21)) {
tmp = sin(y) + x;
} else {
tmp = (y + x) + fma((fma(0.041666666666666664, (y * y), -0.5) * z), (y * y), z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -3.8e+16) || !(y <= 8.2e-21)) tmp = Float64(sin(y) + x); else tmp = Float64(Float64(y + x) + fma(Float64(fma(0.041666666666666664, Float64(y * y), -0.5) * z), Float64(y * y), z)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.8e+16], N[Not[LessEqual[y, 8.2e-21]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + N[(N[(N[(0.041666666666666664 * N[(y * y), $MachinePrecision] + -0.5), $MachinePrecision] * z), $MachinePrecision] * N[(y * y), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+16} \lor \neg \left(y \leq 8.2 \cdot 10^{-21}\right):\\
\;\;\;\;\sin y + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, y \cdot y, -0.5\right) \cdot z, y \cdot y, z\right)\\
\end{array}
\end{array}
if y < -3.8e16 or 8.19999999999999988e-21 < y Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
Taylor expanded in y around 0
Applied rewrites6.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6461.1
Applied rewrites61.1%
if -3.8e16 < y < 8.19999999999999988e-21Initial 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
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification80.4%
(FPCore (x y z) :precision binary64 (fma 1.0 z (+ (sin y) x)))
double code(double x, double y, double z) {
return fma(1.0, z, (sin(y) + x));
}
function code(x, y, z) return fma(1.0, z, Float64(sin(y) + x)) end
code[x_, y_, z_] := N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, z, \sin y + x\right)
\end{array}
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 y around 0
Applied rewrites81.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.7e+17) (not (<= y 8.5e+54))) (+ 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.7e+17) || !(y <= 8.5e+54)) {
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.7e+17) || !(y <= 8.5e+54)) 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.7e+17], N[Not[LessEqual[y, 8.5e+54]], $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.7 \cdot 10^{+17} \lor \neg \left(y \leq 8.5 \cdot 10^{+54}\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.7e17 or 8.4999999999999995e54 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6445.6
Applied rewrites45.6%
if -1.7e17 < y < 8.4999999999999995e54Initial 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-+.f6493.3
Applied rewrites93.3%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.8e+16) (not (<= y 8.5e+54))) (+ z x) (fma (fma (* z y) -0.5 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+16) || !(y <= 8.5e+54)) {
tmp = z + x;
} else {
tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -3.8e+16) || !(y <= 8.5e+54)) tmp = Float64(z + x); else tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.8e+16], N[Not[LessEqual[y, 8.5e+54]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+16} \lor \neg \left(y \leq 8.5 \cdot 10^{+54}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -3.8e16 or 8.4999999999999995e54 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6445.2
Applied rewrites45.2%
if -3.8e16 < y < 8.4999999999999995e54Initial 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-*.f64N/A
+-commutativeN/A
lower-+.f6493.8
Applied rewrites93.8%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.8e-63) (not (<= x 2.75e-158))) (+ z x) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-63) || !(x <= 2.75e-158)) {
tmp = z + x;
} else {
tmp = z + y;
}
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 <= (-4.8d-63)) .or. (.not. (x <= 2.75d-158))) then
tmp = z + x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-63) || !(x <= 2.75e-158)) {
tmp = z + x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.8e-63) or not (x <= 2.75e-158): tmp = z + x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.8e-63) || !(x <= 2.75e-158)) tmp = Float64(z + x); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.8e-63) || ~((x <= 2.75e-158))) tmp = z + x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.8e-63], N[Not[LessEqual[x, 2.75e-158]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-63} \lor \neg \left(x \leq 2.75 \cdot 10^{-158}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -4.8000000000000001e-63 or 2.75000000000000013e-158 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6477.7
Applied rewrites77.7%
if -4.8000000000000001e-63 < x < 2.75000000000000013e-158Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.5
Applied rewrites99.5%
Taylor expanded in y around 0
Applied rewrites55.2%
Final simplification70.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.5) (not (<= x 0.5))) (+ x y) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5) || !(x <= 0.5)) {
tmp = x + y;
} else {
tmp = z + y;
}
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 <= (-5.5d0)) .or. (.not. (x <= 0.5d0))) then
tmp = x + y
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5) || !(x <= 0.5)) {
tmp = x + y;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.5) or not (x <= 0.5): tmp = x + y else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.5) || !(x <= 0.5)) tmp = Float64(x + y); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.5) || ~((x <= 0.5))) tmp = x + y; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.5], N[Not[LessEqual[x, 0.5]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \lor \neg \left(x \leq 0.5\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -5.5 or 0.5 < x Initial program 99.9%
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-*.f64N/A
+-commutativeN/A
lower-+.f6467.4
Applied rewrites67.4%
Taylor expanded in y around inf
Applied rewrites2.8%
Taylor expanded in z around 0
Applied rewrites61.1%
if -5.5 < x < 0.5Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6493.1
Applied rewrites93.1%
Taylor expanded in y around 0
Applied rewrites47.2%
Final simplification54.5%
(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 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6458.3
Applied rewrites58.3%
Taylor expanded in y around 0
Applied rewrites30.0%
herbie shell --seed 2024337
(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))))