
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 96.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.3e+51)
(+ x y)
(if (<= z 3.5e-141)
(+ x (/ (* y t) a))
(if (<= z 1.1e+152) (- x (* t (/ y z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e+51) {
tmp = x + y;
} else if (z <= 3.5e-141) {
tmp = x + ((y * t) / a);
} else if (z <= 1.1e+152) {
tmp = x - (t * (y / z));
} 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 <= (-3.3d+51)) then
tmp = x + y
else if (z <= 3.5d-141) then
tmp = x + ((y * t) / a)
else if (z <= 1.1d+152) then
tmp = x - (t * (y / z))
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 <= -3.3e+51) {
tmp = x + y;
} else if (z <= 3.5e-141) {
tmp = x + ((y * t) / a);
} else if (z <= 1.1e+152) {
tmp = x - (t * (y / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.3e+51: tmp = x + y elif z <= 3.5e-141: tmp = x + ((y * t) / a) elif z <= 1.1e+152: tmp = x - (t * (y / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.3e+51) tmp = Float64(x + y); elseif (z <= 3.5e-141) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (z <= 1.1e+152) tmp = Float64(x - Float64(t * Float64(y / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.3e+51) tmp = x + y; elseif (z <= 3.5e-141) tmp = x + ((y * t) / a); elseif (z <= 1.1e+152) tmp = x - (t * (y / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.3e+51], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.5e-141], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e+152], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+51}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+152}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.2999999999999997e51 or 1.0999999999999999e152 < z Initial program 99.9%
Taylor expanded in z around inf 81.7%
+-commutative81.7%
Simplified81.7%
if -3.2999999999999997e51 < z < 3.5000000000000003e-141Initial program 95.1%
Taylor expanded in z around 0 82.8%
if 3.5000000000000003e-141 < z < 1.0999999999999999e152Initial program 95.0%
clear-num94.9%
un-div-inv95.0%
Applied egg-rr95.0%
Taylor expanded in z around 0 75.7%
neg-mul-175.7%
Simplified75.7%
Taylor expanded in z around inf 61.3%
mul-1-neg61.3%
unsub-neg61.3%
associate-/l*63.6%
Simplified63.6%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -246000.0) (not (<= t 8.8e-58))) (+ 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 <= -246000.0) || !(t <= 8.8e-58)) {
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 <= (-246000.0d0)) .or. (.not. (t <= 8.8d-58))) 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 <= -246000.0) || !(t <= 8.8e-58)) {
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 <= -246000.0) or not (t <= 8.8e-58): 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 <= -246000.0) || !(t <= 8.8e-58)) 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 <= -246000.0) || ~((t <= 8.8e-58))) 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, -246000.0], N[Not[LessEqual[t, 8.8e-58]], $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 -246000 \lor \neg \left(t \leq 8.8 \cdot 10^{-58}\right):\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if t < -246000 or 8.80000000000000023e-58 < t Initial program 95.6%
Taylor expanded in t around inf 82.8%
associate-*r/82.8%
mul-1-neg82.8%
distribute-lft-neg-out82.8%
*-commutative82.8%
*-lft-identity82.8%
times-frac84.6%
/-rgt-identity84.6%
distribute-neg-frac84.6%
distribute-neg-frac284.6%
neg-sub084.6%
sub-neg84.6%
+-commutative84.6%
associate--r+84.6%
neg-sub084.6%
remove-double-neg84.6%
Simplified84.6%
if -246000 < t < 8.80000000000000023e-58Initial program 97.7%
Taylor expanded in t around 0 84.4%
+-commutative84.4%
associate-/l*93.0%
Simplified93.0%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.1e+64) (not (<= z 8.2e+80))) (+ x (* y (- 1.0 (/ t z)))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.1e+64) || !(z <= 8.2e+80)) {
tmp = x + (y * (1.0 - (t / z)));
} 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 ((z <= (-4.1d+64)) .or. (.not. (z <= 8.2d+80))) then
tmp = x + (y * (1.0d0 - (t / z)))
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 ((z <= -4.1e+64) || !(z <= 8.2e+80)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.1e+64) or not (z <= 8.2e+80): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.1e+64) || !(z <= 8.2e+80)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); 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 ((z <= -4.1e+64) || ~((z <= 8.2e+80))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.1e+64], N[Not[LessEqual[z, 8.2e+80]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $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}\;z \leq -4.1 \cdot 10^{+64} \lor \neg \left(z \leq 8.2 \cdot 10^{+80}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -4.09999999999999978e64 or 8.20000000000000003e80 < z Initial program 99.9%
Taylor expanded in a around 0 73.4%
associate-/l*92.4%
div-sub92.4%
*-inverses92.4%
Simplified92.4%
if -4.09999999999999978e64 < z < 8.20000000000000003e80Initial program 94.4%
Taylor expanded in t around inf 84.7%
associate-*r/84.7%
mul-1-neg84.7%
distribute-lft-neg-out84.7%
*-commutative84.7%
*-lft-identity84.7%
times-frac83.3%
/-rgt-identity83.3%
distribute-neg-frac83.3%
distribute-neg-frac283.3%
neg-sub083.3%
sub-neg83.3%
+-commutative83.3%
associate--r+83.3%
neg-sub083.3%
remove-double-neg83.3%
Simplified83.3%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+53) (not (<= z 1.4e-62))) (+ x (* y (- 1.0 (/ t z)))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+53) || !(z <= 1.4e-62)) {
tmp = x + (y * (1.0 - (t / 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 <= (-1.4d+53)) .or. (.not. (z <= 1.4d-62))) then
tmp = x + (y * (1.0d0 - (t / 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 <= -1.4e+53) || !(z <= 1.4e-62)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e+53) or not (z <= 1.4e-62): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+53) || !(z <= 1.4e-62)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / 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 <= -1.4e+53) || ~((z <= 1.4e-62))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+53], N[Not[LessEqual[z, 1.4e-62]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $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.4 \cdot 10^{+53} \lor \neg \left(z \leq 1.4 \cdot 10^{-62}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.4e53 or 1.40000000000000001e-62 < z Initial program 99.9%
Taylor expanded in a around 0 72.7%
associate-/l*86.5%
div-sub86.5%
*-inverses86.5%
Simplified86.5%
if -1.4e53 < z < 1.40000000000000001e-62Initial program 92.5%
Taylor expanded in z around 0 78.4%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.9) (+ x (/ y (/ (- a z) t))) (if (<= t 6.5e-58) (+ 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 <= -2.9) {
tmp = x + (y / ((a - z) / t));
} else if (t <= 6.5e-58) {
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 <= (-2.9d0)) then
tmp = x + (y / ((a - z) / t))
else if (t <= 6.5d-58) 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 <= -2.9) {
tmp = x + (y / ((a - z) / t));
} else if (t <= 6.5e-58) {
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 <= -2.9: tmp = x + (y / ((a - z) / t)) elif t <= 6.5e-58: 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 <= -2.9) tmp = Float64(x + Float64(y / Float64(Float64(a - z) / t))); elseif (t <= 6.5e-58) 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 <= -2.9) tmp = x + (y / ((a - z) / t)); elseif (t <= 6.5e-58) 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, -2.9], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e-58], 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 -2.9:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{-58}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if t < -2.89999999999999991Initial program 95.0%
clear-num95.0%
un-div-inv95.1%
Applied egg-rr95.1%
Taylor expanded in z around 0 83.7%
neg-mul-183.7%
Simplified83.7%
if -2.89999999999999991 < t < 6.49999999999999964e-58Initial program 97.7%
Taylor expanded in t around 0 84.4%
+-commutative84.4%
associate-/l*93.0%
Simplified93.0%
if 6.49999999999999964e-58 < t Initial program 96.1%
Taylor expanded in t around inf 84.3%
associate-*r/84.3%
mul-1-neg84.3%
distribute-lft-neg-out84.3%
*-commutative84.3%
*-lft-identity84.3%
times-frac85.4%
/-rgt-identity85.4%
distribute-neg-frac85.4%
distribute-neg-frac285.4%
neg-sub085.4%
sub-neg85.4%
+-commutative85.4%
associate--r+85.4%
neg-sub085.4%
remove-double-neg85.4%
Simplified85.4%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.7e+51) (- x (/ y (/ z (- t z)))) (if (<= z 1.25e+81) (+ x (* y (/ t (- a z)))) (+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e+51) {
tmp = x - (y / (z / (t - z)));
} else if (z <= 1.25e+81) {
tmp = x + (y * (t / (a - z)));
} 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 (z <= (-3.7d+51)) then
tmp = x - (y / (z / (t - z)))
else if (z <= 1.25d+81) then
tmp = x + (y * (t / (a - z)))
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 (z <= -3.7e+51) {
tmp = x - (y / (z / (t - z)));
} else if (z <= 1.25e+81) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e+51: tmp = x - (y / (z / (t - z))) elif z <= 1.25e+81: tmp = x + (y * (t / (a - z))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e+51) tmp = Float64(x - Float64(y / Float64(z / Float64(t - z)))); elseif (z <= 1.25e+81) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); 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 (z <= -3.7e+51) tmp = x - (y / (z / (t - z))); elseif (z <= 1.25e+81) tmp = x + (y * (t / (a - z))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e+51], N[(x - N[(y / N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+81], N[(x + N[(y * N[(t / N[(a - z), $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}\;z \leq -3.7 \cdot 10^{+51}:\\
\;\;\;\;x - \frac{y}{\frac{z}{t - z}}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+81}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -3.7000000000000002e51Initial program 99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 96.3%
if -3.7000000000000002e51 < z < 1.25e81Initial program 94.4%
Taylor expanded in t around inf 84.7%
associate-*r/84.7%
mul-1-neg84.7%
distribute-lft-neg-out84.7%
*-commutative84.7%
*-lft-identity84.7%
times-frac83.3%
/-rgt-identity83.3%
distribute-neg-frac83.3%
distribute-neg-frac283.3%
neg-sub083.3%
sub-neg83.3%
+-commutative83.3%
associate--r+83.3%
neg-sub083.3%
remove-double-neg83.3%
Simplified83.3%
if 1.25e81 < z Initial program 99.9%
Taylor expanded in a around 0 70.2%
associate-/l*88.4%
div-sub88.4%
*-inverses88.4%
Simplified88.4%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.6e+51) (not (<= z 1.2e+66))) (+ x y) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e+51) || !(z <= 1.2e+66)) {
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.6d+51)) .or. (.not. (z <= 1.2d+66))) 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.6e+51) || !(z <= 1.2e+66)) {
tmp = x + y;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.6e+51) or not (z <= 1.2e+66): tmp = x + y else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.6e+51) || !(z <= 1.2e+66)) 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.6e+51) || ~((z <= 1.2e+66))) 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.6e+51], N[Not[LessEqual[z, 1.2e+66]], $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.6 \cdot 10^{+51} \lor \neg \left(z \leq 1.2 \cdot 10^{+66}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.6000000000000001e51 or 1.2000000000000001e66 < z Initial program 99.9%
Taylor expanded in z around inf 76.8%
+-commutative76.8%
Simplified76.8%
if -2.6000000000000001e51 < z < 1.2000000000000001e66Initial program 94.1%
Taylor expanded in z around 0 72.5%
Final simplification74.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+72) (not (<= z 1.22e+69))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+72) || !(z <= 1.22e+69)) {
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.9d+72)) .or. (.not. (z <= 1.22d+69))) 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.9e+72) || !(z <= 1.22e+69)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.9e+72) or not (z <= 1.22e+69): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+72) || !(z <= 1.22e+69)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.9e+72) || ~((z <= 1.22e+69))) 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.9e+72], N[Not[LessEqual[z, 1.22e+69]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+72} \lor \neg \left(z \leq 1.22 \cdot 10^{+69}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.90000000000000003e72 or 1.22e69 < z Initial program 99.9%
Taylor expanded in z around inf 76.8%
+-commutative76.8%
Simplified76.8%
if -1.90000000000000003e72 < z < 1.22e69Initial program 94.1%
Taylor expanded in z around 0 72.0%
Final simplification74.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e+52) (not (<= z 3.8e-69))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e+52) || !(z <= 3.8e-69)) {
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.55d+52)) .or. (.not. (z <= 3.8d-69))) 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.55e+52) || !(z <= 3.8e-69)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e+52) or not (z <= 3.8e-69): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e+52) || !(z <= 3.8e-69)) 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.55e+52) || ~((z <= 3.8e-69))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e+52], N[Not[LessEqual[z, 3.8e-69]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+52} \lor \neg \left(z \leq 3.8 \cdot 10^{-69}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55e52 or 3.7999999999999998e-69 < z Initial program 99.9%
Taylor expanded in z around inf 70.1%
+-commutative70.1%
Simplified70.1%
if -1.55e52 < z < 3.7999999999999998e-69Initial program 92.5%
Taylor expanded in x around inf 49.3%
Final simplification60.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.55e+212) y (if (<= y 1.55e+131) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.55e+212) {
tmp = y;
} else if (y <= 1.55e+131) {
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.55d+212)) then
tmp = y
else if (y <= 1.55d+131) 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.55e+212) {
tmp = y;
} else if (y <= 1.55e+131) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.55e+212: tmp = y elif y <= 1.55e+131: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.55e+212) tmp = y; elseif (y <= 1.55e+131) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.55e+212) tmp = y; elseif (y <= 1.55e+131) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.55e+212], y, If[LessEqual[y, 1.55e+131], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+212}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+131}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.54999999999999999e212 or 1.55000000000000008e131 < y Initial program 99.9%
Taylor expanded in z around inf 34.8%
+-commutative34.8%
Simplified34.8%
Taylor expanded in y around inf 34.8%
Taylor expanded in y around inf 30.5%
if -1.54999999999999999e212 < y < 1.55000000000000008e131Initial program 95.6%
Taylor expanded in x around inf 61.0%
(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 96.6%
Taylor expanded in x around inf 49.2%
(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 2024135
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine 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)))))