
(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 (if (<= x -6.4e-265) (fma y (/ (- z t) (- z a)) x) (fma (- z t) (/ y (- z a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.4e-265) {
tmp = fma(y, ((z - t) / (z - a)), x);
} else {
tmp = fma((z - t), (y / (z - a)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.4e-265) tmp = fma(y, Float64(Float64(z - t) / Float64(z - a)), x); else tmp = fma(Float64(z - t), Float64(y / Float64(z - a)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.4e-265], N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-265}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{z - a}, x\right)\\
\end{array}
\end{array}
if x < -6.3999999999999999e-265Initial program 90.2%
+-commutative90.2%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
if -6.3999999999999999e-265 < x Initial program 85.6%
+-commutative85.6%
*-commutative85.6%
associate-/l*99.1%
fma-define99.0%
Simplified99.0%
Final simplification99.5%
(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 87.9%
+-commutative87.9%
associate-/l*97.7%
fma-define97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.6e+133)
(+ x y)
(if (<= z -1.56e-106)
(- x (* t (/ y z)))
(if (<= z 10000.0) (+ x (/ (* y t) a)) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+133) {
tmp = x + y;
} else if (z <= -1.56e-106) {
tmp = x - (t * (y / z));
} else if (z <= 10000.0) {
tmp = x + ((y * 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 <= (-6.6d+133)) then
tmp = x + y
else if (z <= (-1.56d-106)) then
tmp = x - (t * (y / z))
else if (z <= 10000.0d0) then
tmp = x + ((y * 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 <= -6.6e+133) {
tmp = x + y;
} else if (z <= -1.56e-106) {
tmp = x - (t * (y / z));
} else if (z <= 10000.0) {
tmp = x + ((y * t) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.6e+133: tmp = x + y elif z <= -1.56e-106: tmp = x - (t * (y / z)) elif z <= 10000.0: tmp = x + ((y * t) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.6e+133) tmp = Float64(x + y); elseif (z <= -1.56e-106) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 10000.0) tmp = Float64(x + Float64(Float64(y * 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 <= -6.6e+133) tmp = x + y; elseif (z <= -1.56e-106) tmp = x - (t * (y / z)); elseif (z <= 10000.0) tmp = x + ((y * t) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+133], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.56e-106], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 10000.0], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+133}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.56 \cdot 10^{-106}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 10000:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -6.6e133 or 1e4 < z Initial program 70.4%
Taylor expanded in z around inf 79.0%
+-commutative79.0%
Simplified79.0%
if -6.6e133 < z < -1.56e-106Initial program 94.9%
clear-num94.7%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in t around inf 76.9%
associate-/l*80.1%
associate-*r*80.1%
neg-mul-180.1%
*-commutative80.1%
Simplified80.1%
distribute-rgt-neg-out80.1%
distribute-lft-neg-in80.1%
add-sqr-sqrt46.6%
sqrt-unprod55.1%
sqr-neg55.1%
sqrt-unprod19.2%
add-sqr-sqrt52.9%
cancel-sign-sub-inv52.9%
associate-*l/52.8%
associate-/l*52.9%
add-sqr-sqrt19.2%
sqrt-unprod55.2%
sqr-neg55.2%
sqrt-unprod48.4%
add-sqr-sqrt80.2%
Applied egg-rr80.2%
Taylor expanded in z around inf 69.6%
associate-*r/72.8%
Simplified72.8%
if -1.56e-106 < z < 1e4Initial program 99.0%
Taylor expanded in z around 0 84.0%
Final simplification79.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4e+122)
(- x (* y (/ (- t z) z)))
(if (<= z 4e+117)
(+ x (/ (* y (- z t)) (- z a)))
(+ x (* y (/ z (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+122) {
tmp = x - (y * ((t - z) / z));
} else if (z <= 4e+117) {
tmp = x + ((y * (z - t)) / (z - a));
} else {
tmp = x + (y * (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 <= (-4d+122)) then
tmp = x - (y * ((t - z) / z))
else if (z <= 4d+117) then
tmp = x + ((y * (z - t)) / (z - a))
else
tmp = x + (y * (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 <= -4e+122) {
tmp = x - (y * ((t - z) / z));
} else if (z <= 4e+117) {
tmp = x + ((y * (z - t)) / (z - a));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4e+122: tmp = x - (y * ((t - z) / z)) elif z <= 4e+117: tmp = x + ((y * (z - t)) / (z - a)) else: tmp = x + (y * (z / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e+122) tmp = Float64(x - Float64(y * Float64(Float64(t - z) / z))); elseif (z <= 4e+117) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))); else tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4e+122) tmp = x - (y * ((t - z) / z)); elseif (z <= 4e+117) tmp = x + ((y * (z - t)) / (z - a)); else tmp = x + (y * (z / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+122], N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+117], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+122}:\\
\;\;\;\;x - y \cdot \frac{t - z}{z}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+117}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if z < -4.00000000000000006e122Initial program 67.3%
Taylor expanded in a around 0 64.0%
+-commutative64.0%
associate-/l*88.5%
Simplified88.5%
if -4.00000000000000006e122 < z < 4.0000000000000002e117Initial program 97.8%
if 4.0000000000000002e117 < z Initial program 61.8%
Taylor expanded in t around 0 61.8%
+-commutative61.8%
associate-/l*95.4%
Simplified95.4%
Final simplification96.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e-177) (not (<= z 1.12e-54))) (+ x (* y (/ z (- z a)))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e-177) || !(z <= 1.12e-54)) {
tmp = x + (y * (z / (z - a)));
} 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.35d-177)) .or. (.not. (z <= 1.12d-54))) then
tmp = x + (y * (z / (z - a)))
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.35e-177) || !(z <= 1.12e-54)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e-177) or not (z <= 1.12e-54): tmp = x + (y * (z / (z - a))) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e-177) || !(z <= 1.12e-54)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); 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.35e-177) || ~((z <= 1.12e-54))) tmp = x + (y * (z / (z - a))); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e-177], N[Not[LessEqual[z, 1.12e-54]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-177} \lor \neg \left(z \leq 1.12 \cdot 10^{-54}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.3500000000000001e-177 or 1.11999999999999994e-54 < z Initial program 83.3%
Taylor expanded in t around 0 70.3%
+-commutative70.3%
associate-/l*81.8%
Simplified81.8%
if -1.3500000000000001e-177 < z < 1.11999999999999994e-54Initial program 98.6%
Taylor expanded in z around 0 88.4%
Final simplification83.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3e-121) (not (<= z 1.15e-32))) (- x (* y (/ (- t z) z))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3e-121) || !(z <= 1.15e-32)) {
tmp = x - (y * ((t - z) / z));
} 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 <= (-3d-121)) .or. (.not. (z <= 1.15d-32))) then
tmp = x - (y * ((t - z) / z))
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 <= -3e-121) || !(z <= 1.15e-32)) {
tmp = x - (y * ((t - z) / z));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3e-121) or not (z <= 1.15e-32): tmp = x - (y * ((t - z) / z)) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3e-121) || !(z <= 1.15e-32)) tmp = Float64(x - Float64(y * Float64(Float64(t - z) / z))); 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 <= -3e-121) || ~((z <= 1.15e-32))) tmp = x - (y * ((t - z) / z)); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3e-121], N[Not[LessEqual[z, 1.15e-32]], $MachinePrecision]], N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-121} \lor \neg \left(z \leq 1.15 \cdot 10^{-32}\right):\\
\;\;\;\;x - y \cdot \frac{t - z}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.9999999999999999e-121 or 1.15e-32 < z Initial program 81.0%
Taylor expanded in a around 0 70.7%
+-commutative70.7%
associate-/l*85.2%
Simplified85.2%
if -2.9999999999999999e-121 < z < 1.15e-32Initial program 98.9%
Taylor expanded in z around 0 87.0%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3e+60) (not (<= t 2.2e+32))) (+ x (* y (/ t (- a z)))) (+ x (* y (/ z (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3e+60) || !(t <= 2.2e+32)) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (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 ((t <= (-3d+60)) .or. (.not. (t <= 2.2d+32))) then
tmp = x + (y * (t / (a - z)))
else
tmp = x + (y * (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 ((t <= -3e+60) || !(t <= 2.2e+32)) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3e+60) or not (t <= 2.2e+32): tmp = x + (y * (t / (a - z))) else: tmp = x + (y * (z / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3e+60) || !(t <= 2.2e+32)) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); else tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3e+60) || ~((t <= 2.2e+32))) tmp = x + (y * (t / (a - z))); else tmp = x + (y * (z / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3e+60], N[Not[LessEqual[t, 2.2e+32]], $MachinePrecision]], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+60} \lor \neg \left(t \leq 2.2 \cdot 10^{+32}\right):\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if t < -2.9999999999999998e60 or 2.20000000000000001e32 < t Initial program 80.8%
clear-num80.7%
associate-/r/80.6%
Applied egg-rr80.6%
Taylor expanded in t around inf 77.7%
associate-/l*85.8%
associate-*r*85.8%
neg-mul-185.8%
*-commutative85.8%
Simplified85.8%
distribute-rgt-neg-out85.8%
distribute-lft-neg-in85.8%
add-sqr-sqrt46.6%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod12.6%
add-sqr-sqrt34.3%
cancel-sign-sub-inv34.3%
associate-*l/33.2%
associate-/l*34.3%
add-sqr-sqrt12.6%
sqrt-unprod30.2%
sqr-neg30.2%
sqrt-unprod47.9%
add-sqr-sqrt83.2%
Applied egg-rr83.2%
if -2.9999999999999998e60 < t < 2.20000000000000001e32Initial program 92.2%
Taylor expanded in t around 0 84.3%
+-commutative84.3%
associate-/l*92.0%
Simplified92.0%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.8e+53) (+ x (* t (/ y (- a z)))) (if (<= t 5.2e+31) (+ x (* y (/ z (- z a)))) (+ x (* y (/ t (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.8e+53) {
tmp = x + (t * (y / (a - z)));
} else if (t <= 5.2e+31) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * (t / (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 <= (-3.8d+53)) then
tmp = x + (t * (y / (a - z)))
else if (t <= 5.2d+31) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (y * (t / (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 <= -3.8e+53) {
tmp = x + (t * (y / (a - z)));
} else if (t <= 5.2e+31) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.8e+53: tmp = x + (t * (y / (a - z))) elif t <= 5.2e+31: tmp = x + (y * (z / (z - a))) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.8e+53) tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); elseif (t <= 5.2e+31) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.8e+53) tmp = x + (t * (y / (a - z))); elseif (t <= 5.2e+31) tmp = x + (y * (z / (z - a))); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.8e+53], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e+31], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+53}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+31}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if t < -3.79999999999999997e53Initial program 73.5%
Taylor expanded in t around inf 69.0%
mul-1-neg69.0%
associate-/l*83.1%
distribute-rgt-neg-in83.1%
distribute-frac-neg283.1%
sub-neg83.1%
mul-1-neg83.1%
distribute-neg-in83.1%
mul-1-neg83.1%
remove-double-neg83.1%
Simplified83.1%
if -3.79999999999999997e53 < t < 5.2e31Initial program 92.2%
Taylor expanded in t around 0 84.3%
+-commutative84.3%
associate-/l*92.0%
Simplified92.0%
if 5.2e31 < t Initial program 87.3%
clear-num87.2%
associate-/r/87.2%
Applied egg-rr87.2%
Taylor expanded in t around inf 85.3%
associate-/l*88.2%
associate-*r*88.2%
neg-mul-188.2%
*-commutative88.2%
Simplified88.2%
distribute-rgt-neg-out88.2%
distribute-lft-neg-in88.2%
add-sqr-sqrt87.9%
sqrt-unprod47.6%
sqr-neg47.6%
sqrt-unprod0.0%
add-sqr-sqrt40.9%
cancel-sign-sub-inv40.9%
associate-*l/40.7%
associate-/l*40.8%
add-sqr-sqrt0.0%
sqrt-unprod48.1%
sqr-neg48.1%
sqrt-unprod90.2%
add-sqr-sqrt90.5%
Applied egg-rr90.5%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.7e-30) (not (<= z 5500.0))) (+ x y) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7e-30) || !(z <= 5500.0)) {
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 <= (-2.7d-30)) .or. (.not. (z <= 5500.0d0))) 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 <= -2.7e-30) || !(z <= 5500.0)) {
tmp = x + y;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.7e-30) or not (z <= 5500.0): tmp = x + y else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.7e-30) || !(z <= 5500.0)) 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 <= -2.7e-30) || ~((z <= 5500.0))) tmp = x + y; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.7e-30], N[Not[LessEqual[z, 5500.0]], $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 -2.7 \cdot 10^{-30} \lor \neg \left(z \leq 5500\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.69999999999999987e-30 or 5500 < z Initial program 76.4%
Taylor expanded in z around inf 74.9%
+-commutative74.9%
Simplified74.9%
if -2.69999999999999987e-30 < z < 5500Initial program 99.2%
Taylor expanded in z around 0 80.9%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.75e-121) (not (<= z 5.5e-13))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.75e-121) || !(z <= 5.5e-13)) {
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 <= (-1.75d-121)) .or. (.not. (z <= 5.5d-13))) 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 <= -1.75e-121) || !(z <= 5.5e-13)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.75e-121) or not (z <= 5.5e-13): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.75e-121) || !(z <= 5.5e-13)) 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 <= -1.75e-121) || ~((z <= 5.5e-13))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.75e-121], N[Not[LessEqual[z, 5.5e-13]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-121} \lor \neg \left(z \leq 5.5 \cdot 10^{-13}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.74999999999999996e-121 or 5.49999999999999979e-13 < z Initial program 80.3%
Taylor expanded in z around inf 71.8%
+-commutative71.8%
Simplified71.8%
if -1.74999999999999996e-121 < z < 5.49999999999999979e-13Initial program 99.0%
Taylor expanded in x around inf 61.5%
Final simplification67.6%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 87.9%
Taylor expanded in x around inf 53.7%
Final simplification53.7%
(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 2024053
(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))))