
(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 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 Float64(fma(cos(y), z, x) + sin(y)) end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, x\right) + \sin y
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.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 (+ (+ x (sin y)) (* z (cos y))))) (if (or (<= t_0 -0.16) (not (<= t_0 5e-71))) (+ 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.16) || !(t_0 <= 5e-71)) {
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.16d0)) .or. (.not. (t_0 <= 5d-71))) 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.16) || !(t_0 <= 5e-71)) {
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.16) or not (t_0 <= 5e-71): 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.16) || !(t_0 <= 5e-71)) 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.16) || ~((t_0 <= 5e-71))) 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.16], N[Not[LessEqual[t$95$0, 5e-71]], $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.16 \lor \neg \left(t\_0 \leq 5 \cdot 10^{-71}\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.160000000000000003 or 4.99999999999999998e-71 < (+.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.160000000000000003 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 4.99999999999999998e-71Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6494.1
Applied rewrites94.1%
Final simplification71.0%
(FPCore (x y z)
:precision binary64
(if (<= z -5.8e+84)
(+ (+ y x) (* z (cos y)))
(if (<= z -7.6e-87)
(+ z x)
(if (<= z 1.8e-43)
(+ (sin y) x)
(if (<= z 6.2e+31) (+ z x) (* (cos y) z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+84) {
tmp = (y + x) + (z * cos(y));
} else if (z <= -7.6e-87) {
tmp = z + x;
} else if (z <= 1.8e-43) {
tmp = sin(y) + x;
} else if (z <= 6.2e+31) {
tmp = z + x;
} else {
tmp = cos(y) * 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 (z <= (-5.8d+84)) then
tmp = (y + x) + (z * cos(y))
else if (z <= (-7.6d-87)) then
tmp = z + x
else if (z <= 1.8d-43) then
tmp = sin(y) + x
else if (z <= 6.2d+31) then
tmp = z + x
else
tmp = cos(y) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+84) {
tmp = (y + x) + (z * Math.cos(y));
} else if (z <= -7.6e-87) {
tmp = z + x;
} else if (z <= 1.8e-43) {
tmp = Math.sin(y) + x;
} else if (z <= 6.2e+31) {
tmp = z + x;
} else {
tmp = Math.cos(y) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+84: tmp = (y + x) + (z * math.cos(y)) elif z <= -7.6e-87: tmp = z + x elif z <= 1.8e-43: tmp = math.sin(y) + x elif z <= 6.2e+31: tmp = z + x else: tmp = math.cos(y) * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+84) tmp = Float64(Float64(y + x) + Float64(z * cos(y))); elseif (z <= -7.6e-87) tmp = Float64(z + x); elseif (z <= 1.8e-43) tmp = Float64(sin(y) + x); elseif (z <= 6.2e+31) tmp = Float64(z + x); else tmp = Float64(cos(y) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+84) tmp = (y + x) + (z * cos(y)); elseif (z <= -7.6e-87) tmp = z + x; elseif (z <= 1.8e-43) tmp = sin(y) + x; elseif (z <= 6.2e+31) tmp = z + x; else tmp = cos(y) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+84], N[(N[(y + x), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -7.6e-87], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.8e-43], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 6.2e+31], N[(z + x), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+84}:\\
\;\;\;\;\left(y + x\right) + z \cdot \cos y\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{-87}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-43}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\cos y \cdot z\\
\end{array}
\end{array}
if z < -5.79999999999999977e84Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6488.5
Applied rewrites88.5%
if -5.79999999999999977e84 < z < -7.6e-87 or 1.7999999999999999e-43 < z < 6.2000000000000004e31Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6484.6
Applied rewrites84.6%
if -7.6e-87 < z < 1.7999999999999999e-43Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6491.9
Applied rewrites91.9%
if 6.2000000000000004e31 < z Initial program 99.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-sumN/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
Applied rewrites99.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-pow.f64N/A
unpow1N/A
pow-divN/A
metadata-evalN/A
lift-pow.f64N/A
lower-fma.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6486.4
Applied rewrites86.4%
Final simplification88.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -6.8e+77)
t_0
(if (<= z -7.6e-87)
(+ z x)
(if (<= z 1.8e-43) (+ (sin y) x) (if (<= z 6.2e+31) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -6.8e+77) {
tmp = t_0;
} else if (z <= -7.6e-87) {
tmp = z + x;
} else if (z <= 1.8e-43) {
tmp = sin(y) + x;
} else if (z <= 6.2e+31) {
tmp = z + x;
} 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 = cos(y) * z
if (z <= (-6.8d+77)) then
tmp = t_0
else if (z <= (-7.6d-87)) then
tmp = z + x
else if (z <= 1.8d-43) then
tmp = sin(y) + x
else if (z <= 6.2d+31) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cos(y) * z;
double tmp;
if (z <= -6.8e+77) {
tmp = t_0;
} else if (z <= -7.6e-87) {
tmp = z + x;
} else if (z <= 1.8e-43) {
tmp = Math.sin(y) + x;
} else if (z <= 6.2e+31) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -6.8e+77: tmp = t_0 elif z <= -7.6e-87: tmp = z + x elif z <= 1.8e-43: tmp = math.sin(y) + x elif z <= 6.2e+31: 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 <= -6.8e+77) tmp = t_0; elseif (z <= -7.6e-87) tmp = Float64(z + x); elseif (z <= 1.8e-43) tmp = Float64(sin(y) + x); elseif (z <= 6.2e+31) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -6.8e+77) tmp = t_0; elseif (z <= -7.6e-87) tmp = z + x; elseif (z <= 1.8e-43) tmp = sin(y) + x; elseif (z <= 6.2e+31) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.8e+77], t$95$0, If[LessEqual[z, -7.6e-87], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.8e-43], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 6.2e+31], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{-87}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-43}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.79999999999999993e77 or 6.2000000000000004e31 < z Initial program 99.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-sumN/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
Applied rewrites99.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-pow.f64N/A
unpow1N/A
pow-divN/A
metadata-evalN/A
lift-pow.f64N/A
lower-fma.f64N/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6486.0
Applied rewrites86.0%
if -6.79999999999999993e77 < z < -7.6e-87 or 1.7999999999999999e-43 < z < 6.2000000000000004e31Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6487.4
Applied rewrites87.4%
if -7.6e-87 < z < 1.7999999999999999e-43Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6491.9
Applied rewrites91.9%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (if (<= z -5.8e+84) (+ (+ y x) (* z (cos y))) (if (<= z 6.2e+31) (+ (+ x (sin y)) (* z 1.0)) (* (cos y) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+84) {
tmp = (y + x) + (z * cos(y));
} else if (z <= 6.2e+31) {
tmp = (x + sin(y)) + (z * 1.0);
} else {
tmp = cos(y) * 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 (z <= (-5.8d+84)) then
tmp = (y + x) + (z * cos(y))
else if (z <= 6.2d+31) then
tmp = (x + sin(y)) + (z * 1.0d0)
else
tmp = cos(y) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+84) {
tmp = (y + x) + (z * Math.cos(y));
} else if (z <= 6.2e+31) {
tmp = (x + Math.sin(y)) + (z * 1.0);
} else {
tmp = Math.cos(y) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+84: tmp = (y + x) + (z * math.cos(y)) elif z <= 6.2e+31: tmp = (x + math.sin(y)) + (z * 1.0) else: tmp = math.cos(y) * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+84) tmp = Float64(Float64(y + x) + Float64(z * cos(y))); elseif (z <= 6.2e+31) tmp = Float64(Float64(x + sin(y)) + Float64(z * 1.0)); else tmp = Float64(cos(y) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+84) tmp = (y + x) + (z * cos(y)); elseif (z <= 6.2e+31) tmp = (x + sin(y)) + (z * 1.0); else tmp = cos(y) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+84], N[(N[(y + x), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+31], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+84}:\\
\;\;\;\;\left(y + x\right) + z \cdot \cos y\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;\left(x + \sin y\right) + z \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\cos y \cdot z\\
\end{array}
\end{array}
if z < -5.79999999999999977e84Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6488.5
Applied rewrites88.5%
if -5.79999999999999977e84 < z < 6.2000000000000004e31Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites95.0%
if 6.2000000000000004e31 < z Initial program 99.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-sumN/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
Applied rewrites99.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-pow.f64N/A
unpow1N/A
pow-divN/A
metadata-evalN/A
lift-pow.f64N/A
lower-fma.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6486.4
Applied rewrites86.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -15000000000000.0) (not (<= y 0.165))) (+ (sin y) 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 <= -15000000000000.0) || !(y <= 0.165)) {
tmp = sin(y) + 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 <= -15000000000000.0) || !(y <= 0.165)) tmp = Float64(sin(y) + 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, -15000000000000.0], N[Not[LessEqual[y, 0.165]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] + 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 -15000000000000 \lor \neg \left(y \leq 0.165\right):\\
\;\;\;\;\sin y + 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.5e13 or 0.165000000000000008 < y Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6456.9
Applied rewrites56.9%
if -1.5e13 < y < 0.165000000000000008Initial 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.0
Applied rewrites98.0%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -33000000000000.0) (not (<= y 7500000000000.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 <= -33000000000000.0) || !(y <= 7500000000000.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 <= -33000000000000.0) || !(y <= 7500000000000.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, -33000000000000.0], N[Not[LessEqual[y, 7500000000000.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 -33000000000000 \lor \neg \left(y \leq 7500000000000\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 < -3.3e13 or 7.5e12 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6440.4
Applied rewrites40.4%
if -3.3e13 < y < 7.5e12Initial 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.2
Applied rewrites96.2%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -34000000000000.0) (not (<= y 5e+15))) (+ 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 <= -34000000000000.0) || !(y <= 5e+15)) {
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 <= -34000000000000.0) || !(y <= 5e+15)) 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, -34000000000000.0], N[Not[LessEqual[y, 5e+15]], $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 -34000000000000 \lor \neg \left(y \leq 5 \cdot 10^{+15}\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.4e13 or 5e15 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6440.4
Applied rewrites40.4%
if -3.4e13 < y < 5e15Initial 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-+.f6495.8
Applied rewrites95.8%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -245.0) (not (<= y 8200000000000.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 <= -245.0) || !(y <= 8200000000000.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 <= -245.0) || !(y <= 8200000000000.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, -245.0], N[Not[LessEqual[y, 8200000000000.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 -245 \lor \neg \left(y \leq 8200000000000\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 < -245 or 8.2e12 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6440.3
Applied rewrites40.3%
if -245 < y < 8.2e12Initial 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-+.f6497.4
Applied rewrites97.4%
Taylor expanded in y around inf
Applied rewrites96.9%
Final simplification71.2%
(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 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6467.7
Applied rewrites67.7%
Final simplification67.7%
(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.f6461.4
Applied rewrites61.4%
Taylor expanded in y around 0
Applied rewrites32.8%
Final simplification32.8%
herbie shell --seed 2024338
(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))))