
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.6e+28) (not (<= t 2.75e+17))) (+ x (/ y (/ t (- z a)))) (+ (+ x y) (/ (- t z) (/ (- a t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.6e+28) || !(t <= 2.75e+17)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) + ((t - z) / ((a - t) / 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 <= (-2.6d+28)) .or. (.not. (t <= 2.75d+17))) then
tmp = x + (y / (t / (z - a)))
else
tmp = (x + y) + ((t - z) / ((a - t) / 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 <= -2.6e+28) || !(t <= 2.75e+17)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) + ((t - z) / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.6e+28) or not (t <= 2.75e+17): tmp = x + (y / (t / (z - a))) else: tmp = (x + y) + ((t - z) / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.6e+28) || !(t <= 2.75e+17)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); else tmp = Float64(Float64(x + y) + Float64(Float64(t - z) / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.6e+28) || ~((t <= 2.75e+17))) tmp = x + (y / (t / (z - a))); else tmp = (x + y) + ((t - z) / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.6e+28], N[Not[LessEqual[t, 2.75e+17]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(N[(t - z), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+28} \lor \neg \left(t \leq 2.75 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \frac{t - z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if t < -2.6000000000000002e28 or 2.75e17 < t Initial program 60.5%
sub-neg60.5%
distribute-frac-neg60.5%
distribute-rgt-neg-out60.5%
+-commutative60.5%
associate-*l/68.2%
distribute-rgt-neg-in68.2%
distribute-lft-neg-in68.2%
distribute-frac-neg68.2%
fma-def68.2%
sub-neg68.2%
distribute-neg-in68.2%
remove-double-neg68.2%
+-commutative68.2%
sub-neg68.2%
Simplified68.2%
Taylor expanded in t around inf 76.1%
associate-+r+85.4%
distribute-rgt1-in85.4%
metadata-eval85.4%
mul0-lft85.4%
associate-/l*94.2%
Simplified94.2%
if -2.6000000000000002e28 < t < 2.75e17Initial program 91.8%
associate-*l/93.1%
Simplified93.1%
associate-/r/94.4%
Applied egg-rr94.4%
Final simplification94.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.25e+27) (not (<= t 2.6e+17))) (+ x (/ y (/ t (- z a)))) (+ (+ x y) (* (/ y (- a t)) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.25e+27) || !(t <= 2.6e+17)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) + ((y / (a - t)) * (t - z));
}
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 <= (-2.25d+27)) .or. (.not. (t <= 2.6d+17))) then
tmp = x + (y / (t / (z - a)))
else
tmp = (x + y) + ((y / (a - t)) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.25e+27) || !(t <= 2.6e+17)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) + ((y / (a - t)) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.25e+27) or not (t <= 2.6e+17): tmp = x + (y / (t / (z - a))) else: tmp = (x + y) + ((y / (a - t)) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.25e+27) || !(t <= 2.6e+17)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); else tmp = Float64(Float64(x + y) + Float64(Float64(y / Float64(a - t)) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.25e+27) || ~((t <= 2.6e+17))) tmp = x + (y / (t / (z - a))); else tmp = (x + y) + ((y / (a - t)) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.25e+27], N[Not[LessEqual[t, 2.6e+17]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+27} \lor \neg \left(t \leq 2.6 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \frac{y}{a - t} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if t < -2.25e27 or 2.6e17 < t Initial program 60.5%
sub-neg60.5%
distribute-frac-neg60.5%
distribute-rgt-neg-out60.5%
+-commutative60.5%
associate-*l/68.2%
distribute-rgt-neg-in68.2%
distribute-lft-neg-in68.2%
distribute-frac-neg68.2%
fma-def68.2%
sub-neg68.2%
distribute-neg-in68.2%
remove-double-neg68.2%
+-commutative68.2%
sub-neg68.2%
Simplified68.2%
Taylor expanded in t around inf 76.1%
associate-+r+85.4%
distribute-rgt1-in85.4%
metadata-eval85.4%
mul0-lft85.4%
associate-/l*94.2%
Simplified94.2%
if -2.25e27 < t < 2.6e17Initial program 91.8%
associate-*l/93.1%
Simplified93.1%
Taylor expanded in y around 0 91.8%
*-commutative91.8%
associate-*r/94.4%
Simplified94.4%
Final simplification94.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.9e+60) (not (<= a 1.3e+119))) (- (+ x y) (* z (/ y a))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.9e+60) || !(a <= 1.3e+119)) {
tmp = (x + y) - (z * (y / a));
} else {
tmp = x + (y / (t / z));
}
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 ((a <= (-1.9d+60)) .or. (.not. (a <= 1.3d+119))) then
tmp = (x + y) - (z * (y / a))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.9e+60) || !(a <= 1.3e+119)) {
tmp = (x + y) - (z * (y / a));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.9e+60) or not (a <= 1.3e+119): tmp = (x + y) - (z * (y / a)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.9e+60) || !(a <= 1.3e+119)) tmp = Float64(Float64(x + y) - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.9e+60) || ~((a <= 1.3e+119))) tmp = (x + y) - (z * (y / a)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.9e+60], N[Not[LessEqual[a, 1.3e+119]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+60} \lor \neg \left(a \leq 1.3 \cdot 10^{+119}\right):\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -1.90000000000000005e60 or 1.3e119 < a Initial program 89.0%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in t around 0 85.5%
associate-/l*91.1%
associate-/r/92.4%
Applied egg-rr92.4%
if -1.90000000000000005e60 < a < 1.3e119Initial program 71.3%
associate-*l/75.1%
Simplified75.1%
Taylor expanded in y around 0 71.3%
*-commutative71.3%
associate-*r/75.3%
Simplified75.3%
Taylor expanded in t around inf 80.7%
associate--l+80.7%
distribute-lft-out--80.7%
div-sub81.3%
mul-1-neg81.3%
unsub-neg81.3%
*-commutative81.3%
distribute-lft-out--81.3%
Simplified81.3%
Taylor expanded in a around 0 80.5%
sub-neg80.5%
mul-1-neg80.5%
remove-double-neg80.5%
+-commutative80.5%
associate-/l*82.7%
Simplified82.7%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -45000000000000.0) (not (<= t 1.5e+14))) (+ x (/ y (/ t (- z a)))) (- (+ x y) (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -45000000000000.0) || !(t <= 1.5e+14)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) - (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 <= (-45000000000000.0d0)) .or. (.not. (t <= 1.5d+14))) then
tmp = x + (y / (t / (z - a)))
else
tmp = (x + y) - (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 <= -45000000000000.0) || !(t <= 1.5e+14)) {
tmp = x + (y / (t / (z - a)));
} else {
tmp = (x + y) - (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -45000000000000.0) or not (t <= 1.5e+14): tmp = x + (y / (t / (z - a))) else: tmp = (x + y) - (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -45000000000000.0) || !(t <= 1.5e+14)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); else tmp = Float64(Float64(x + y) - Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -45000000000000.0) || ~((t <= 1.5e+14))) tmp = x + (y / (t / (z - a))); else tmp = (x + y) - (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -45000000000000.0], N[Not[LessEqual[t, 1.5e+14]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -45000000000000 \lor \neg \left(t \leq 1.5 \cdot 10^{+14}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.5e13 or 1.5e14 < t Initial program 62.1%
sub-neg62.1%
distribute-frac-neg62.1%
distribute-rgt-neg-out62.1%
+-commutative62.1%
associate-*l/69.5%
distribute-rgt-neg-in69.5%
distribute-lft-neg-in69.5%
distribute-frac-neg69.5%
fma-def69.5%
sub-neg69.5%
distribute-neg-in69.5%
remove-double-neg69.5%
+-commutative69.5%
sub-neg69.5%
Simplified69.5%
Taylor expanded in t around inf 77.0%
associate-+r+86.0%
distribute-rgt1-in86.0%
metadata-eval86.0%
mul0-lft86.0%
associate-/l*94.4%
Simplified94.4%
if -4.5e13 < t < 1.5e14Initial program 91.4%
associate-*l/92.8%
Simplified92.8%
Taylor expanded in t around 0 79.0%
associate-/l*80.6%
associate-/r/81.6%
Applied egg-rr81.6%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6.5e+72) (not (<= a 1.3e+119))) (+ x y) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.5e+72) || !(a <= 1.3e+119)) {
tmp = x + y;
} else {
tmp = x + (y / (t / z));
}
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 ((a <= (-6.5d+72)) .or. (.not. (a <= 1.3d+119))) then
tmp = x + y
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.5e+72) || !(a <= 1.3e+119)) {
tmp = x + y;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -6.5e+72) or not (a <= 1.3e+119): tmp = x + y else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6.5e+72) || !(a <= 1.3e+119)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -6.5e+72) || ~((a <= 1.3e+119))) tmp = x + y; else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6.5e+72], N[Not[LessEqual[a, 1.3e+119]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+72} \lor \neg \left(a \leq 1.3 \cdot 10^{+119}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -6.5000000000000001e72 or 1.3e119 < a Initial program 89.6%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in a around inf 87.6%
+-commutative87.6%
Simplified87.6%
if -6.5000000000000001e72 < a < 1.3e119Initial program 71.4%
associate-*l/75.1%
Simplified75.1%
Taylor expanded in y around 0 71.4%
*-commutative71.4%
associate-*r/74.9%
Simplified74.9%
Taylor expanded in t around inf 80.0%
associate--l+80.0%
distribute-lft-out--80.0%
div-sub80.6%
mul-1-neg80.6%
unsub-neg80.6%
*-commutative80.6%
distribute-lft-out--80.6%
Simplified80.6%
Taylor expanded in a around 0 79.9%
sub-neg79.9%
mul-1-neg79.9%
remove-double-neg79.9%
+-commutative79.9%
associate-/l*82.0%
Simplified82.0%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1e+28) x (if (<= t 1.1e+68) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e+28) {
tmp = x;
} else if (t <= 1.1e+68) {
tmp = x + 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 (t <= (-1d+28)) then
tmp = x
else if (t <= 1.1d+68) then
tmp = x + 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 (t <= -1e+28) {
tmp = x;
} else if (t <= 1.1e+68) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1e+28: tmp = x elif t <= 1.1e+68: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1e+28) tmp = x; elseif (t <= 1.1e+68) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1e+28) tmp = x; elseif (t <= 1.1e+68) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+28], x, If[LessEqual[t, 1.1e+68], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.99999999999999958e27 or 1.09999999999999994e68 < t Initial program 59.8%
associate-*l/68.2%
Simplified68.2%
Taylor expanded in x around inf 73.1%
if -9.99999999999999958e27 < t < 1.09999999999999994e68Initial program 90.3%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in a around inf 65.2%
+-commutative65.2%
Simplified65.2%
Final simplification68.6%
(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 77.3%
associate-*l/81.6%
Simplified81.6%
Taylor expanded in x around inf 56.6%
Final simplification56.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (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) :: t_2
real(8) :: tmp
t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (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 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024027
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))