
(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 (+ 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-+.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 (* (cos y) z)) (t_1 (fma x (/ t_0 x) x))) (if (<= x -2.8e-34) t_1 (if (<= x 1.8e-18) (+ t_0 (sin y)) t_1))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double t_1 = fma(x, (t_0 / x), x);
double tmp;
if (x <= -2.8e-34) {
tmp = t_1;
} else if (x <= 1.8e-18) {
tmp = t_0 + sin(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) * z) t_1 = fma(x, Float64(t_0 / x), x) tmp = 0.0 if (x <= -2.8e-34) tmp = t_1; elseif (x <= 1.8e-18) tmp = Float64(t_0 + sin(y)); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(t$95$0 / x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -2.8e-34], t$95$1, If[LessEqual[x, 1.8e-18], N[(t$95$0 + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
t_1 := \mathsf{fma}\left(x, \frac{t\_0}{x}, x\right)\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-18}:\\
\;\;\;\;t\_0 + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.79999999999999997e-34 or 1.80000000000000005e-18 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6489.4
Applied rewrites89.4%
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
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites98.6%
if -2.79999999999999997e-34 < x < 1.80000000000000005e-18Initial program 99.8%
Taylor expanded in x around 0
lower-sin.f6497.3
Applied rewrites97.3%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma x (/ (* (cos y) z) x) x))) (if (<= x -2.8e-34) t_0 (if (<= x 1.8e-18) (fma z (cos y) (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(x, ((cos(y) * z) / x), x);
double tmp;
if (x <= -2.8e-34) {
tmp = t_0;
} else if (x <= 1.8e-18) {
tmp = fma(z, cos(y), sin(y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, Float64(Float64(cos(y) * z) / x), x) tmp = 0.0 if (x <= -2.8e-34) tmp = t_0; elseif (x <= 1.8e-18) 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[(N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -2.8e-34], t$95$0, If[LessEqual[x, 1.8e-18], 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, \frac{\cos y \cdot z}{x}, x\right)\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.79999999999999997e-34 or 1.80000000000000005e-18 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6489.4
Applied rewrites89.4%
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
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites98.6%
if -2.79999999999999997e-34 < x < 1.80000000000000005e-18Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6497.3
Applied rewrites97.3%
Final simplification98.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -2.3e+107)
t_0
(if (<= z 3.1e-18)
(+ (+ x (sin y)) (* z 1.0))
(if (<= z 3.1e+196) (fma x (/ t_0 x) x) t_0)))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -2.3e+107) {
tmp = t_0;
} else if (z <= 3.1e-18) {
tmp = (x + sin(y)) + (z * 1.0);
} else if (z <= 3.1e+196) {
tmp = fma(x, (t_0 / x), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -2.3e+107) tmp = t_0; elseif (z <= 3.1e-18) tmp = Float64(Float64(x + sin(y)) + Float64(z * 1.0)); elseif (z <= 3.1e+196) tmp = fma(x, Float64(t_0 / x), 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, -2.3e+107], t$95$0, If[LessEqual[z, 3.1e-18], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e+196], N[(x * N[(t$95$0 / x), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-18}:\\
\;\;\;\;\left(x + \sin y\right) + z \cdot 1\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+196}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t\_0}{x}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.3e107 or 3.1000000000000001e196 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6494.1
Applied rewrites94.1%
if -2.3e107 < z < 3.10000000000000007e-18Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites97.1%
if 3.10000000000000007e-18 < z < 3.1000000000000001e196Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6471.6
Applied rewrites71.6%
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
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites89.7%
Taylor expanded in z around inf
Applied rewrites88.4%
Final simplification94.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -2.3e+107)
t_0
(if (<= z -11500000000.0)
(+ z x)
(if (<= z 2.9e-46) (+ x (sin y)) (if (<= z 2.95e+122) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -2.3e+107) {
tmp = t_0;
} else if (z <= -11500000000.0) {
tmp = z + x;
} else if (z <= 2.9e-46) {
tmp = x + sin(y);
} else if (z <= 2.95e+122) {
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 <= (-2.3d+107)) then
tmp = t_0
else if (z <= (-11500000000.0d0)) then
tmp = z + x
else if (z <= 2.9d-46) then
tmp = x + sin(y)
else if (z <= 2.95d+122) 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 <= -2.3e+107) {
tmp = t_0;
} else if (z <= -11500000000.0) {
tmp = z + x;
} else if (z <= 2.9e-46) {
tmp = x + Math.sin(y);
} else if (z <= 2.95e+122) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -2.3e+107: tmp = t_0 elif z <= -11500000000.0: tmp = z + x elif z <= 2.9e-46: tmp = x + math.sin(y) elif z <= 2.95e+122: 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 <= -2.3e+107) tmp = t_0; elseif (z <= -11500000000.0) tmp = Float64(z + x); elseif (z <= 2.9e-46) tmp = Float64(x + sin(y)); elseif (z <= 2.95e+122) 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 <= -2.3e+107) tmp = t_0; elseif (z <= -11500000000.0) tmp = z + x; elseif (z <= 2.9e-46) tmp = x + sin(y); elseif (z <= 2.95e+122) 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, -2.3e+107], t$95$0, If[LessEqual[z, -11500000000.0], N[(z + x), $MachinePrecision], If[LessEqual[z, 2.9e-46], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.95e+122], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -11500000000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-46}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{+122}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.3e107 or 2.95000000000000016e122 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6486.7
Applied rewrites86.7%
if -2.3e107 < z < -1.15e10 or 2.90000000000000005e-46 < z < 2.95000000000000016e122Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
if -1.15e10 < z < 2.90000000000000005e-46Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6494.6
Applied rewrites94.6%
Final simplification89.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -2.3e+107)
t_0
(if (<= z 2.95e+122) (+ (+ x (sin y)) (* z 1.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -2.3e+107) {
tmp = t_0;
} else if (z <= 2.95e+122) {
tmp = (x + sin(y)) + (z * 1.0);
} 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 <= (-2.3d+107)) then
tmp = t_0
else if (z <= 2.95d+122) then
tmp = (x + sin(y)) + (z * 1.0d0)
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 <= -2.3e+107) {
tmp = t_0;
} else if (z <= 2.95e+122) {
tmp = (x + Math.sin(y)) + (z * 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -2.3e+107: tmp = t_0 elif z <= 2.95e+122: tmp = (x + math.sin(y)) + (z * 1.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -2.3e+107) tmp = t_0; elseif (z <= 2.95e+122) tmp = Float64(Float64(x + sin(y)) + Float64(z * 1.0)); 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 <= -2.3e+107) tmp = t_0; elseif (z <= 2.95e+122) tmp = (x + sin(y)) + (z * 1.0); 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, -2.3e+107], t$95$0, If[LessEqual[z, 2.95e+122], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{+122}:\\
\;\;\;\;\left(x + \sin y\right) + z \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.3e107 or 2.95000000000000016e122 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-cos.f6486.7
Applied rewrites86.7%
if -2.3e107 < z < 2.95000000000000016e122Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites94.2%
Final simplification92.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (sin y)))) (if (<= y -2.5e+18) t_0 (if (<= y 5.7e-8) (+ y (+ z x)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -2.5e+18) {
tmp = t_0;
} else if (y <= 5.7e-8) {
tmp = y + (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 = x + sin(y)
if (y <= (-2.5d+18)) then
tmp = t_0
else if (y <= 5.7d-8) then
tmp = y + (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 = x + Math.sin(y);
double tmp;
if (y <= -2.5e+18) {
tmp = t_0;
} else if (y <= 5.7e-8) {
tmp = y + (z + x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.sin(y) tmp = 0 if y <= -2.5e+18: tmp = t_0 elif y <= 5.7e-8: tmp = y + (z + x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -2.5e+18) tmp = t_0; elseif (y <= 5.7e-8) tmp = Float64(y + Float64(z + x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + sin(y); tmp = 0.0; if (y <= -2.5e+18) tmp = t_0; elseif (y <= 5.7e-8) tmp = y + (z + x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.5e+18], t$95$0, If[LessEqual[y, 5.7e-8], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{-8}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.5e18 or 5.70000000000000009e-8 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6468.9
Applied rewrites68.9%
if -2.5e18 < y < 5.70000000000000009e-8Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
Final simplification80.5%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e+50) (+ z x) (if (<= y 7.5e+27) (+ z (fma y (fma y (* z -0.5) 1.0) x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+50) {
tmp = z + x;
} else if (y <= 7.5e+27) {
tmp = z + fma(y, fma(y, (z * -0.5), 1.0), x);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -6.5e+50) tmp = Float64(z + x); elseif (y <= 7.5e+27) tmp = Float64(z + fma(y, fma(y, Float64(z * -0.5), 1.0), x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -6.5e+50], N[(z + x), $MachinePrecision], If[LessEqual[y, 7.5e+27], N[(z + N[(y * N[(y * N[(z * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+50}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+27}:\\
\;\;\;\;z + \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot -0.5, 1\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -6.5000000000000003e50 or 7.5000000000000002e27 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6448.8
Applied rewrites48.8%
if -6.5000000000000003e50 < y < 7.5000000000000002e27Initial 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-*.f6489.8
Applied rewrites89.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.95e+57) (+ z x) (if (<= y 1.3e+53) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+57) {
tmp = z + x;
} else if (y <= 1.3e+53) {
tmp = y + (z + x);
} 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 (y <= (-1.95d+57)) then
tmp = z + x
else if (y <= 1.3d+53) then
tmp = y + (z + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+57) {
tmp = z + x;
} else if (y <= 1.3e+53) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.95e+57: tmp = z + x elif y <= 1.3e+53: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.95e+57) tmp = Float64(z + x); elseif (y <= 1.3e+53) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.95e+57) tmp = z + x; elseif (y <= 1.3e+53) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.95e+57], N[(z + x), $MachinePrecision], If[LessEqual[y, 1.3e+53], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+57}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+53}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.94999999999999984e57 or 1.29999999999999999e53 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6450.5
Applied rewrites50.5%
if -1.94999999999999984e57 < y < 1.29999999999999999e53Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6484.2
Applied rewrites84.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.8e+14) (+ y x) (if (<= x 5.8e-38) (+ y z) (+ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.8e+14) {
tmp = y + x;
} else if (x <= 5.8e-38) {
tmp = y + z;
} else {
tmp = 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) :: tmp
if (x <= (-1.8d+14)) then
tmp = y + x
else if (x <= 5.8d-38) then
tmp = y + z
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.8e+14) {
tmp = y + x;
} else if (x <= 5.8e-38) {
tmp = y + z;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.8e+14: tmp = y + x elif x <= 5.8e-38: tmp = y + z else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.8e+14) tmp = Float64(y + x); elseif (x <= 5.8e-38) tmp = Float64(y + z); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.8e+14) tmp = y + x; elseif (x <= 5.8e-38) tmp = y + z; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.8e+14], N[(y + x), $MachinePrecision], If[LessEqual[x, 5.8e-38], N[(y + z), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+14}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-38}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if x < -1.8e14 or 5.79999999999999988e-38 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6490.6
Applied rewrites90.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6463.3
Applied rewrites63.3%
Taylor expanded in z around 0
Applied rewrites57.2%
if -1.8e14 < x < 5.79999999999999988e-38Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6434.4
Applied rewrites34.4%
Taylor expanded in y around 0
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6439.5
Applied rewrites39.5%
Taylor expanded in x around 0
Applied rewrites34.6%
(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-+.f6464.2
Applied rewrites64.2%
(FPCore (x y z) :precision binary64 (+ y x))
double code(double x, double y, double z) {
return y + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + x
end function
public static double code(double x, double y, double z) {
return y + x;
}
def code(x, y, z): return y + x
function code(x, y, z) return Float64(y + x) end
function tmp = code(x, y, z) tmp = y + x; end
code[x_, y_, z_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6464.2
Applied rewrites64.2%
Taylor expanded in y around 0
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6452.1
Applied rewrites52.1%
Taylor expanded in z around 0
Applied rewrites36.8%
herbie shell --seed 2024233
(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))))