
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
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)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\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)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
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)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - 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 - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
Initial program 83.7%
clear-num83.7%
inv-pow83.7%
Applied egg-rr83.7%
unpow-183.7%
*-commutative83.7%
associate-/r*97.4%
Simplified97.4%
clear-num97.5%
add-cube-cbrt96.8%
associate-/l*96.8%
pow296.8%
Applied egg-rr96.8%
associate-*r/96.8%
unpow296.8%
rem-3cbrt-lft97.5%
Simplified97.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- z a))))
(if (or (<= t_1 -5e+145) (not (<= t_1 2e-17)))
(* (- z t) (/ y (- z a)))
(+ x (/ y (- 1.0 (/ a z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if ((t_1 <= -5e+145) || !(t_1 <= 2e-17)) {
tmp = (z - t) * (y / (z - a));
} else {
tmp = x + (y / (1.0 - (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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (z - a)
if ((t_1 <= (-5d+145)) .or. (.not. (t_1 <= 2d-17))) then
tmp = (z - t) * (y / (z - a))
else
tmp = x + (y / (1.0d0 - (a / z)))
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)) / (z - a);
double tmp;
if ((t_1 <= -5e+145) || !(t_1 <= 2e-17)) {
tmp = (z - t) * (y / (z - a));
} else {
tmp = x + (y / (1.0 - (a / z)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (z - a) tmp = 0 if (t_1 <= -5e+145) or not (t_1 <= 2e-17): tmp = (z - t) * (y / (z - a)) else: tmp = x + (y / (1.0 - (a / z))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) tmp = 0.0 if ((t_1 <= -5e+145) || !(t_1 <= 2e-17)) tmp = Float64(Float64(z - t) * Float64(y / Float64(z - a))); else tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (z - a); tmp = 0.0; if ((t_1 <= -5e+145) || ~((t_1 <= 2e-17))) tmp = (z - t) * (y / (z - a)); else tmp = x + (y / (1.0 - (a / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+145], N[Not[LessEqual[t$95$1, 2e-17]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+145} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-17}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -4.99999999999999967e145 or 2.00000000000000014e-17 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 62.6%
+-commutative62.6%
associate-/l*93.9%
fma-define93.9%
Simplified93.9%
Taylor expanded in y around inf 81.2%
div-sub81.2%
associate-*r/54.5%
associate-*l/84.6%
Simplified84.6%
if -4.99999999999999967e145 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.00000000000000014e-17Initial program 99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
*-commutative99.9%
associate-/r*99.2%
Simplified99.2%
Taylor expanded in t around 0 87.3%
*-rgt-identity87.3%
times-frac82.6%
/-rgt-identity82.6%
associate-/r/86.7%
div-sub86.7%
*-inverses86.7%
Simplified86.7%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e-15) (not (<= z 1.35e-34))) (+ x (* y (/ z (- z a)))) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e-15) || !(z <= 1.35e-34)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (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 ((z <= (-6.5d-15)) .or. (.not. (z <= 1.35d-34))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (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 ((z <= -6.5e-15) || !(z <= 1.35e-34)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e-15) or not (z <= 1.35e-34): tmp = x + (y * (z / (z - a))) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e-15) || !(z <= 1.35e-34)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.5e-15) || ~((z <= 1.35e-34))) tmp = x + (y * (z / (z - a))); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e-15], N[Not[LessEqual[z, 1.35e-34]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-15} \lor \neg \left(z \leq 1.35 \cdot 10^{-34}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -6.49999999999999991e-15 or 1.35000000000000008e-34 < z Initial program 74.5%
Taylor expanded in t around 0 64.5%
associate-/l*86.9%
Simplified86.9%
if -6.49999999999999991e-15 < z < 1.35000000000000008e-34Initial program 92.6%
+-commutative92.6%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in z around 0 75.3%
+-commutative75.3%
associate-/l*81.8%
Simplified81.8%
clear-num81.7%
un-div-inv82.4%
Applied egg-rr82.4%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.3e+46) (not (<= z 6e-10))) (+ x (* y (- 1.0 (/ t z)))) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.3e+46) || !(z <= 6e-10)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (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 ((z <= (-2.3d+46)) .or. (.not. (z <= 6d-10))) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = x + (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 ((z <= -2.3e+46) || !(z <= 6e-10)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.3e+46) or not (z <= 6e-10): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.3e+46) || !(z <= 6e-10)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.3e+46) || ~((z <= 6e-10))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.3e+46], N[Not[LessEqual[z, 6e-10]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+46} \lor \neg \left(z \leq 6 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -2.3000000000000001e46 or 6e-10 < z Initial program 72.9%
Taylor expanded in a around 0 62.6%
associate-/l*87.2%
div-sub87.2%
*-inverses87.2%
Simplified87.2%
if -2.3000000000000001e46 < z < 6e-10Initial program 92.5%
+-commutative92.5%
associate-/l*94.5%
fma-define94.5%
Simplified94.5%
Taylor expanded in z around 0 73.9%
+-commutative73.9%
associate-/l*79.8%
Simplified79.8%
clear-num79.8%
un-div-inv80.4%
Applied egg-rr80.4%
Final simplification83.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+153) (not (<= z 3.5e-7))) (+ x y) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+153) || !(z <= 3.5e-7)) {
tmp = x + y;
} else {
tmp = x + (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 ((z <= (-1.9d+153)) .or. (.not. (z <= 3.5d-7))) then
tmp = x + y
else
tmp = x + (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 ((z <= -1.9e+153) || !(z <= 3.5e-7)) {
tmp = x + y;
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.9e+153) or not (z <= 3.5e-7): tmp = x + y else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+153) || !(z <= 3.5e-7)) tmp = Float64(x + y); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.9e+153) || ~((z <= 3.5e-7))) tmp = x + y; else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.9e+153], N[Not[LessEqual[z, 3.5e-7]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+153} \lor \neg \left(z \leq 3.5 \cdot 10^{-7}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -1.89999999999999983e153 or 3.49999999999999984e-7 < z Initial program 67.6%
+-commutative67.6%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 81.9%
+-commutative81.9%
Simplified81.9%
if -1.89999999999999983e153 < z < 3.49999999999999984e-7Initial program 92.9%
+-commutative92.9%
associate-/l*95.2%
fma-define95.2%
Simplified95.2%
Taylor expanded in z around 0 71.9%
+-commutative71.9%
associate-/l*77.7%
Simplified77.7%
clear-num77.7%
un-div-inv78.3%
Applied egg-rr78.3%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.25e+153) (not (<= z 3.5e-8))) (+ x y) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.25e+153) || !(z <= 3.5e-8)) {
tmp = x + y;
} else {
tmp = x + (t * (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 ((z <= (-2.25d+153)) .or. (.not. (z <= 3.5d-8))) then
tmp = x + y
else
tmp = x + (t * (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 ((z <= -2.25e+153) || !(z <= 3.5e-8)) {
tmp = x + y;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.25e+153) or not (z <= 3.5e-8): tmp = x + y else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.25e+153) || !(z <= 3.5e-8)) tmp = Float64(x + y); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.25e+153) || ~((z <= 3.5e-8))) tmp = x + y; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.25e+153], N[Not[LessEqual[z, 3.5e-8]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+153} \lor \neg \left(z \leq 3.5 \cdot 10^{-8}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.25e153 or 3.50000000000000024e-8 < z Initial program 67.6%
+-commutative67.6%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 81.9%
+-commutative81.9%
Simplified81.9%
if -2.25e153 < z < 3.50000000000000024e-8Initial program 92.9%
+-commutative92.9%
associate-/l*95.2%
fma-define95.2%
Simplified95.2%
Taylor expanded in z around 0 71.9%
+-commutative71.9%
associate-/l*77.7%
Simplified77.7%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e+91) (not (<= z 3e-9))) (+ x y) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e+91) || !(z <= 3e-9)) {
tmp = x + y;
} else {
tmp = x + ((y * 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 ((z <= (-1.55d+91)) .or. (.not. (z <= 3d-9))) then
tmp = x + y
else
tmp = x + ((y * 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 ((z <= -1.55e+91) || !(z <= 3e-9)) {
tmp = x + y;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e+91) or not (z <= 3e-9): tmp = x + y else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e+91) || !(z <= 3e-9)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.55e+91) || ~((z <= 3e-9))) tmp = x + y; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e+91], N[Not[LessEqual[z, 3e-9]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+91} \lor \neg \left(z \leq 3 \cdot 10^{-9}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.54999999999999999e91 or 2.99999999999999998e-9 < z Initial program 70.4%
+-commutative70.4%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.3%
+-commutative80.3%
Simplified80.3%
if -1.54999999999999999e91 < z < 2.99999999999999998e-9Initial program 93.0%
Taylor expanded in z around 0 72.4%
Final simplification75.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.8e+226) (not (<= t 1.15e+86))) (* t (/ y a)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.8e+226) || !(t <= 1.15e+86)) {
tmp = t * (y / 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 <= (-6.8d+226)) .or. (.not. (t <= 1.15d+86))) then
tmp = t * (y / 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 <= -6.8e+226) || !(t <= 1.15e+86)) {
tmp = t * (y / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.8e+226) or not (t <= 1.15e+86): tmp = t * (y / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.8e+226) || !(t <= 1.15e+86)) tmp = Float64(t * Float64(y / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6.8e+226) || ~((t <= 1.15e+86))) tmp = t * (y / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.8e+226], N[Not[LessEqual[t, 1.15e+86]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+226} \lor \neg \left(t \leq 1.15 \cdot 10^{+86}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -6.79999999999999958e226 or 1.14999999999999995e86 < t Initial program 81.5%
+-commutative81.5%
associate-/l*92.2%
fma-define92.2%
Simplified92.2%
Taylor expanded in y around -inf 65.0%
Taylor expanded in z around 0 45.4%
associate-/l*57.4%
Simplified57.4%
if -6.79999999999999958e226 < t < 1.14999999999999995e86Initial program 84.4%
+-commutative84.4%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in z around inf 69.2%
+-commutative69.2%
Simplified69.2%
Final simplification66.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.4e-17) (not (<= z 8e-34))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.4e-17) || !(z <= 8e-34)) {
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 ((z <= (-5.4d-17)) .or. (.not. (z <= 8d-34))) 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 ((z <= -5.4e-17) || !(z <= 8e-34)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.4e-17) or not (z <= 8e-34): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.4e-17) || !(z <= 8e-34)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.4e-17) || ~((z <= 8e-34))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.4e-17], N[Not[LessEqual[z, 8e-34]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-17} \lor \neg \left(z \leq 8 \cdot 10^{-34}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.4000000000000002e-17 or 7.99999999999999942e-34 < z Initial program 74.5%
+-commutative74.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 75.2%
+-commutative75.2%
Simplified75.2%
if -5.4000000000000002e-17 < z < 7.99999999999999942e-34Initial program 92.6%
+-commutative92.6%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in y around 0 48.4%
Final simplification61.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.65e+118) y (if (<= y 455000.0) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.65e+118) {
tmp = y;
} else if (y <= 455000.0) {
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 <= (-3.65d+118)) then
tmp = y
else if (y <= 455000.0d0) 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 <= -3.65e+118) {
tmp = y;
} else if (y <= 455000.0) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.65e+118: tmp = y elif y <= 455000.0: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.65e+118) tmp = y; elseif (y <= 455000.0) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.65e+118) tmp = y; elseif (y <= 455000.0) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.65e+118], y, If[LessEqual[y, 455000.0], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.65 \cdot 10^{+118}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 455000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.6500000000000002e118 or 455000 < y Initial program 62.9%
+-commutative62.9%
associate-/l*98.9%
fma-define98.9%
Simplified98.9%
Taylor expanded in y around -inf 48.8%
Taylor expanded in z around inf 33.7%
if -3.6500000000000002e118 < y < 455000Initial program 96.9%
+-commutative96.9%
associate-/l*95.7%
fma-define95.7%
Simplified95.7%
Taylor expanded in y around 0 65.9%
(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 83.7%
+-commutative83.7%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 47.5%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - 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 - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024107
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))