
(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 11 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
(let* ((t_1 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (or (<= t_1 -5e-290) (not (<= t_1 0.0)))
(fma (- z t) (/ y (- t a)) (+ x y))
(+ x (/ (* y (- z a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -5e-290) || !(t_1 <= 0.0)) {
tmp = fma((z - t), (y / (t - a)), (x + y));
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if ((t_1 <= -5e-290) || !(t_1 <= 0.0)) tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(x + y)); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-290], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-290} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.0000000000000001e-290 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 82.3%
sub-neg82.3%
+-commutative82.3%
distribute-frac-neg82.3%
distribute-rgt-neg-out82.3%
associate-/l*91.7%
fma-define91.7%
distribute-frac-neg91.7%
distribute-neg-frac291.7%
sub-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
+-commutative91.7%
sub-neg91.7%
Simplified91.7%
if -5.0000000000000001e-290 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 4.3%
Taylor expanded in t around inf 99.8%
associate--l+99.8%
distribute-lft-out--99.8%
div-sub99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification92.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (or (<= t_1 -5e-290) (not (<= t_1 0.0)))
(+ (+ x y) (* (- z t) (/ y (- t a))))
(+ x (/ (* y (- z a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -5e-290) || !(t_1 <= 0.0)) {
tmp = (x + y) + ((z - t) * (y / (t - a)));
} else {
tmp = x + ((y * (z - a)) / t);
}
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) + ((y * (z - t)) / (t - a))
if ((t_1 <= (-5d-290)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = (x + y) + ((z - t) * (y / (t - a)))
else
tmp = x + ((y * (z - a)) / t)
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) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -5e-290) || !(t_1 <= 0.0)) {
tmp = (x + y) + ((z - t) * (y / (t - a)));
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x + y) + ((y * (z - t)) / (t - a)) tmp = 0 if (t_1 <= -5e-290) or not (t_1 <= 0.0): tmp = (x + y) + ((z - t) * (y / (t - a))) else: tmp = x + ((y * (z - a)) / t) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if ((t_1 <= -5e-290) || !(t_1 <= 0.0)) tmp = Float64(Float64(x + y) + Float64(Float64(z - t) * Float64(y / Float64(t - a)))); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x + y) + ((y * (z - t)) / (t - a)); tmp = 0.0; if ((t_1 <= -5e-290) || ~((t_1 <= 0.0))) tmp = (x + y) + ((z - t) * (y / (t - a))); else tmp = x + ((y * (z - a)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-290], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-290} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\left(x + y\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.0000000000000001e-290 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 82.3%
associate-/l*91.7%
*-commutative91.7%
Applied egg-rr91.7%
if -5.0000000000000001e-290 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 4.3%
Taylor expanded in t around inf 99.8%
associate--l+99.8%
distribute-lft-out--99.8%
div-sub99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification92.5%
(FPCore (x y z t a)
:precision binary64
(if (or (<= z -4.6e+207)
(not
(or (<= z -1.4e+186) (and (not (<= z -4.9e+109)) (<= z 2.65e+194)))))
(* y (/ z (- t a)))
(+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.6e+207) || !((z <= -1.4e+186) || (!(z <= -4.9e+109) && (z <= 2.65e+194)))) {
tmp = y * (z / (t - 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 ((z <= (-4.6d+207)) .or. (.not. (z <= (-1.4d+186)) .or. (.not. (z <= (-4.9d+109))) .and. (z <= 2.65d+194))) then
tmp = y * (z / (t - 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 ((z <= -4.6e+207) || !((z <= -1.4e+186) || (!(z <= -4.9e+109) && (z <= 2.65e+194)))) {
tmp = y * (z / (t - a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.6e+207) or not ((z <= -1.4e+186) or (not (z <= -4.9e+109) and (z <= 2.65e+194))): tmp = y * (z / (t - a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.6e+207) || !((z <= -1.4e+186) || (!(z <= -4.9e+109) && (z <= 2.65e+194)))) tmp = Float64(y * Float64(z / Float64(t - a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.6e+207) || ~(((z <= -1.4e+186) || (~((z <= -4.9e+109)) && (z <= 2.65e+194))))) tmp = y * (z / (t - a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.6e+207], N[Not[Or[LessEqual[z, -1.4e+186], And[N[Not[LessEqual[z, -4.9e+109]], $MachinePrecision], LessEqual[z, 2.65e+194]]]], $MachinePrecision]], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+207} \lor \neg \left(z \leq -1.4 \cdot 10^{+186} \lor \neg \left(z \leq -4.9 \cdot 10^{+109}\right) \land z \leq 2.65 \cdot 10^{+194}\right):\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.59999999999999989e207 or -1.40000000000000009e186 < z < -4.9000000000000003e109 or 2.65000000000000002e194 < z Initial program 75.3%
sub-neg75.3%
+-commutative75.3%
distribute-frac-neg75.3%
distribute-rgt-neg-out75.3%
associate-/l*90.3%
fma-define90.4%
distribute-frac-neg90.4%
distribute-neg-frac290.4%
sub-neg90.4%
distribute-neg-in90.4%
remove-double-neg90.4%
+-commutative90.4%
sub-neg90.4%
Simplified90.4%
Taylor expanded in z around inf 54.2%
associate-/l*65.5%
Simplified65.5%
if -4.59999999999999989e207 < z < -1.40000000000000009e186 or -4.9000000000000003e109 < z < 2.65000000000000002e194Initial program 74.5%
Taylor expanded in a around inf 69.2%
+-commutative69.2%
Simplified69.2%
Final simplification68.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z (- t a)))))
(if (<= z -1.25e+208)
t_1
(if (<= z -1.25e+187)
(+ x y)
(if (<= z -1.2e+111)
(* z (/ y (- t a)))
(if (<= z 8e+191) (+ x y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / (t - a));
double tmp;
if (z <= -1.25e+208) {
tmp = t_1;
} else if (z <= -1.25e+187) {
tmp = x + y;
} else if (z <= -1.2e+111) {
tmp = z * (y / (t - a));
} else if (z <= 8e+191) {
tmp = x + y;
} 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 = y * (z / (t - a))
if (z <= (-1.25d+208)) then
tmp = t_1
else if (z <= (-1.25d+187)) then
tmp = x + y
else if (z <= (-1.2d+111)) then
tmp = z * (y / (t - a))
else if (z <= 8d+191) then
tmp = x + y
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 * (z / (t - a));
double tmp;
if (z <= -1.25e+208) {
tmp = t_1;
} else if (z <= -1.25e+187) {
tmp = x + y;
} else if (z <= -1.2e+111) {
tmp = z * (y / (t - a));
} else if (z <= 8e+191) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / (t - a)) tmp = 0 if z <= -1.25e+208: tmp = t_1 elif z <= -1.25e+187: tmp = x + y elif z <= -1.2e+111: tmp = z * (y / (t - a)) elif z <= 8e+191: tmp = x + y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(t - a))) tmp = 0.0 if (z <= -1.25e+208) tmp = t_1; elseif (z <= -1.25e+187) tmp = Float64(x + y); elseif (z <= -1.2e+111) tmp = Float64(z * Float64(y / Float64(t - a))); elseif (z <= 8e+191) tmp = Float64(x + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / (t - a)); tmp = 0.0; if (z <= -1.25e+208) tmp = t_1; elseif (z <= -1.25e+187) tmp = x + y; elseif (z <= -1.2e+111) tmp = z * (y / (t - a)); elseif (z <= 8e+191) tmp = x + y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+208], t$95$1, If[LessEqual[z, -1.25e+187], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.2e+111], N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+191], N[(x + y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t - a}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{+187}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{+111}:\\
\;\;\;\;z \cdot \frac{y}{t - a}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+191}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2500000000000001e208 or 8.00000000000000058e191 < z Initial program 75.6%
sub-neg75.6%
+-commutative75.6%
distribute-frac-neg75.6%
distribute-rgt-neg-out75.6%
associate-/l*92.2%
fma-define92.1%
distribute-frac-neg92.1%
distribute-neg-frac292.1%
sub-neg92.1%
distribute-neg-in92.1%
remove-double-neg92.1%
+-commutative92.1%
sub-neg92.1%
Simplified92.1%
Taylor expanded in z around inf 51.7%
associate-/l*63.7%
Simplified63.7%
if -1.2500000000000001e208 < z < -1.25e187 or -1.20000000000000003e111 < z < 8.00000000000000058e191Initial program 74.5%
Taylor expanded in a around inf 69.2%
+-commutative69.2%
Simplified69.2%
if -1.25e187 < z < -1.20000000000000003e111Initial program 73.8%
sub-neg73.8%
+-commutative73.8%
distribute-frac-neg73.8%
distribute-rgt-neg-out73.8%
associate-/l*82.4%
fma-define82.6%
distribute-frac-neg82.6%
distribute-neg-frac282.6%
sub-neg82.6%
distribute-neg-in82.6%
remove-double-neg82.6%
+-commutative82.6%
sub-neg82.6%
Simplified82.6%
Taylor expanded in z around inf 64.9%
associate-/l*73.5%
Applied egg-rr73.5%
*-commutative73.5%
associate-*l/64.9%
associate-*r/73.6%
Simplified73.6%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.2e-33) (not (<= a 1.25e-38))) (+ x y) (+ x (/ (* y (- z a)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.2e-33) || !(a <= 1.25e-38)) {
tmp = x + y;
} else {
tmp = x + ((y * (z - a)) / t);
}
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 <= (-8.2d-33)) .or. (.not. (a <= 1.25d-38))) then
tmp = x + y
else
tmp = x + ((y * (z - a)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.2e-33) || !(a <= 1.25e-38)) {
tmp = x + y;
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.2e-33) or not (a <= 1.25e-38): tmp = x + y else: tmp = x + ((y * (z - a)) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.2e-33) || !(a <= 1.25e-38)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -8.2e-33) || ~((a <= 1.25e-38))) tmp = x + y; else tmp = x + ((y * (z - a)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.2e-33], N[Not[LessEqual[a, 1.25e-38]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-33} \lor \neg \left(a \leq 1.25 \cdot 10^{-38}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if a < -8.2e-33 or 1.25000000000000008e-38 < a Initial program 77.2%
Taylor expanded in a around inf 74.6%
+-commutative74.6%
Simplified74.6%
if -8.2e-33 < a < 1.25000000000000008e-38Initial program 71.7%
Taylor expanded in t around inf 83.3%
associate--l+83.3%
distribute-lft-out--83.3%
div-sub84.1%
mul-1-neg84.1%
unsub-neg84.1%
*-commutative84.1%
distribute-lft-out--84.1%
Simplified84.1%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7.5e-36) (not (<= a 0.00155))) (+ x y) (+ x (/ (- z a) (/ t y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7.5e-36) || !(a <= 0.00155)) {
tmp = x + y;
} else {
tmp = x + ((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 ((a <= (-7.5d-36)) .or. (.not. (a <= 0.00155d0))) then
tmp = x + y
else
tmp = x + ((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 ((a <= -7.5e-36) || !(a <= 0.00155)) {
tmp = x + y;
} else {
tmp = x + ((z - a) / (t / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7.5e-36) or not (a <= 0.00155): tmp = x + y else: tmp = x + ((z - a) / (t / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7.5e-36) || !(a <= 0.00155)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(z - a) / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7.5e-36) || ~((a <= 0.00155))) tmp = x + y; else tmp = x + ((z - a) / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7.5e-36], N[Not[LessEqual[a, 0.00155]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(z - a), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{-36} \lor \neg \left(a \leq 0.00155\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\
\end{array}
\end{array}
if a < -7.49999999999999972e-36 or 0.00154999999999999995 < a Initial program 76.9%
Taylor expanded in a around inf 77.0%
+-commutative77.0%
Simplified77.0%
if -7.49999999999999972e-36 < a < 0.00154999999999999995Initial program 72.3%
Taylor expanded in t around inf 80.2%
associate--l+80.2%
distribute-lft-out--80.2%
div-sub81.0%
mul-1-neg81.0%
unsub-neg81.0%
*-commutative81.0%
distribute-lft-out--81.0%
Simplified81.0%
div-inv80.9%
*-commutative80.9%
associate-*l*82.3%
Applied egg-rr82.3%
div-inv82.4%
clear-num82.3%
un-div-inv82.3%
Applied egg-rr82.3%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.5e-36) (not (<= a 2.6e-48))) (- (+ x y) (* y (/ z a))) (+ x (/ (- z a) (/ t y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.5e-36) || !(a <= 2.6e-48)) {
tmp = (x + y) - (y * (z / a));
} else {
tmp = x + ((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 ((a <= (-1.5d-36)) .or. (.not. (a <= 2.6d-48))) then
tmp = (x + y) - (y * (z / a))
else
tmp = x + ((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 ((a <= -1.5e-36) || !(a <= 2.6e-48)) {
tmp = (x + y) - (y * (z / a));
} else {
tmp = x + ((z - a) / (t / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.5e-36) or not (a <= 2.6e-48): tmp = (x + y) - (y * (z / a)) else: tmp = x + ((z - a) / (t / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.5e-36) || !(a <= 2.6e-48)) tmp = Float64(Float64(x + y) - Float64(y * Float64(z / a))); else tmp = Float64(x + Float64(Float64(z - a) / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.5e-36) || ~((a <= 2.6e-48))) tmp = (x + y) - (y * (z / a)); else tmp = x + ((z - a) / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.5e-36], N[Not[LessEqual[a, 2.6e-48]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - a), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{-36} \lor \neg \left(a \leq 2.6 \cdot 10^{-48}\right):\\
\;\;\;\;\left(x + y\right) - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\
\end{array}
\end{array}
if a < -1.5000000000000001e-36 or 2.59999999999999987e-48 < a Initial program 77.1%
Taylor expanded in t around 0 79.1%
associate-/l*86.0%
Simplified86.0%
if -1.5000000000000001e-36 < a < 2.59999999999999987e-48Initial program 71.8%
Taylor expanded in t around inf 83.4%
associate--l+83.4%
distribute-lft-out--83.4%
div-sub84.3%
mul-1-neg84.3%
unsub-neg84.3%
*-commutative84.3%
distribute-lft-out--84.3%
Simplified84.3%
div-inv84.2%
*-commutative84.2%
associate-*l*85.2%
Applied egg-rr85.2%
div-inv85.2%
clear-num85.2%
un-div-inv85.2%
Applied egg-rr85.2%
Final simplification85.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.5e+79) (not (<= a 0.007))) (+ x y) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.5e+79) || !(a <= 0.007)) {
tmp = x + y;
} else {
tmp = x + (z * (y / t));
}
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.5d+79)) .or. (.not. (a <= 0.007d0))) then
tmp = x + y
else
tmp = x + (z * (y / t))
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.5e+79) || !(a <= 0.007)) {
tmp = x + y;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.5e+79) or not (a <= 0.007): tmp = x + y else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.5e+79) || !(a <= 0.007)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.5e+79) || ~((a <= 0.007))) tmp = x + y; else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.5e+79], N[Not[LessEqual[a, 0.007]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{+79} \lor \neg \left(a \leq 0.007\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if a < -1.49999999999999987e79 or 0.00700000000000000015 < a Initial program 77.3%
Taylor expanded in a around inf 81.4%
+-commutative81.4%
Simplified81.4%
if -1.49999999999999987e79 < a < 0.00700000000000000015Initial program 72.7%
Taylor expanded in t around inf 76.4%
associate--l+76.4%
distribute-lft-out--76.4%
div-sub77.1%
mul-1-neg77.1%
unsub-neg77.1%
*-commutative77.1%
distribute-lft-out--77.1%
Simplified77.1%
Taylor expanded in a around 0 71.4%
cancel-sign-sub-inv71.4%
metadata-eval71.4%
associate-*r/71.4%
*-lft-identity71.4%
*-commutative71.4%
associate-*r/73.6%
Simplified73.6%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.2e+102) x (if (<= t 2.1e+146) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.2e+102) {
tmp = x;
} else if (t <= 2.1e+146) {
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 <= (-6.2d+102)) then
tmp = x
else if (t <= 2.1d+146) 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 <= -6.2e+102) {
tmp = x;
} else if (t <= 2.1e+146) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.2e+102: tmp = x elif t <= 2.1e+146: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.2e+102) tmp = x; elseif (t <= 2.1e+146) 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 <= -6.2e+102) tmp = x; elseif (t <= 2.1e+146) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.2e+102], x, If[LessEqual[t, 2.1e+146], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+102}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+146}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -6.19999999999999973e102 or 2.1000000000000001e146 < t Initial program 43.6%
Taylor expanded in x around inf 70.2%
if -6.19999999999999973e102 < t < 2.1000000000000001e146Initial program 85.7%
Taylor expanded in a around inf 62.1%
+-commutative62.1%
Simplified62.1%
Final simplification64.2%
(FPCore (x y z t a) :precision binary64 (if (<= y -8e+58) y (if (<= y 4.2e+106) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8e+58) {
tmp = y;
} else if (y <= 4.2e+106) {
tmp = x;
} else {
tmp = 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 <= (-8d+58)) then
tmp = y
else if (y <= 4.2d+106) then
tmp = x
else
tmp = 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 <= -8e+58) {
tmp = y;
} else if (y <= 4.2e+106) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -8e+58: tmp = y elif y <= 4.2e+106: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -8e+58) tmp = y; elseif (y <= 4.2e+106) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -8e+58) tmp = y; elseif (y <= 4.2e+106) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -8e+58], y, If[LessEqual[y, 4.2e+106], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+58}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+106}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -7.99999999999999955e58 or 4.2000000000000001e106 < y Initial program 58.0%
Taylor expanded in t around 0 50.6%
associate-/l*58.5%
Simplified58.5%
Taylor expanded in x around 0 44.0%
Taylor expanded in z around 0 33.2%
if -7.99999999999999955e58 < y < 4.2000000000000001e106Initial program 84.7%
Taylor expanded in x around inf 69.2%
Final simplification55.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 74.7%
Taylor expanded in x around inf 49.2%
Final simplification49.2%
(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 2024039
(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))))