
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.4e+62) (not (<= t 5.4e+73))) (+ x y) (+ x (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+62) || !(t <= 5.4e+73)) {
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.4d+62)) .or. (.not. (t <= 5.4d+73))) 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.4e+62) || !(t <= 5.4e+73)) {
tmp = x + y;
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.4e+62) or not (t <= 5.4e+73): 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.4e+62) || !(t <= 5.4e+73)) 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.4e+62) || ~((t <= 5.4e+73))) 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.4e+62], N[Not[LessEqual[t, 5.4e+73]], $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.4 \cdot 10^{+62} \lor \neg \left(t \leq 5.4 \cdot 10^{+73}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -2.4e62 or 5.3999999999999998e73 < t Initial program 99.9%
Taylor expanded in t around inf 82.3%
+-commutative82.3%
Simplified82.3%
if -2.4e62 < t < 5.3999999999999998e73Initial program 96.6%
Taylor expanded in y around 0 93.4%
*-commutative93.4%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in z around inf 79.6%
*-commutative79.6%
associate-*r/83.4%
Simplified83.4%
Final simplification83.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.2e+61) (not (<= t 2.15e+70))) (+ x y) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.2e+61) || !(t <= 2.15e+70)) {
tmp = x + y;
} else {
tmp = x + (y / ((a - 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 ((t <= (-4.2d+61)) .or. (.not. (t <= 2.15d+70))) then
tmp = x + y
else
tmp = x + (y / ((a - 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 ((t <= -4.2e+61) || !(t <= 2.15e+70)) {
tmp = x + y;
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.2e+61) or not (t <= 2.15e+70): tmp = x + y else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.2e+61) || !(t <= 2.15e+70)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.2e+61) || ~((t <= 2.15e+70))) tmp = x + y; else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.2e+61], N[Not[LessEqual[t, 2.15e+70]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+61} \lor \neg \left(t \leq 2.15 \cdot 10^{+70}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -4.2000000000000002e61 or 2.15e70 < t Initial program 99.9%
Taylor expanded in t around inf 82.3%
+-commutative82.3%
Simplified82.3%
if -4.2000000000000002e61 < t < 2.15e70Initial program 96.6%
Taylor expanded in z around inf 79.6%
associate-/l*84.4%
Simplified84.4%
Final simplification83.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3e+29) (not (<= t 4.3e+78))) (- x (* y (+ -1.0 (/ z t)))) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3e+29) || !(t <= 4.3e+78)) {
tmp = x - (y * (-1.0 + (z / t)));
} else {
tmp = x + (y / ((a - 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 ((t <= (-3d+29)) .or. (.not. (t <= 4.3d+78))) then
tmp = x - (y * ((-1.0d0) + (z / t)))
else
tmp = x + (y / ((a - 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 ((t <= -3e+29) || !(t <= 4.3e+78)) {
tmp = x - (y * (-1.0 + (z / t)));
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3e+29) or not (t <= 4.3e+78): tmp = x - (y * (-1.0 + (z / t))) else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3e+29) || !(t <= 4.3e+78)) tmp = Float64(x - Float64(y * Float64(-1.0 + Float64(z / t)))); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3e+29) || ~((t <= 4.3e+78))) tmp = x - (y * (-1.0 + (z / t))); else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3e+29], N[Not[LessEqual[t, 4.3e+78]], $MachinePrecision]], N[(x - N[(y * N[(-1.0 + N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+29} \lor \neg \left(t \leq 4.3 \cdot 10^{+78}\right):\\
\;\;\;\;x - y \cdot \left(-1 + \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -2.9999999999999999e29 or 4.29999999999999981e78 < t Initial program 99.9%
Taylor expanded in a around 0 69.7%
mul-1-neg69.7%
unsub-neg69.7%
associate-/l*91.8%
associate-/r/88.7%
Simplified88.7%
Taylor expanded in t around 0 80.5%
*-commutative80.5%
associate-*l/91.8%
distribute-rgt-out91.8%
Simplified91.8%
if -2.9999999999999999e29 < t < 4.29999999999999981e78Initial program 96.5%
Taylor expanded in z around inf 79.6%
associate-/l*84.6%
Simplified84.6%
Final simplification87.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.4e-85) (+ x (/ y (/ (- a t) z))) (if (<= z 2.25e-39) (- x (* t (/ y (- a t)))) (+ x (/ z (/ (- a t) y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e-85) {
tmp = x + (y / ((a - t) / z));
} else if (z <= 2.25e-39) {
tmp = x - (t * (y / (a - t)));
} else {
tmp = x + (z / ((a - t) / 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.4d-85)) then
tmp = x + (y / ((a - t) / z))
else if (z <= 2.25d-39) then
tmp = x - (t * (y / (a - t)))
else
tmp = x + (z / ((a - t) / 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.4e-85) {
tmp = x + (y / ((a - t) / z));
} else if (z <= 2.25e-39) {
tmp = x - (t * (y / (a - t)));
} else {
tmp = x + (z / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.4e-85: tmp = x + (y / ((a - t) / z)) elif z <= 2.25e-39: tmp = x - (t * (y / (a - t))) else: tmp = x + (z / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.4e-85) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); elseif (z <= 2.25e-39) tmp = Float64(x - Float64(t * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(z / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.4e-85) tmp = x + (y / ((a - t) / z)); elseif (z <= 2.25e-39) tmp = x - (t * (y / (a - t))); else tmp = x + (z / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.4e-85], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e-39], N[(x - N[(t * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{-85}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-39}:\\
\;\;\;\;x - t \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if z < -6.40000000000000054e-85Initial program 98.5%
Taylor expanded in z around inf 77.8%
associate-/l*90.4%
Simplified90.4%
if -6.40000000000000054e-85 < z < 2.25e-39Initial program 98.2%
Taylor expanded in z around 0 87.2%
mul-1-neg87.2%
unsub-neg87.2%
*-commutative87.2%
associate-/l*93.3%
Simplified93.3%
associate-/r/92.6%
Applied egg-rr92.6%
if 2.25e-39 < z Initial program 96.3%
Taylor expanded in y around 0 81.9%
*-commutative81.9%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around inf 79.6%
*-commutative79.6%
associate-*r/87.3%
Simplified87.3%
clear-num87.3%
un-div-inv87.3%
Applied egg-rr87.3%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.96e-84) (+ x (/ y (/ (- a t) z))) (if (<= z 3e-37) (- x (/ y (/ (- a t) t))) (+ x (/ z (/ (- a t) y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.96e-84) {
tmp = x + (y / ((a - t) / z));
} else if (z <= 3e-37) {
tmp = x - (y / ((a - t) / t));
} else {
tmp = x + (z / ((a - t) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.96d-84)) then
tmp = x + (y / ((a - t) / z))
else if (z <= 3d-37) then
tmp = x - (y / ((a - t) / t))
else
tmp = x + (z / ((a - t) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.96e-84) {
tmp = x + (y / ((a - t) / z));
} else if (z <= 3e-37) {
tmp = x - (y / ((a - t) / t));
} else {
tmp = x + (z / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.96e-84: tmp = x + (y / ((a - t) / z)) elif z <= 3e-37: tmp = x - (y / ((a - t) / t)) else: tmp = x + (z / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.96e-84) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); elseif (z <= 3e-37) tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); else tmp = Float64(x + Float64(z / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.96e-84) tmp = x + (y / ((a - t) / z)); elseif (z <= 3e-37) tmp = x - (y / ((a - t) / t)); else tmp = x + (z / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.96e-84], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-37], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.96 \cdot 10^{-84}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-37}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if z < -1.96000000000000006e-84Initial program 98.5%
Taylor expanded in z around inf 77.8%
associate-/l*90.4%
Simplified90.4%
if -1.96000000000000006e-84 < z < 3e-37Initial program 98.2%
Taylor expanded in z around 0 87.3%
mul-1-neg87.3%
unsub-neg87.3%
*-commutative87.3%
associate-/l*93.4%
Simplified93.4%
if 3e-37 < z Initial program 96.2%
Taylor expanded in y around 0 81.7%
*-commutative81.7%
associate-/l*97.6%
Simplified97.6%
Taylor expanded in z around inf 80.5%
*-commutative80.5%
associate-*r/88.3%
Simplified88.3%
clear-num88.3%
un-div-inv88.3%
Applied egg-rr88.3%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.6e-26) (not (<= t 1.55e+83))) (+ x y) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.6e-26) || !(t <= 1.55e+83)) {
tmp = x + y;
} else {
tmp = x + (y * (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 <= (-4.6d-26)) .or. (.not. (t <= 1.55d+83))) then
tmp = x + y
else
tmp = x + (y * (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 <= -4.6e-26) || !(t <= 1.55e+83)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.6e-26) or not (t <= 1.55e+83): tmp = x + y else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.6e-26) || !(t <= 1.55e+83)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.6e-26) || ~((t <= 1.55e+83))) tmp = x + y; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.6e-26], N[Not[LessEqual[t, 1.55e+83]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-26} \lor \neg \left(t \leq 1.55 \cdot 10^{+83}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -4.60000000000000018e-26 or 1.54999999999999996e83 < t Initial program 99.0%
Taylor expanded in t around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -4.60000000000000018e-26 < t < 1.54999999999999996e83Initial program 96.7%
Taylor expanded in t around 0 77.7%
Final simplification77.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.5e+73) x (if (<= a 2.15e+28) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.5e+73) {
tmp = x;
} else if (a <= 2.15e+28) {
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 (a <= (-9.5d+73)) then
tmp = x
else if (a <= 2.15d+28) 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 (a <= -9.5e+73) {
tmp = x;
} else if (a <= 2.15e+28) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.5e+73: tmp = x elif a <= 2.15e+28: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.5e+73) tmp = x; elseif (a <= 2.15e+28) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -9.5e+73) tmp = x; elseif (a <= 2.15e+28) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.5e+73], x, If[LessEqual[a, 2.15e+28], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{+73}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{+28}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.4999999999999996e73 or 2.14999999999999988e28 < a Initial program 98.1%
Taylor expanded in x around inf 60.9%
if -9.4999999999999996e73 < a < 2.14999999999999988e28Initial program 97.3%
Taylor expanded in t around inf 61.3%
+-commutative61.3%
Simplified61.3%
Final simplification61.1%
(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 97.7%
Taylor expanded in x around inf 48.1%
Final simplification48.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023336
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))