
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -1.25e+194)
(not
(or (<= y -6.6e+156) (and (not (<= y -1.6e+23)) (<= y 2.1e+184)))))
(* (- t z) (/ y t))
(+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e+194) || !((y <= -6.6e+156) || (!(y <= -1.6e+23) && (y <= 2.1e+184)))) {
tmp = (t - z) * (y / t);
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.25d+194)) .or. (.not. (y <= (-6.6d+156)) .or. (.not. (y <= (-1.6d+23))) .and. (y <= 2.1d+184))) then
tmp = (t - z) * (y / t)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e+194) || !((y <= -6.6e+156) || (!(y <= -1.6e+23) && (y <= 2.1e+184)))) {
tmp = (t - z) * (y / t);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.25e+194) or not ((y <= -6.6e+156) or (not (y <= -1.6e+23) and (y <= 2.1e+184))): tmp = (t - z) * (y / t) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.25e+194) || !((y <= -6.6e+156) || (!(y <= -1.6e+23) && (y <= 2.1e+184)))) tmp = Float64(Float64(t - z) * Float64(y / t)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.25e+194) || ~(((y <= -6.6e+156) || (~((y <= -1.6e+23)) && (y <= 2.1e+184))))) tmp = (t - z) * (y / t); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.25e+194], N[Not[Or[LessEqual[y, -6.6e+156], And[N[Not[LessEqual[y, -1.6e+23]], $MachinePrecision], LessEqual[y, 2.1e+184]]]], $MachinePrecision]], N[(N[(t - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+194} \lor \neg \left(y \leq -6.6 \cdot 10^{+156} \lor \neg \left(y \leq -1.6 \cdot 10^{+23}\right) \land y \leq 2.1 \cdot 10^{+184}\right):\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -1.24999999999999997e194 or -6.5999999999999997e156 < y < -1.6e23 or 2.1e184 < y Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
associate-*l/69.5%
sub-neg69.5%
+-commutative69.5%
neg-sub069.5%
associate-+l-69.5%
sub0-neg69.5%
neg-mul-169.5%
times-frac94.7%
fma-def94.8%
sub-neg94.8%
+-commutative94.8%
neg-sub094.8%
associate-+l-94.8%
sub0-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-/l*94.8%
metadata-eval94.8%
/-rgt-identity94.8%
Simplified94.8%
Taylor expanded in y around -inf 57.2%
*-commutative57.2%
associate-*r/78.5%
Simplified78.5%
Taylor expanded in t around inf 54.3%
if -1.24999999999999997e194 < y < -6.5999999999999997e156 or -1.6e23 < y < 2.1e184Initial program 96.8%
+-commutative96.8%
*-commutative96.8%
associate-*l/93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
neg-mul-193.6%
times-frac96.2%
fma-def96.2%
sub-neg96.2%
+-commutative96.2%
neg-sub096.2%
associate-+l-96.2%
sub0-neg96.2%
neg-mul-196.2%
*-commutative96.2%
associate-/l*96.2%
metadata-eval96.2%
/-rgt-identity96.2%
Simplified96.2%
Taylor expanded in t around inf 76.3%
Final simplification69.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.95) (not (<= t 1.18e+86))) (+ x y) (+ x (/ (- z t) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.95) || !(t <= 1.18e+86)) {
tmp = x + y;
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-0.95d0)) .or. (.not. (t <= 1.18d+86))) then
tmp = x + y
else
tmp = x + ((z - t) / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.95) || !(t <= 1.18e+86)) {
tmp = x + y;
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -0.95) or not (t <= 1.18e+86): tmp = x + y else: tmp = x + ((z - t) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.95) || !(t <= 1.18e+86)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -0.95) || ~((t <= 1.18e+86))) tmp = x + y; else tmp = x + ((z - t) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.95], N[Not[LessEqual[t, 1.18e+86]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.95 \lor \neg \left(t \leq 1.18 \cdot 10^{+86}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -0.94999999999999996 or 1.18e86 < t Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/75.1%
sub-neg75.1%
+-commutative75.1%
neg-sub075.1%
associate-+l-75.1%
sub0-neg75.1%
neg-mul-175.1%
times-frac96.3%
fma-def96.3%
sub-neg96.3%
+-commutative96.3%
neg-sub096.3%
associate-+l-96.3%
sub0-neg96.3%
neg-mul-196.3%
*-commutative96.3%
associate-/l*96.3%
metadata-eval96.3%
/-rgt-identity96.3%
Simplified96.3%
Taylor expanded in t around inf 81.4%
if -0.94999999999999996 < t < 1.18e86Initial program 96.2%
Taylor expanded in a around inf 79.8%
associate-/l*83.9%
Simplified83.9%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e+202) (and (not (<= z 5.8e+182)) (<= z 2.3e+257))) (* z (/ (- y) t)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+202) || (!(z <= 5.8e+182) && (z <= 2.3e+257))) {
tmp = z * (-y / t);
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7.5d+202)) .or. (.not. (z <= 5.8d+182)) .and. (z <= 2.3d+257)) then
tmp = z * (-y / t)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+202) || (!(z <= 5.8e+182) && (z <= 2.3e+257))) {
tmp = z * (-y / t);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.5e+202) or (not (z <= 5.8e+182) and (z <= 2.3e+257)): tmp = z * (-y / t) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e+202) || (!(z <= 5.8e+182) && (z <= 2.3e+257))) tmp = Float64(z * Float64(Float64(-y) / t)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.5e+202) || (~((z <= 5.8e+182)) && (z <= 2.3e+257))) tmp = z * (-y / t); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e+202], And[N[Not[LessEqual[z, 5.8e+182]], $MachinePrecision], LessEqual[z, 2.3e+257]]], N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+202} \lor \neg \left(z \leq 5.8 \cdot 10^{+182}\right) \land z \leq 2.3 \cdot 10^{+257}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7.4999999999999999e202 or 5.7999999999999997e182 < z < 2.3e257Initial program 88.7%
+-commutative88.7%
*-commutative88.7%
associate-*l/84.4%
sub-neg84.4%
+-commutative84.4%
neg-sub084.4%
associate-+l-84.4%
sub0-neg84.4%
neg-mul-184.4%
times-frac99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
metadata-eval99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in z around inf 66.5%
mul-1-neg66.5%
associate-/l*70.2%
distribute-neg-frac70.2%
Simplified70.2%
Taylor expanded in t around inf 46.7%
Taylor expanded in y around 0 46.9%
associate-*r/46.9%
/-rgt-identity46.9%
associate-/r/46.9%
associate-*l/46.8%
*-commutative46.8%
associate-/r/46.8%
/-rgt-identity46.8%
*-commutative46.8%
associate-*l*51.1%
*-commutative51.1%
associate-*l/51.3%
neg-mul-151.3%
Simplified51.3%
if -7.4999999999999999e202 < z < 5.7999999999999997e182 or 2.3e257 < z Initial program 99.5%
+-commutative99.5%
*-commutative99.5%
associate-*l/87.1%
sub-neg87.1%
+-commutative87.1%
neg-sub087.1%
associate-+l-87.1%
sub0-neg87.1%
neg-mul-187.1%
times-frac95.0%
fma-def95.0%
sub-neg95.0%
+-commutative95.0%
neg-sub095.0%
associate-+l-95.0%
sub0-neg95.0%
neg-mul-195.0%
*-commutative95.0%
associate-/l*95.0%
metadata-eval95.0%
/-rgt-identity95.0%
Simplified95.0%
Taylor expanded in t around inf 71.1%
Final simplification67.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.5) (not (<= t 4050000000.0))) (+ x y) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5) || !(t <= 4050000000.0)) {
tmp = x + y;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-3.5d0)) .or. (.not. (t <= 4050000000.0d0))) then
tmp = x + y
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5) || !(t <= 4050000000.0)) {
tmp = x + y;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.5) or not (t <= 4050000000.0): tmp = x + y else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.5) || !(t <= 4050000000.0)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.5) || ~((t <= 4050000000.0))) tmp = x + y; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.5], N[Not[LessEqual[t, 4050000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \lor \neg \left(t \leq 4050000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -3.5 or 4.05e9 < t Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/79.1%
sub-neg79.1%
+-commutative79.1%
neg-sub079.1%
associate-+l-79.1%
sub0-neg79.1%
neg-mul-179.1%
times-frac96.9%
fma-def96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
neg-mul-196.9%
*-commutative96.9%
associate-/l*96.9%
metadata-eval96.9%
/-rgt-identity96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -3.5 < t < 4.05e9Initial program 95.6%
+-commutative95.6%
*-commutative95.6%
associate-*l/93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
neg-mul-193.6%
times-frac94.8%
fma-def94.8%
sub-neg94.8%
+-commutative94.8%
neg-sub094.8%
associate-+l-94.8%
sub0-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-/l*94.8%
metadata-eval94.8%
/-rgt-identity94.8%
Simplified94.8%
Taylor expanded in t around 0 78.4%
associate-/l*82.4%
Simplified82.4%
associate-/r/82.4%
Applied egg-rr82.4%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.105) (not (<= t 4400000.0))) (+ x y) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.105) || !(t <= 4400000.0)) {
tmp = x + y;
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-0.105d0)) .or. (.not. (t <= 4400000.0d0))) then
tmp = x + y
else
tmp = x + (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.105) || !(t <= 4400000.0)) {
tmp = x + y;
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -0.105) or not (t <= 4400000.0): tmp = x + y else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.105) || !(t <= 4400000.0)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -0.105) || ~((t <= 4400000.0))) tmp = x + y; else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.105], N[Not[LessEqual[t, 4400000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.105 \lor \neg \left(t \leq 4400000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -0.104999999999999996 or 4.4e6 < t Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/79.1%
sub-neg79.1%
+-commutative79.1%
neg-sub079.1%
associate-+l-79.1%
sub0-neg79.1%
neg-mul-179.1%
times-frac96.9%
fma-def96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
neg-mul-196.9%
*-commutative96.9%
associate-/l*96.9%
metadata-eval96.9%
/-rgt-identity96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -0.104999999999999996 < t < 4.4e6Initial program 95.6%
+-commutative95.6%
*-commutative95.6%
associate-*l/93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
neg-mul-193.6%
times-frac94.8%
fma-def94.8%
sub-neg94.8%
+-commutative94.8%
neg-sub094.8%
associate-+l-94.8%
sub0-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-/l*94.8%
metadata-eval94.8%
/-rgt-identity94.8%
Simplified94.8%
Taylor expanded in t around 0 78.4%
associate-/l*82.4%
Simplified82.4%
associate-/r/82.4%
Applied egg-rr82.4%
*-commutative82.4%
clear-num82.4%
un-div-inv83.5%
Applied egg-rr83.5%
Final simplification81.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -0.085) (+ x y) (if (<= t 25000000.0) (+ x (* y (/ z a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -0.085) {
tmp = x + y;
} else if (t <= 25000000.0) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-0.085d0)) then
tmp = x + y
else if (t <= 25000000.0d0) then
tmp = x + (y * (z / a))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -0.085) {
tmp = x + y;
} else if (t <= 25000000.0) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -0.085: tmp = x + y elif t <= 25000000.0: tmp = x + (y * (z / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -0.085) tmp = Float64(x + y); elseif (t <= 25000000.0) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -0.085) tmp = x + y; elseif (t <= 25000000.0) tmp = x + (y * (z / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -0.085], N[(x + y), $MachinePrecision], If[LessEqual[t, 25000000.0], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.085:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 25000000:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -0.0850000000000000061 or 2.5e7 < t Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/79.1%
sub-neg79.1%
+-commutative79.1%
neg-sub079.1%
associate-+l-79.1%
sub0-neg79.1%
neg-mul-179.1%
times-frac96.9%
fma-def96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
neg-mul-196.9%
*-commutative96.9%
associate-/l*96.9%
metadata-eval96.9%
/-rgt-identity96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -0.0850000000000000061 < t < 2.5e7Initial program 95.6%
Taylor expanded in t around 0 81.1%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.75e-214) x (if (<= x 1.65e-22) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e-214) {
tmp = x;
} else if (x <= 1.65e-22) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-1.75d-214)) then
tmp = x
else if (x <= 1.65d-22) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e-214) {
tmp = x;
} else if (x <= 1.65e-22) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.75e-214: tmp = x elif x <= 1.65e-22: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.75e-214) tmp = x; elseif (x <= 1.65e-22) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.75e-214) tmp = x; elseif (x <= 1.65e-22) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.75e-214], x, If[LessEqual[x, 1.65e-22], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-22}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.75e-214 or 1.65e-22 < x Initial program 97.8%
+-commutative97.8%
*-commutative97.8%
associate-*l/88.0%
sub-neg88.0%
+-commutative88.0%
neg-sub088.0%
associate-+l-88.0%
sub0-neg88.0%
neg-mul-188.0%
times-frac98.7%
fma-def98.7%
sub-neg98.7%
+-commutative98.7%
neg-sub098.7%
associate-+l-98.7%
sub0-neg98.7%
neg-mul-198.7%
*-commutative98.7%
associate-/l*98.7%
metadata-eval98.7%
/-rgt-identity98.7%
Simplified98.7%
Taylor expanded in y around 0 69.2%
if -1.75e-214 < x < 1.65e-22Initial program 97.5%
+-commutative97.5%
*-commutative97.5%
associate-*l/83.7%
sub-neg83.7%
+-commutative83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
times-frac89.5%
fma-def89.5%
sub-neg89.5%
+-commutative89.5%
neg-sub089.5%
associate-+l-89.5%
sub0-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-/l*89.5%
metadata-eval89.5%
/-rgt-identity89.5%
Simplified89.5%
Taylor expanded in y around -inf 70.7%
*-commutative70.7%
associate-*r/75.8%
Simplified75.8%
Taylor expanded in t around inf 47.3%
Taylor expanded in t around inf 33.0%
Final simplification57.7%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + y
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 97.7%
+-commutative97.7%
*-commutative97.7%
associate-*l/86.6%
sub-neg86.6%
+-commutative86.6%
neg-sub086.6%
associate-+l-86.6%
sub0-neg86.6%
neg-mul-186.6%
times-frac95.8%
fma-def95.8%
sub-neg95.8%
+-commutative95.8%
neg-sub095.8%
associate-+l-95.8%
sub0-neg95.8%
neg-mul-195.8%
*-commutative95.8%
associate-/l*95.8%
metadata-eval95.8%
/-rgt-identity95.8%
Simplified95.8%
Taylor expanded in t around inf 62.7%
Final simplification62.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.7%
+-commutative97.7%
*-commutative97.7%
associate-*l/86.6%
sub-neg86.6%
+-commutative86.6%
neg-sub086.6%
associate-+l-86.6%
sub0-neg86.6%
neg-mul-186.6%
times-frac95.8%
fma-def95.8%
sub-neg95.8%
+-commutative95.8%
neg-sub095.8%
associate-+l-95.8%
sub0-neg95.8%
neg-mul-195.8%
*-commutative95.8%
associate-/l*95.8%
metadata-eval95.8%
/-rgt-identity95.8%
Simplified95.8%
Taylor expanded in y around 0 52.3%
Final simplification52.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023257
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))