
(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 z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= x -5.4e+19)
(+ z x)
(if (<= x -2.7e-289)
t_0
(if (<= x 8.2e-274) (sin y) (if (<= x 2.6e-34) t_0 (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -5.4e+19) {
tmp = z + x;
} else if (x <= -2.7e-289) {
tmp = t_0;
} else if (x <= 8.2e-274) {
tmp = sin(y);
} else if (x <= 2.6e-34) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (x <= (-5.4d+19)) then
tmp = z + x
else if (x <= (-2.7d-289)) then
tmp = t_0
else if (x <= 8.2d-274) then
tmp = sin(y)
else if (x <= 2.6d-34) then
tmp = t_0
else
tmp = z + x
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 (x <= -5.4e+19) {
tmp = z + x;
} else if (x <= -2.7e-289) {
tmp = t_0;
} else if (x <= 8.2e-274) {
tmp = Math.sin(y);
} else if (x <= 2.6e-34) {
tmp = t_0;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -5.4e+19: tmp = z + x elif x <= -2.7e-289: tmp = t_0 elif x <= 8.2e-274: tmp = math.sin(y) elif x <= 2.6e-34: tmp = t_0 else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -5.4e+19) tmp = Float64(z + x); elseif (x <= -2.7e-289) tmp = t_0; elseif (x <= 8.2e-274) tmp = sin(y); elseif (x <= 2.6e-34) tmp = t_0; else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -5.4e+19) tmp = z + x; elseif (x <= -2.7e-289) tmp = t_0; elseif (x <= 8.2e-274) tmp = sin(y); elseif (x <= 2.6e-34) tmp = t_0; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.4e+19], N[(z + x), $MachinePrecision], If[LessEqual[x, -2.7e-289], t$95$0, If[LessEqual[x, 8.2e-274], N[Sin[y], $MachinePrecision], If[LessEqual[x, 2.6e-34], t$95$0, N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{+19}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-289}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-274}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -5.4e19 or 2.5999999999999999e-34 < x Initial program 99.9%
Taylor expanded in y around 0 86.8%
+-commutative86.8%
Simplified86.8%
if -5.4e19 < x < -2.7e-289 or 8.19999999999999975e-274 < x < 2.5999999999999999e-34Initial program 99.8%
Taylor expanded in z around inf 64.4%
if -2.7e-289 < x < 8.19999999999999975e-274Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.8%
associate-*l*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
pow-base-199.4%
*-commutative99.4%
*-lft-identity99.4%
fma-udef99.4%
Simplified99.4%
Taylor expanded in z around 0 81.0%
Final simplification77.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.7e-11)
t_0
(if (<= z 8e-77) (+ x (sin y)) (if (<= z 4.9e+179) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.7e-11) {
tmp = t_0;
} else if (z <= 8e-77) {
tmp = x + sin(y);
} else if (z <= 4.9e+179) {
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 = z * cos(y)
if (z <= (-1.7d-11)) then
tmp = t_0
else if (z <= 8d-77) then
tmp = x + sin(y)
else if (z <= 4.9d+179) 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 = z * Math.cos(y);
double tmp;
if (z <= -1.7e-11) {
tmp = t_0;
} else if (z <= 8e-77) {
tmp = x + Math.sin(y);
} else if (z <= 4.9e+179) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.7e-11: tmp = t_0 elif z <= 8e-77: tmp = x + math.sin(y) elif z <= 4.9e+179: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.7e-11) tmp = t_0; elseif (z <= 8e-77) tmp = Float64(x + sin(y)); elseif (z <= 4.9e+179) tmp = Float64(z + x); 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 <= -1.7e-11) tmp = t_0; elseif (z <= 8e-77) tmp = x + sin(y); elseif (z <= 4.9e+179) tmp = z + x; 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, -1.7e-11], t$95$0, If[LessEqual[z, 8e-77], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+179], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-77}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+179}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.6999999999999999e-11 or 4.8999999999999999e179 < z Initial program 99.8%
Taylor expanded in z around inf 82.5%
if -1.6999999999999999e-11 < z < 7.9999999999999994e-77Initial program 100.0%
Taylor expanded in z around 0 96.1%
+-commutative96.1%
Simplified96.1%
if 7.9999999999999994e-77 < z < 4.8999999999999999e179Initial program 99.9%
Taylor expanded in y around 0 73.5%
+-commutative73.5%
Simplified73.5%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.35e-11) (not (<= z 6e-77))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.35e-11) || !(z <= 6e-77)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(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 ((z <= (-1.35d-11)) .or. (.not. (z <= 6d-77))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.35e-11) || !(z <= 6e-77)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.35e-11) or not (z <= 6e-77): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.35e-11) || !(z <= 6e-77)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.35e-11) || ~((z <= 6e-77))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.35e-11], N[Not[LessEqual[z, 6e-77]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-11} \lor \neg \left(z \leq 6 \cdot 10^{-77}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.35000000000000002e-11 or 6.00000000000000033e-77 < z Initial program 99.8%
Taylor expanded in x around inf 97.2%
if -1.35000000000000002e-11 < z < 6.00000000000000033e-77Initial program 100.0%
Taylor expanded in z around 0 96.1%
+-commutative96.1%
Simplified96.1%
Final simplification96.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e-289) (not (<= x 9e-14))) (+ z x) (sin y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-289) || !(x <= 9e-14)) {
tmp = z + x;
} else {
tmp = sin(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 <= (-3.5d-289)) .or. (.not. (x <= 9d-14))) then
tmp = z + x
else
tmp = sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-289) || !(x <= 9e-14)) {
tmp = z + x;
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e-289) or not (x <= 9e-14): tmp = z + x else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e-289) || !(x <= 9e-14)) tmp = Float64(z + x); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.5e-289) || ~((x <= 9e-14))) tmp = z + x; else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e-289], N[Not[LessEqual[x, 9e-14]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[Sin[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-289} \lor \neg \left(x \leq 9 \cdot 10^{-14}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if x < -3.4999999999999999e-289 or 8.9999999999999995e-14 < x Initial program 99.9%
Taylor expanded in y around 0 77.8%
+-commutative77.8%
Simplified77.8%
if -3.4999999999999999e-289 < x < 8.9999999999999995e-14Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.5%
associate-*l*99.4%
fma-def99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 96.7%
+-commutative96.7%
pow-base-196.7%
*-commutative96.7%
*-lft-identity96.7%
fma-udef96.7%
Simplified96.7%
Taylor expanded in z around 0 50.2%
Final simplification70.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e+34) (not (<= y 9.5e-6))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+34) || !(y <= 9.5e-6)) {
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) :: tmp
if ((y <= (-5d+34)) .or. (.not. (y <= 9.5d-6))) 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 tmp;
if ((y <= -5e+34) || !(y <= 9.5e-6)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+34) or not (y <= 9.5e-6): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+34) || !(y <= 9.5e-6)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+34) || ~((y <= 9.5e-6))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+34], N[Not[LessEqual[y, 9.5e-6]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+34} \lor \neg \left(y \leq 9.5 \cdot 10^{-6}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -4.9999999999999998e34 or 9.5000000000000005e-6 < y Initial program 99.8%
Taylor expanded in y around 0 45.7%
+-commutative45.7%
Simplified45.7%
if -4.9999999999999998e34 < y < 9.5000000000000005e-6Initial program 100.0%
Taylor expanded in y around 0 92.2%
+-commutative92.2%
+-commutative92.2%
associate-+l+92.2%
Simplified92.2%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e+15) x (if (<= x 1.1e-37) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e+15) {
tmp = x;
} else if (x <= 1.1e-37) {
tmp = z + y;
} else {
tmp = 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 <= (-5.2d+15)) then
tmp = x
else if (x <= 1.1d-37) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e+15) {
tmp = x;
} else if (x <= 1.1e-37) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e+15: tmp = x elif x <= 1.1e-37: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e+15) tmp = x; elseif (x <= 1.1e-37) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.2e+15) tmp = x; elseif (x <= 1.1e-37) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e+15], x, If[LessEqual[x, 1.1e-37], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+15}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-37}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.2e15 or 1.10000000000000001e-37 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.7%
associate-*l*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 74.9%
if -5.2e15 < x < 1.10000000000000001e-37Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 94.0%
+-commutative94.0%
pow-base-194.0%
*-commutative94.0%
*-lft-identity94.0%
fma-udef94.0%
Simplified94.0%
Taylor expanded in y around 0 41.1%
Final simplification59.3%
(FPCore (x y z) :precision binary64 (if (<= x -4.6e+15) x (if (<= x 1.2e-37) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.6e+15) {
tmp = x;
} else if (x <= 1.2e-37) {
tmp = z;
} else {
tmp = 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 <= (-4.6d+15)) then
tmp = x
else if (x <= 1.2d-37) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.6e+15) {
tmp = x;
} else if (x <= 1.2e-37) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.6e+15: tmp = x elif x <= 1.2e-37: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.6e+15) tmp = x; elseif (x <= 1.2e-37) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.6e+15) tmp = x; elseif (x <= 1.2e-37) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.6e+15], x, If[LessEqual[x, 1.2e-37], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+15}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-37}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.6e15 or 1.19999999999999995e-37 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.7%
associate-*l*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 74.9%
if -4.6e15 < x < 1.19999999999999995e-37Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 94.0%
+-commutative94.0%
pow-base-194.0%
*-commutative94.0%
*-lft-identity94.0%
fma-udef94.0%
Simplified94.0%
Taylor expanded in y around 0 34.9%
Final simplification56.5%
(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 64.4%
+-commutative64.4%
Simplified64.4%
Final simplification64.4%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.6%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 43.1%
Final simplification43.1%
herbie shell --seed 2023310
(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))))