
(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 (fma y (/ (- z t) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
\end{array}
Initial program 88.1%
+-commutative88.1%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.5e+146) (not (<= z 5.4e+72))) (+ x (* y (/ z (- z a)))) (- x (/ (* y (- t z)) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.5e+146) || !(z <= 5.4e+72)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x - ((y * (t - z)) / (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 ((z <= (-1.5d+146)) .or. (.not. (z <= 5.4d+72))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x - ((y * (t - z)) / (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 ((z <= -1.5e+146) || !(z <= 5.4e+72)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x - ((y * (t - z)) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.5e+146) or not (z <= 5.4e+72): tmp = x + (y * (z / (z - a))) else: tmp = x - ((y * (t - z)) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.5e+146) || !(z <= 5.4e+72)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x - Float64(Float64(y * Float64(t - z)) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.5e+146) || ~((z <= 5.4e+72))) tmp = x + (y * (z / (z - a))); else tmp = x - ((y * (t - z)) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.5e+146], N[Not[LessEqual[z, 5.4e+72]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+146} \lor \neg \left(z \leq 5.4 \cdot 10^{+72}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(t - z\right)}{z - a}\\
\end{array}
\end{array}
if z < -1.50000000000000001e146 or 5.4000000000000001e72 < z Initial program 75.0%
Taylor expanded in t around 0 73.8%
associate-/l*97.6%
Simplified97.6%
if -1.50000000000000001e146 < z < 5.4000000000000001e72Initial program 94.4%
Final simplification95.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e-21) (not (<= z 1.55e-14))) (+ x (* y (/ z (- z a)))) (+ x (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e-21) || !(z <= 1.55e-14)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * ((t - 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 ((z <= (-6.5d-21)) .or. (.not. (z <= 1.55d-14))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (y * ((t - 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 ((z <= -6.5e-21) || !(z <= 1.55e-14)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * ((t - z) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e-21) or not (z <= 1.55e-14): tmp = x + (y * (z / (z - a))) else: tmp = x + (y * ((t - z) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e-21) || !(z <= 1.55e-14)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.5e-21) || ~((z <= 1.55e-14))) tmp = x + (y * (z / (z - a))); else tmp = x + (y * ((t - z) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e-21], N[Not[LessEqual[z, 1.55e-14]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-21} \lor \neg \left(z \leq 1.55 \cdot 10^{-14}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if z < -6.49999999999999987e-21 or 1.55000000000000002e-14 < z Initial program 80.1%
Taylor expanded in t around 0 74.2%
associate-/l*91.1%
Simplified91.1%
if -6.49999999999999987e-21 < z < 1.55000000000000002e-14Initial program 96.2%
+-commutative96.2%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in a around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
associate-/l*82.9%
Simplified82.9%
Final simplification87.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.3e-93) (not (<= a 1.4e-210))) (+ x (* y (/ z (- z a)))) (+ x (- y (* t (/ y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.3e-93) || !(a <= 1.4e-210)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y - (t * (y / z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-3.3d-93)) .or. (.not. (a <= 1.4d-210))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (y - (t * (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.3e-93) || !(a <= 1.4e-210)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y - (t * (y / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.3e-93) or not (a <= 1.4e-210): tmp = x + (y * (z / (z - a))) else: tmp = x + (y - (t * (y / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.3e-93) || !(a <= 1.4e-210)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(y - Float64(t * Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.3e-93) || ~((a <= 1.4e-210))) tmp = x + (y * (z / (z - a))); else tmp = x + (y - (t * (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.3e-93], N[Not[LessEqual[a, 1.4e-210]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{-93} \lor \neg \left(a \leq 1.4 \cdot 10^{-210}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - t \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if a < -3.3000000000000001e-93 or 1.4e-210 < a Initial program 87.2%
Taylor expanded in t around 0 75.3%
associate-/l*84.6%
Simplified84.6%
if -3.3000000000000001e-93 < a < 1.4e-210Initial program 90.9%
Taylor expanded in a around 0 82.7%
associate-/l*87.2%
div-sub87.2%
*-inverses87.2%
Simplified87.2%
Taylor expanded in t around 0 87.3%
mul-1-neg87.3%
unsub-neg87.3%
associate-/l*90.1%
Simplified90.1%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3e-93) (not (<= a 1.32e-148))) (+ x (* y (/ z (- z a)))) (+ x (* y (- 1.0 (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3e-93) || !(a <= 1.32e-148)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-3d-93)) .or. (.not. (a <= 1.32d-148))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (y * (1.0d0 - (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3e-93) || !(a <= 1.32e-148)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3e-93) or not (a <= 1.32e-148): tmp = x + (y * (z / (z - a))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3e-93) || !(a <= 1.32e-148)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3e-93) || ~((a <= 1.32e-148))) tmp = x + (y * (z / (z - a))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3e-93], N[Not[LessEqual[a, 1.32e-148]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{-93} \lor \neg \left(a \leq 1.32 \cdot 10^{-148}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if a < -3.0000000000000001e-93 or 1.32000000000000007e-148 < a Initial program 87.0%
Taylor expanded in t around 0 75.0%
associate-/l*84.3%
Simplified84.3%
if -3.0000000000000001e-93 < a < 1.32000000000000007e-148Initial program 90.9%
Taylor expanded in a around 0 83.8%
associate-/l*88.9%
div-sub89.0%
*-inverses89.0%
Simplified89.0%
Final simplification85.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e-19) (not (<= z 2.25e-10))) (+ x (* y (- 1.0 (/ t z)))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e-19) || !(z <= 2.25e-10)) {
tmp = x + (y * (1.0 - (t / z)));
} 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 <= (-1.05d-19)) .or. (.not. (z <= 2.25d-10))) then
tmp = x + (y * (1.0d0 - (t / z)))
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 <= -1.05e-19) || !(z <= 2.25e-10)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.05e-19) or not (z <= 2.25e-10): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e-19) || !(z <= 2.25e-10)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); 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 <= -1.05e-19) || ~((z <= 2.25e-10))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e-19], N[Not[LessEqual[z, 2.25e-10]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-19} \lor \neg \left(z \leq 2.25 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.0499999999999999e-19 or 2.25e-10 < z Initial program 80.1%
Taylor expanded in a around 0 71.1%
associate-/l*85.1%
div-sub85.1%
*-inverses85.1%
Simplified85.1%
if -1.0499999999999999e-19 < z < 2.25e-10Initial program 96.2%
+-commutative96.2%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in z around 0 77.9%
+-commutative77.9%
associate-/l*78.5%
Simplified78.5%
Final simplification81.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.5e-19) (not (<= z 1.26e-11))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.5e-19) || !(z <= 1.26e-11)) {
tmp = y + x;
} 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 <= (-3.5d-19)) .or. (.not. (z <= 1.26d-11))) then
tmp = y + x
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 <= -3.5e-19) || !(z <= 1.26e-11)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.5e-19) or not (z <= 1.26e-11): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.5e-19) || !(z <= 1.26e-11)) tmp = Float64(y + x); 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 <= -3.5e-19) || ~((z <= 1.26e-11))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.5e-19], N[Not[LessEqual[z, 1.26e-11]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-19} \lor \neg \left(z \leq 1.26 \cdot 10^{-11}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.50000000000000015e-19 or 1.26e-11 < z Initial program 80.1%
+-commutative80.1%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
Simplified80.1%
if -3.50000000000000015e-19 < z < 1.26e-11Initial program 96.2%
+-commutative96.2%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in z around 0 77.9%
+-commutative77.9%
associate-/l*78.5%
Simplified78.5%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.06e-12) (not (<= z 1.95e-11))) (+ y x) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.06e-12) || !(z <= 1.95e-11)) {
tmp = y + x;
} 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.06d-12)) .or. (.not. (z <= 1.95d-11))) then
tmp = y + x
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.06e-12) || !(z <= 1.95e-11)) {
tmp = y + x;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.06e-12) or not (z <= 1.95e-11): tmp = y + x else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.06e-12) || !(z <= 1.95e-11)) tmp = Float64(y + x); 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.06e-12) || ~((z <= 1.95e-11))) tmp = y + x; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.06e-12], N[Not[LessEqual[z, 1.95e-11]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{-12} \lor \neg \left(z \leq 1.95 \cdot 10^{-11}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.0599999999999999e-12 or 1.95000000000000005e-11 < z Initial program 80.1%
+-commutative80.1%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
Simplified80.1%
if -1.0599999999999999e-12 < z < 1.95000000000000005e-11Initial program 96.2%
Taylor expanded in z around 0 77.9%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e-75) (not (<= z 2.4e-61))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e-75) || !(z <= 2.4e-61)) {
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 ((z <= (-3.3d-75)) .or. (.not. (z <= 2.4d-61))) 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 ((z <= -3.3e-75) || !(z <= 2.4e-61)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e-75) or not (z <= 2.4e-61): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e-75) || !(z <= 2.4e-61)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e-75) || ~((z <= 2.4e-61))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e-75], N[Not[LessEqual[z, 2.4e-61]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-75} \lor \neg \left(z \leq 2.4 \cdot 10^{-61}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.3e-75 or 2.4000000000000001e-61 < z Initial program 82.0%
+-commutative82.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 75.1%
+-commutative75.1%
Simplified75.1%
if -3.3e-75 < z < 2.4000000000000001e-61Initial program 97.2%
+-commutative97.2%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in y around 0 64.4%
Final simplification70.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.95e+86) y (if (<= y 2.75e+132) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.95e+86) {
tmp = y;
} else if (y <= 2.75e+132) {
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 <= (-1.95d+86)) then
tmp = y
else if (y <= 2.75d+132) 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 <= -1.95e+86) {
tmp = y;
} else if (y <= 2.75e+132) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.95e+86: tmp = y elif y <= 2.75e+132: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.95e+86) tmp = y; elseif (y <= 2.75e+132) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.95e+86) tmp = y; elseif (y <= 2.75e+132) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.95e+86], y, If[LessEqual[y, 2.75e+132], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+86}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+132}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.9500000000000001e86 or 2.75e132 < y Initial program 64.6%
Taylor expanded in a around 0 41.5%
associate-/l*64.3%
div-sub64.3%
*-inverses64.3%
Simplified64.3%
Taylor expanded in x around 0 58.8%
Taylor expanded in t around 0 46.1%
if -1.9500000000000001e86 < y < 2.75e132Initial program 97.8%
+-commutative97.8%
associate-/l*97.8%
fma-define97.8%
Simplified97.8%
Taylor expanded in y around 0 69.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 88.1%
+-commutative88.1%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in y around 0 54.0%
(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 2024145
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (/ (* y (- z t)) (- z a))))