
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
Initial program 86.6%
associate-/l*98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e+89) (not (<= t 1.3e+85))) (+ x y) (+ x (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+89) || !(t <= 1.3e+85)) {
tmp = x + y;
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.8d+89)) .or. (.not. (t <= 1.3d+85))) then
tmp = x + y
else
tmp = x + (z * (y / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+89) || !(t <= 1.3e+85)) {
tmp = x + y;
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.8e+89) or not (t <= 1.3e+85): tmp = x + y else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.8e+89) || !(t <= 1.3e+85)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.8e+89) || ~((t <= 1.3e+85))) tmp = x + y; else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.8e+89], N[Not[LessEqual[t, 1.3e+85]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+89} \lor \neg \left(t \leq 1.3 \cdot 10^{+85}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -2.7999999999999998e89 or 1.30000000000000005e85 < t Initial program 72.4%
associate-*l/95.2%
Simplified95.2%
Taylor expanded in t around inf 85.4%
if -2.7999999999999998e89 < t < 1.30000000000000005e85Initial program 93.0%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in z around inf 84.6%
associate-*l/88.5%
*-commutative88.5%
Simplified88.5%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.3e-9) (not (<= z 6.2e+61))) (+ x (* z (/ y (- a t)))) (+ x (* t (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.3e-9) || !(z <= 6.2e+61)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (t * (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 <= (-7.3d-9)) .or. (.not. (z <= 6.2d+61))) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + (t * (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 <= -7.3e-9) || !(z <= 6.2e+61)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (t * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.3e-9) or not (z <= 6.2e+61): tmp = x + (z * (y / (a - t))) else: tmp = x + (t * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.3e-9) || !(z <= 6.2e+61)) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.3e-9) || ~((z <= 6.2e+61))) tmp = x + (z * (y / (a - t))); else tmp = x + (t * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.3e-9], N[Not[LessEqual[z, 6.2e+61]], $MachinePrecision]], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.3 \cdot 10^{-9} \lor \neg \left(z \leq 6.2 \cdot 10^{+61}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if z < -7.30000000000000002e-9 or 6.1999999999999998e61 < z Initial program 84.2%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in z around inf 81.9%
associate-*l/93.3%
*-commutative93.3%
Simplified93.3%
if -7.30000000000000002e-9 < z < 6.1999999999999998e61Initial program 88.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 88.9%
associate-*r/88.9%
neg-mul-188.9%
neg-sub088.9%
associate--r-88.9%
neg-sub088.9%
Simplified88.9%
Taylor expanded in y around 0 78.4%
associate-/l*88.9%
associate-/r/86.5%
Simplified86.5%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e-11) (not (<= z 0.7))) (+ x (* z (/ y (- a t)))) (+ x (/ y (/ (- t a) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e-11) || !(z <= 0.7)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y / ((t - a) / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7.2d-11)) .or. (.not. (z <= 0.7d0))) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + (y / ((t - a) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e-11) || !(z <= 0.7)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y / ((t - a) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e-11) or not (z <= 0.7): tmp = x + (z * (y / (a - t))) else: tmp = x + (y / ((t - a) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e-11) || !(z <= 0.7)) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(y / Float64(Float64(t - a) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e-11) || ~((z <= 0.7))) tmp = x + (z * (y / (a - t))); else tmp = x + (y / ((t - a) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e-11], N[Not[LessEqual[z, 0.7]], $MachinePrecision]], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(t - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-11} \lor \neg \left(z \leq 0.7\right):\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t - a}{t}}\\
\end{array}
\end{array}
if z < -7.19999999999999969e-11 or 0.69999999999999996 < z Initial program 85.2%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around inf 81.2%
associate-*l/91.0%
*-commutative91.0%
Simplified91.0%
if -7.19999999999999969e-11 < z < 0.69999999999999996Initial program 88.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 91.6%
associate-*r/91.6%
neg-mul-191.6%
neg-sub091.6%
associate--r-91.6%
neg-sub091.6%
Simplified91.6%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -10.2) (+ x (/ y (/ (- t) (- z t)))) (if (<= t 5.5e+30) (+ x (* z (/ y (- a t)))) (+ x (* t (/ y (- t a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -10.2) {
tmp = x + (y / (-t / (z - t)));
} else if (t <= 5.5e+30) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (t * (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 (t <= (-10.2d0)) then
tmp = x + (y / (-t / (z - t)))
else if (t <= 5.5d+30) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + (t * (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 (t <= -10.2) {
tmp = x + (y / (-t / (z - t)));
} else if (t <= 5.5e+30) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (t * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -10.2: tmp = x + (y / (-t / (z - t))) elif t <= 5.5e+30: tmp = x + (z * (y / (a - t))) else: tmp = x + (t * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -10.2) tmp = Float64(x + Float64(y / Float64(Float64(-t) / Float64(z - t)))); elseif (t <= 5.5e+30) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -10.2) tmp = x + (y / (-t / (z - t))); elseif (t <= 5.5e+30) tmp = x + (z * (y / (a - t))); else tmp = x + (t * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -10.2], N[(x + N[(y / N[((-t) / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+30], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -10.2:\\
\;\;\;\;x + \frac{y}{\frac{-t}{z - t}}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+30}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -10.199999999999999Initial program 74.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in a around 0 88.6%
neg-mul-188.6%
distribute-neg-frac88.6%
Simplified88.6%
if -10.199999999999999 < t < 5.50000000000000025e30Initial program 93.7%
associate-*l/94.8%
Simplified94.8%
Taylor expanded in z around inf 89.0%
associate-*l/92.7%
*-commutative92.7%
Simplified92.7%
if 5.50000000000000025e30 < t Initial program 85.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 90.3%
associate-*r/90.3%
neg-mul-190.3%
neg-sub090.3%
associate--r-90.3%
neg-sub090.3%
Simplified90.3%
Taylor expanded in y around 0 77.7%
associate-/l*90.3%
associate-/r/88.2%
Simplified88.2%
Final simplification90.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.2) (not (<= t 2.1e+22))) (+ x y) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.2) || !(t <= 2.1e+22)) {
tmp = x + y;
} else {
tmp = x + (z / (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 ((t <= (-0.2d0)) .or. (.not. (t <= 2.1d+22))) then
tmp = x + y
else
tmp = x + (z / (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 ((t <= -0.2) || !(t <= 2.1e+22)) {
tmp = x + y;
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -0.2) or not (t <= 2.1e+22): tmp = x + y else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.2) || !(t <= 2.1e+22)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -0.2) || ~((t <= 2.1e+22))) tmp = x + y; else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.2], N[Not[LessEqual[t, 2.1e+22]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.2 \lor \neg \left(t \leq 2.1 \cdot 10^{+22}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -0.20000000000000001 or 2.0999999999999998e22 < t Initial program 79.1%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -0.20000000000000001 < t < 2.0999999999999998e22Initial program 93.6%
associate-*l/94.8%
Simplified94.8%
*-commutative94.8%
clear-num94.7%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in t around 0 78.4%
associate-/l*82.4%
associate-/r/82.4%
Simplified82.4%
*-commutative82.4%
clear-num82.4%
div-inv83.5%
Applied egg-rr83.5%
Final simplification81.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.5) (+ x y) (if (<= t 3300000.0) (+ x (* y (/ z a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.5) {
tmp = x + y;
} else if (t <= 3300000.0) {
tmp = x + (y * (z / 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 <= (-5.5d0)) then
tmp = x + y
else if (t <= 3300000.0d0) then
tmp = x + (y * (z / 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 <= -5.5) {
tmp = x + y;
} else if (t <= 3300000.0) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.5: tmp = x + y elif t <= 3300000.0: tmp = x + (y * (z / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.5) tmp = Float64(x + y); elseif (t <= 3300000.0) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.5) tmp = x + y; elseif (t <= 3300000.0) tmp = x + (y * (z / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.5], N[(x + y), $MachinePrecision], If[LessEqual[t, 3300000.0], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 3300000:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -5.5 or 3.3e6 < t Initial program 79.1%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -5.5 < t < 3.3e6Initial program 93.6%
associate-*l/94.8%
Simplified94.8%
Taylor expanded in z around inf 88.9%
associate-*l/92.6%
*-commutative92.6%
Simplified92.6%
*-commutative92.6%
associate-/r/91.4%
clear-num91.3%
associate-/r*88.8%
Applied egg-rr88.8%
Taylor expanded in a around inf 78.4%
*-commutative78.4%
associate-*l/81.1%
*-commutative81.1%
Simplified81.1%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.8) (+ x y) (if (<= t 4300000000000.0) (+ x (* z (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8) {
tmp = x + y;
} else if (t <= 4300000000000.0) {
tmp = x + (z * (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 <= (-1.8d0)) then
tmp = x + y
else if (t <= 4300000000000.0d0) then
tmp = x + (z * (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 <= -1.8) {
tmp = x + y;
} else if (t <= 4300000000000.0) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.8: tmp = x + y elif t <= 4300000000000.0: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8) tmp = Float64(x + y); elseif (t <= 4300000000000.0) tmp = Float64(x + Float64(z * 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 <= -1.8) tmp = x + y; elseif (t <= 4300000000000.0) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8], N[(x + y), $MachinePrecision], If[LessEqual[t, 4300000000000.0], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 4300000000000:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.80000000000000004 or 4.3e12 < t Initial program 79.1%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around inf 79.6%
if -1.80000000000000004 < t < 4.3e12Initial program 93.6%
associate-*l/94.8%
Simplified94.8%
*-commutative94.8%
clear-num94.7%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in t around 0 78.4%
associate-/l*82.4%
associate-/r/82.4%
Simplified82.4%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((z - t) * (y / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (a - t)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a - t}
\end{array}
Initial program 86.6%
associate-*l/95.8%
Simplified95.8%
Final simplification95.8%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 86.6%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in t around inf 62.7%
Final simplification62.7%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2023257
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))