
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -9e+15) (not (<= x 0.62))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -9e+15) || !(x <= 0.62)) {
tmp = x - t_0;
} else {
tmp = cos(y) - 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 * sin(y)
if ((x <= (-9d+15)) .or. (.not. (x <= 0.62d0))) then
tmp = x - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -9e+15) || !(x <= 0.62)) {
tmp = x - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -9e+15) or not (x <= 0.62): tmp = x - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -9e+15) || !(x <= 0.62)) tmp = Float64(x - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -9e+15) || ~((x <= 0.62))) tmp = x - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -9e+15], N[Not[LessEqual[x, 0.62]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -9 \cdot 10^{+15} \lor \neg \left(x \leq 0.62\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -9e15 or 0.619999999999999996 < x Initial program 99.9%
Taylor expanded in z around -inf 75.0%
mul-1-neg75.0%
distribute-rgt-neg-in75.0%
distribute-lft-out--75.0%
mul-1-neg75.0%
remove-double-neg75.0%
+-commutative75.0%
Simplified75.0%
Taylor expanded in x around inf 74.6%
Taylor expanded in z around 0 99.6%
associate-*r*99.6%
neg-mul-199.6%
Simplified99.6%
if -9e15 < x < 0.619999999999999996Initial program 99.9%
Taylor expanded in x around 0 98.9%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.0) (not (<= z 1.0))) (* z (- (/ (+ x 1.0) z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.0) || !(z <= 1.0)) {
tmp = z * (((x + 1.0) / z) - sin(y));
} else {
tmp = x + cos(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 <= (-9.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = z * (((x + 1.0d0) / z) - sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.0) || !(z <= 1.0)) {
tmp = z * (((x + 1.0) / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.0) or not (z <= 1.0): tmp = z * (((x + 1.0) / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.0) || !(z <= 1.0)) tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.0) || ~((z <= 1.0))) tmp = z * (((x + 1.0) / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -9 or 1 < z Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 97.8%
if -9 < z < 1Initial program 100.0%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e+77) (not (<= z 85000.0))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e+77) || !(z <= 85000.0)) {
tmp = x - (z * sin(y));
} else {
tmp = x + cos(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 <= (-2.4d+77)) .or. (.not. (z <= 85000.0d0))) then
tmp = x - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e+77) || !(z <= 85000.0)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e+77) or not (z <= 85000.0): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4e+77) || !(z <= 85000.0)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4e+77) || ~((z <= 85000.0))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e+77], N[Not[LessEqual[z, 85000.0]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+77} \lor \neg \left(z \leq 85000\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.3999999999999999e77 or 85000 < z Initial program 99.8%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 86.3%
Taylor expanded in z around 0 86.4%
associate-*r*86.4%
neg-mul-186.4%
Simplified86.4%
if -2.3999999999999999e77 < z < 85000Initial program 100.0%
Taylor expanded in z around 0 95.9%
+-commutative95.9%
Simplified95.9%
Final simplification91.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.92e+217) (not (<= z 2.05e+133))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.92e+217) || !(z <= 2.05e+133)) {
tmp = z * -sin(y);
} else {
tmp = x + cos(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.92d+217)) .or. (.not. (z <= 2.05d+133))) then
tmp = z * -sin(y)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.92e+217) || !(z <= 2.05e+133)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.92e+217) or not (z <= 2.05e+133): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.92e+217) || !(z <= 2.05e+133)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.92e+217) || ~((z <= 2.05e+133))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.92e+217], N[Not[LessEqual[z, 2.05e+133]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.92 \cdot 10^{+217} \lor \neg \left(z \leq 2.05 \cdot 10^{+133}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.9199999999999999e217 or 2.05000000000000002e133 < z Initial program 99.8%
Taylor expanded in z around inf 78.3%
associate-*r*78.3%
neg-mul-178.3%
*-commutative78.3%
Simplified78.3%
if -1.9199999999999999e217 < z < 2.05000000000000002e133Initial program 99.9%
Taylor expanded in z around 0 86.4%
+-commutative86.4%
Simplified86.4%
Final simplification84.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -72000000.0) (not (<= y 4e+82))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -72000000.0) || !(y <= 4e+82)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (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 ((y <= (-72000000.0d0)) .or. (.not. (y <= 4d+82))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -72000000.0) || !(y <= 4e+82)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -72000000.0) or not (y <= 4e+82): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -72000000.0) || !(y <= 4e+82)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -72000000.0) || ~((y <= 4e+82))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -72000000.0], N[Not[LessEqual[y, 4e+82]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -72000000 \lor \neg \left(y \leq 4 \cdot 10^{+82}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -7.2e7 or 3.9999999999999999e82 < y Initial program 99.9%
Taylor expanded in z around 0 65.9%
+-commutative65.9%
Simplified65.9%
if -7.2e7 < y < 3.9999999999999999e82Initial program 100.0%
Taylor expanded in y around 0 95.3%
mul-1-neg95.3%
unsub-neg95.3%
Simplified95.3%
Final simplification82.2%
(FPCore (x y z)
:precision binary64
(if (<= y -3e+28)
(+ x 1.0)
(if (<= y 5.1e+92)
(+ 1.0 (- x (* y z)))
(* x (+ 1.0 (/ 1.0 (* z (/ x z))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3e+28) {
tmp = x + 1.0;
} else if (y <= 5.1e+92) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / (z * (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) :: tmp
if (y <= (-3d+28)) then
tmp = x + 1.0d0
else if (y <= 5.1d+92) then
tmp = 1.0d0 + (x - (y * z))
else
tmp = x * (1.0d0 + (1.0d0 / (z * (x / z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3e+28) {
tmp = x + 1.0;
} else if (y <= 5.1e+92) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / (z * (x / z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3e+28: tmp = x + 1.0 elif y <= 5.1e+92: tmp = 1.0 + (x - (y * z)) else: tmp = x * (1.0 + (1.0 / (z * (x / z)))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3e+28) tmp = Float64(x + 1.0); elseif (y <= 5.1e+92) tmp = Float64(1.0 + Float64(x - Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / Float64(z * Float64(x / z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3e+28) tmp = x + 1.0; elseif (y <= 5.1e+92) tmp = 1.0 + (x - (y * z)); else tmp = x * (1.0 + (1.0 / (z * (x / z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3e+28], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 5.1e+92], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / N[(z * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+28}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+92}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{z \cdot \frac{x}{z}}\right)\\
\end{array}
\end{array}
if y < -3.0000000000000001e28Initial program 99.9%
Taylor expanded in y around 0 35.8%
+-commutative35.8%
Simplified35.8%
if -3.0000000000000001e28 < y < 5.1000000000000003e92Initial program 100.0%
Taylor expanded in y around 0 93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
if 5.1000000000000003e92 < y Initial program 99.8%
Taylor expanded in z around -inf 91.5%
mul-1-neg91.5%
distribute-rgt-neg-in91.5%
distribute-lft-out--91.5%
mul-1-neg91.5%
remove-double-neg91.5%
+-commutative91.5%
Simplified91.5%
Taylor expanded in x around inf 87.6%
associate-/l*70.8%
Simplified70.8%
Taylor expanded in y around 0 31.0%
*-commutative31.0%
Simplified31.0%
un-div-inv31.1%
clear-num31.1%
associate-*r/33.2%
Applied egg-rr33.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+31) (not (<= y 4e+82))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+31) || !(y <= 4e+82)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 ((y <= (-1.05d+31)) .or. (.not. (y <= 4d+82))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+31) || !(y <= 4e+82)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.05e+31) or not (y <= 4e+82): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+31) || !(y <= 4e+82)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+31) || ~((y <= 4e+82))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+31], N[Not[LessEqual[y, 4e+82]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+31} \lor \neg \left(y \leq 4 \cdot 10^{+82}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.04999999999999989e31 or 3.9999999999999999e82 < y Initial program 99.9%
Taylor expanded in y around 0 33.9%
+-commutative33.9%
Simplified33.9%
if -1.04999999999999989e31 < y < 3.9999999999999999e82Initial program 100.0%
Taylor expanded in y around 0 94.8%
mul-1-neg94.8%
unsub-neg94.8%
Simplified94.8%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e+223) (not (<= z 2.95e+123))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e+223) || !(z <= 2.95e+123)) {
tmp = x - (y * z);
} else {
tmp = x + 1.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) :: tmp
if ((z <= (-3.8d+223)) .or. (.not. (z <= 2.95d+123))) then
tmp = x - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e+223) || !(z <= 2.95e+123)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e+223) or not (z <= 2.95e+123): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e+223) || !(z <= 2.95e+123)) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.8e+223) || ~((z <= 2.95e+123))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e+223], N[Not[LessEqual[z, 2.95e+123]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+223} \lor \neg \left(z \leq 2.95 \cdot 10^{+123}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -3.8e223 or 2.9500000000000001e123 < z Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 93.7%
Taylor expanded in x around inf 66.4%
distribute-rgt-in66.4%
*-lft-identity66.4%
+-commutative66.4%
*-commutative66.4%
associate-*l*66.4%
neg-mul-166.4%
remove-double-neg66.4%
neg-mul-166.4%
distribute-rgt-in66.4%
metadata-eval66.4%
sub-neg66.4%
*-commutative66.4%
*-commutative66.4%
associate-/l*54.2%
fma-neg54.2%
metadata-eval54.2%
Simplified54.2%
Taylor expanded in y around 0 50.9%
mul-1-neg50.9%
unsub-neg50.9%
Simplified50.9%
if -3.8e223 < z < 2.9500000000000001e123Initial program 99.9%
Taylor expanded in y around 0 68.2%
+-commutative68.2%
Simplified68.2%
Final simplification64.7%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 59.3%
+-commutative59.3%
Simplified59.3%
(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%
Taylor expanded in x around inf 39.4%
herbie shell --seed 2024108
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))