
(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 14 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 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 1.0) (fma y t_1 x) (+ x (* (- z t) (/ y (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1.0) {
tmp = fma(y, t_1, x);
} else {
tmp = x + ((z - t) * (y / (a - t)));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 1.0) tmp = fma(y, t_1, x); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / Float64(a - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1.0], N[(y * t$95$1 + x), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(y, t\_1, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 99.6%
+-commutative99.6%
fma-define99.6%
Simplified99.6%
if 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 89.3%
associate-*r/95.8%
Simplified95.8%
*-commutative95.8%
associate-/l*99.8%
Applied egg-rr99.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 1.0) (+ x (* t_1 y)) (+ x (* (- z t) (/ y (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1.0) {
tmp = x + (t_1 * y);
} else {
tmp = x + ((z - t) * (y / (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 = (z - t) / (a - t)
if (t_1 <= 1.0d0) then
tmp = x + (t_1 * y)
else
tmp = x + ((z - t) * (y / (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 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1.0) {
tmp = x + (t_1 * y);
} else {
tmp = x + ((z - t) * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= 1.0: tmp = x + (t_1 * y) else: tmp = x + ((z - t) * (y / (a - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 1.0) tmp = Float64(x + Float64(t_1 * y)); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= 1.0) tmp = x + (t_1 * y); else tmp = x + ((z - t) * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1.0], N[(x + N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 1:\\
\;\;\;\;x + t\_1 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 99.6%
if 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 89.3%
associate-*r/95.8%
Simplified95.8%
*-commutative95.8%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 2.0) (+ x (* t_1 y)) (+ x (* z (/ y (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 2.0) {
tmp = x + (t_1 * y);
} else {
tmp = x + (z * (y / (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 = (z - t) / (a - t)
if (t_1 <= 2.0d0) then
tmp = x + (t_1 * y)
else
tmp = x + (z * (y / (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 = (z - t) / (a - t);
double tmp;
if (t_1 <= 2.0) {
tmp = x + (t_1 * y);
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= 2.0: tmp = x + (t_1 * y) else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 2.0) tmp = Float64(x + Float64(t_1 * y)); else tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= 2.0) tmp = x + (t_1 * y); else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2.0], N[(x + N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 2:\\
\;\;\;\;x + t\_1 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 2Initial program 99.6%
if 2 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 88.8%
clear-num88.8%
un-div-inv88.8%
Applied egg-rr88.8%
Taylor expanded in z around inf 88.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.1e+79) (not (<= t 2e+119))) (+ y x) (+ x (/ z (/ (- a t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.1e+79) || !(t <= 2e+119)) {
tmp = y + x;
} 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 ((t <= (-3.1d+79)) .or. (.not. (t <= 2d+119))) then
tmp = y + x
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 ((t <= -3.1e+79) || !(t <= 2e+119)) {
tmp = y + x;
} else {
tmp = x + (z / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.1e+79) or not (t <= 2e+119): tmp = y + x else: tmp = x + (z / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.1e+79) || !(t <= 2e+119)) tmp = Float64(y + x); else tmp = Float64(x + Float64(z / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.1e+79) || ~((t <= 2e+119))) tmp = y + x; else tmp = x + (z / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.1e+79], N[Not[LessEqual[t, 2e+119]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+79} \lor \neg \left(t \leq 2 \cdot 10^{+119}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if t < -3.0999999999999999e79 or 1.99999999999999989e119 < t Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 83.0%
+-commutative83.0%
Simplified83.0%
if -3.0999999999999999e79 < t < 1.99999999999999989e119Initial program 96.9%
associate-*r/94.8%
Simplified94.8%
*-commutative94.8%
associate-/l*96.7%
Applied egg-rr96.7%
clear-num96.6%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in z around inf 88.8%
Final simplification87.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.6e+80) (not (<= t 1.35e+118))) (+ y x) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.6e+80) || !(t <= 1.35e+118)) {
tmp = y + x;
} else {
tmp = x + (y / ((a - 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 <= (-8.6d+80)) .or. (.not. (t <= 1.35d+118))) then
tmp = y + x
else
tmp = x + (y / ((a - 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 <= -8.6e+80) || !(t <= 1.35e+118)) {
tmp = y + x;
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.6e+80) or not (t <= 1.35e+118): tmp = y + x else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.6e+80) || !(t <= 1.35e+118)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.6e+80) || ~((t <= 1.35e+118))) tmp = y + x; else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.6e+80], N[Not[LessEqual[t, 1.35e+118]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.6 \cdot 10^{+80} \lor \neg \left(t \leq 1.35 \cdot 10^{+118}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -8.60000000000000008e80 or 1.35e118 < t Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 83.0%
+-commutative83.0%
Simplified83.0%
if -8.60000000000000008e80 < t < 1.35e118Initial program 96.9%
clear-num96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 88.6%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.5e+73) (not (<= t 2.3e+118))) (+ y x) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.5e+73) || !(t <= 2.3e+118)) {
tmp = y + x;
} 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 ((t <= (-1.5d+73)) .or. (.not. (t <= 2.3d+118))) then
tmp = y + x
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 ((t <= -1.5e+73) || !(t <= 2.3e+118)) {
tmp = y + x;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.5e+73) or not (t <= 2.3e+118): tmp = y + x else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.5e+73) || !(t <= 2.3e+118)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.5e+73) || ~((t <= 2.3e+118))) tmp = y + x; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.5e+73], N[Not[LessEqual[t, 2.3e+118]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+73} \lor \neg \left(t \leq 2.3 \cdot 10^{+118}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -1.50000000000000005e73 or 2.30000000000000016e118 < t Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 83.0%
+-commutative83.0%
Simplified83.0%
if -1.50000000000000005e73 < t < 2.30000000000000016e118Initial program 96.9%
Taylor expanded in z around inf 86.6%
associate-/l*88.5%
Simplified88.5%
Final simplification86.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.7e-13) (+ x (/ z (/ (- a t) y))) (if (<= z 4.8e-13) (+ x (* y (/ t (- t a)))) (+ x (* z (/ y (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.7e-13) {
tmp = x + (z / ((a - t) / y));
} else if (z <= 4.8e-13) {
tmp = x + (y * (t / (t - a)));
} else {
tmp = x + (z * (y / (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 (z <= (-4.7d-13)) then
tmp = x + (z / ((a - t) / y))
else if (z <= 4.8d-13) then
tmp = x + (y * (t / (t - a)))
else
tmp = x + (z * (y / (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 (z <= -4.7e-13) {
tmp = x + (z / ((a - t) / y));
} else if (z <= 4.8e-13) {
tmp = x + (y * (t / (t - a)));
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.7e-13: tmp = x + (z / ((a - t) / y)) elif z <= 4.8e-13: tmp = x + (y * (t / (t - a))) else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.7e-13) tmp = Float64(x + Float64(z / Float64(Float64(a - t) / y))); elseif (z <= 4.8e-13) tmp = Float64(x + Float64(y * Float64(t / Float64(t - a)))); else tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.7e-13) tmp = x + (z / ((a - t) / y)); elseif (z <= 4.8e-13) tmp = x + (y * (t / (t - a))); else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.7e-13], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-13], N[(x + N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{-13}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-13}:\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if z < -4.7000000000000002e-13Initial program 96.3%
associate-*r/86.1%
Simplified86.1%
*-commutative86.1%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 93.3%
if -4.7000000000000002e-13 < z < 4.7999999999999997e-13Initial program 99.4%
+-commutative99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in z around 0 86.6%
+-commutative86.6%
associate-*r/86.6%
mul-1-neg86.6%
distribute-lft-neg-out86.6%
*-commutative86.6%
*-lft-identity86.6%
times-frac92.7%
/-rgt-identity92.7%
distribute-neg-frac92.7%
distribute-neg-frac292.7%
neg-sub092.7%
sub-neg92.7%
+-commutative92.7%
associate--r+92.7%
neg-sub092.7%
remove-double-neg92.7%
Simplified92.7%
if 4.7999999999999997e-13 < z Initial program 96.0%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Taylor expanded in z around inf 89.4%
associate-/r/90.7%
Applied egg-rr90.7%
Final simplification92.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2e+31) (not (<= t 5.3e-17))) (+ y x) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2e+31) || !(t <= 5.3e-17)) {
tmp = y + x;
} else {
tmp = x + (y / (a / 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 <= (-2d+31)) .or. (.not. (t <= 5.3d-17))) then
tmp = y + x
else
tmp = x + (y / (a / 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 <= -2e+31) || !(t <= 5.3e-17)) {
tmp = y + x;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2e+31) or not (t <= 5.3e-17): tmp = y + x else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2e+31) || !(t <= 5.3e-17)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2e+31) || ~((t <= 5.3e-17))) tmp = y + x; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2e+31], N[Not[LessEqual[t, 5.3e-17]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+31} \lor \neg \left(t \leq 5.3 \cdot 10^{-17}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.9999999999999999e31 or 5.2999999999999998e-17 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -1.9999999999999999e31 < t < 5.2999999999999998e-17Initial program 96.2%
+-commutative96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in t around 0 80.0%
+-commutative80.0%
associate-/l*83.4%
Simplified83.4%
clear-num83.4%
un-div-inv83.4%
Applied egg-rr83.4%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.65e+38) (not (<= t 4.4e-17))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.65e+38) || !(t <= 4.4e-17)) {
tmp = y + x;
} else {
tmp = x + (y * (z / 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 <= (-1.65d+38)) .or. (.not. (t <= 4.4d-17))) then
tmp = y + x
else
tmp = x + (y * (z / 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 <= -1.65e+38) || !(t <= 4.4e-17)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.65e+38) or not (t <= 4.4e-17): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.65e+38) || !(t <= 4.4e-17)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.65e+38) || ~((t <= 4.4e-17))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.65e+38], N[Not[LessEqual[t, 4.4e-17]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+38} \lor \neg \left(t \leq 4.4 \cdot 10^{-17}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -1.65e38 or 4.4e-17 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -1.65e38 < t < 4.4e-17Initial program 96.2%
+-commutative96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in t around 0 80.0%
+-commutative80.0%
associate-/l*83.4%
Simplified83.4%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.6e+31) (not (<= t 7.5e-17))) (+ y x) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.6e+31) || !(t <= 7.5e-17)) {
tmp = y + x;
} 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 <= (-4.6d+31)) .or. (.not. (t <= 7.5d-17))) then
tmp = y + x
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 <= -4.6e+31) || !(t <= 7.5e-17)) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.6e+31) or not (t <= 7.5e-17): tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.6e+31) || !(t <= 7.5e-17)) tmp = Float64(y + x); 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 <= -4.6e+31) || ~((t <= 7.5e-17))) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.6e+31], N[Not[LessEqual[t, 7.5e-17]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+31} \lor \neg \left(t \leq 7.5 \cdot 10^{-17}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.5999999999999999e31 or 7.49999999999999984e-17 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -4.5999999999999999e31 < t < 7.49999999999999984e-17Initial program 96.2%
associate-*r/94.2%
Simplified94.2%
*-commutative94.2%
associate-/l*96.6%
Applied egg-rr96.6%
clear-num96.6%
un-div-inv97.2%
Applied egg-rr97.2%
Taylor expanded in t around 0 80.0%
*-commutative80.0%
associate-*r/82.6%
Simplified82.6%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.9e+115) (* y (- 1.0 (/ z t))) (if (<= y 7.5e+131) (+ y x) (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e+115) {
tmp = y * (1.0 - (z / t));
} else if (y <= 7.5e+131) {
tmp = y + x;
} else {
tmp = y * ((z - t) / 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 (y <= (-2.9d+115)) then
tmp = y * (1.0d0 - (z / t))
else if (y <= 7.5d+131) then
tmp = y + x
else
tmp = y * ((z - t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e+115) {
tmp = y * (1.0 - (z / t));
} else if (y <= 7.5e+131) {
tmp = y + x;
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.9e+115: tmp = y * (1.0 - (z / t)) elif y <= 7.5e+131: tmp = y + x else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.9e+115) tmp = Float64(y * Float64(1.0 - Float64(z / t))); elseif (y <= 7.5e+131) tmp = Float64(y + x); else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.9e+115) tmp = y * (1.0 - (z / t)); elseif (y <= 7.5e+131) tmp = y + x; else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.9e+115], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+131], N[(y + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+131}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if y < -2.90000000000000005e115Initial program 99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 43.6%
mul-1-neg43.6%
unsub-neg43.6%
associate-/l*53.3%
div-sub53.3%
*-inverses53.3%
Simplified53.3%
Taylor expanded in x around 0 53.3%
mul-1-neg53.3%
sub-neg53.3%
metadata-eval53.3%
distribute-rgt-neg-in53.3%
+-commutative53.3%
distribute-neg-in53.3%
metadata-eval53.3%
sub-neg53.3%
Simplified53.3%
if -2.90000000000000005e115 < y < 7.4999999999999995e131Initial program 97.3%
+-commutative97.3%
fma-define97.3%
Simplified97.3%
Taylor expanded in t around inf 71.1%
+-commutative71.1%
Simplified71.1%
if 7.4999999999999995e131 < y Initial program 97.7%
Taylor expanded in a around inf 55.1%
Taylor expanded in y around inf 58.9%
Taylor expanded in a around 0 58.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.18e+114) (* y (- 1.0 (/ z t))) (if (<= y 4.4e+130) (+ y x) (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.18e+114) {
tmp = y * (1.0 - (z / t));
} else if (y <= 4.4e+130) {
tmp = y + x;
} else {
tmp = y * (z / 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 (y <= (-1.18d+114)) then
tmp = y * (1.0d0 - (z / t))
else if (y <= 4.4d+130) then
tmp = y + x
else
tmp = y * (z / a)
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.18e+114) {
tmp = y * (1.0 - (z / t));
} else if (y <= 4.4e+130) {
tmp = y + x;
} else {
tmp = y * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.18e+114: tmp = y * (1.0 - (z / t)) elif y <= 4.4e+130: tmp = y + x else: tmp = y * (z / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.18e+114) tmp = Float64(y * Float64(1.0 - Float64(z / t))); elseif (y <= 4.4e+130) tmp = Float64(y + x); else tmp = Float64(y * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.18e+114) tmp = y * (1.0 - (z / t)); elseif (y <= 4.4e+130) tmp = y + x; else tmp = y * (z / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.18e+114], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+130], N[(y + x), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{+114}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+130}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if y < -1.18000000000000005e114Initial program 99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 43.6%
mul-1-neg43.6%
unsub-neg43.6%
associate-/l*53.3%
div-sub53.3%
*-inverses53.3%
Simplified53.3%
Taylor expanded in x around 0 53.3%
mul-1-neg53.3%
sub-neg53.3%
metadata-eval53.3%
distribute-rgt-neg-in53.3%
+-commutative53.3%
distribute-neg-in53.3%
metadata-eval53.3%
sub-neg53.3%
Simplified53.3%
if -1.18000000000000005e114 < y < 4.39999999999999987e130Initial program 97.3%
+-commutative97.3%
fma-define97.3%
Simplified97.3%
Taylor expanded in t around inf 71.1%
+-commutative71.1%
Simplified71.1%
if 4.39999999999999987e130 < y Initial program 97.7%
Taylor expanded in a around inf 55.1%
Taylor expanded in y around inf 58.9%
Taylor expanded in z around inf 43.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e-118) (not (<= t 2.5e-17))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e-118) || !(t <= 2.5e-17)) {
tmp = y + x;
} 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 <= (-4d-118)) .or. (.not. (t <= 2.5d-17))) then
tmp = y + x
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 <= -4e-118) || !(t <= 2.5e-17)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4e-118) or not (t <= 2.5e-17): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e-118) || !(t <= 2.5e-17)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4e-118) || ~((t <= 2.5e-17))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e-118], N[Not[LessEqual[t, 2.5e-17]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-118} \lor \neg \left(t \leq 2.5 \cdot 10^{-17}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.99999999999999994e-118 or 2.4999999999999999e-17 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 72.9%
+-commutative72.9%
Simplified72.9%
if -3.99999999999999994e-118 < t < 2.4999999999999999e-17Initial program 95.4%
+-commutative95.4%
fma-define95.4%
Simplified95.4%
Taylor expanded in y around 0 55.0%
Final simplification64.5%
(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.8%
+-commutative97.8%
fma-define97.8%
Simplified97.8%
Taylor expanded in y around 0 54.0%
(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 2024145
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< y -8508084860551241/100000000000000000000000000000000) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t)))))))
(+ x (* y (/ (- z t) (- a t)))))