
(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 98.1%
Final simplification98.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -51000000000000.0)
(+ x y)
(if (<= t 9.8e-98)
(+ x (/ z (/ a y)))
(if (<= t 5.4e+41) (- x (/ y (/ t z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -51000000000000.0) {
tmp = x + y;
} else if (t <= 9.8e-98) {
tmp = x + (z / (a / y));
} else if (t <= 5.4e+41) {
tmp = x - (y / (t / 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 (t <= (-51000000000000.0d0)) then
tmp = x + y
else if (t <= 9.8d-98) then
tmp = x + (z / (a / y))
else if (t <= 5.4d+41) then
tmp = x - (y / (t / 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 (t <= -51000000000000.0) {
tmp = x + y;
} else if (t <= 9.8e-98) {
tmp = x + (z / (a / y));
} else if (t <= 5.4e+41) {
tmp = x - (y / (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -51000000000000.0: tmp = x + y elif t <= 9.8e-98: tmp = x + (z / (a / y)) elif t <= 5.4e+41: tmp = x - (y / (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -51000000000000.0) tmp = Float64(x + y); elseif (t <= 9.8e-98) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (t <= 5.4e+41) tmp = Float64(x - Float64(y / Float64(t / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -51000000000000.0) tmp = x + y; elseif (t <= 9.8e-98) tmp = x + (z / (a / y)); elseif (t <= 5.4e+41) tmp = x - (y / (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -51000000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[t, 9.8e-98], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.4e+41], N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -51000000000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 9.8 \cdot 10^{-98}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+41}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -5.1e13 or 5.39999999999999999e41 < t Initial program 99.9%
Taylor expanded in t around inf 83.7%
if -5.1e13 < t < 9.80000000000000028e-98Initial program 95.7%
Taylor expanded in t around 0 74.5%
associate-/l*80.5%
Simplified80.5%
associate-/r/81.4%
Applied egg-rr81.4%
*-commutative81.4%
clear-num81.4%
un-div-inv81.4%
Applied egg-rr81.4%
if 9.80000000000000028e-98 < t < 5.39999999999999999e41Initial program 100.0%
Taylor expanded in a around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in z around inf 73.0%
associate-/l*73.1%
Simplified73.1%
Final simplification81.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8300000000.0)
(+ x y)
(if (<= t 8.8e-98)
(+ x (/ (- z t) (/ a y)))
(if (<= t 5.5e+41) (- x (/ y (/ t z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8300000000.0) {
tmp = x + y;
} else if (t <= 8.8e-98) {
tmp = x + ((z - t) / (a / y));
} else if (t <= 5.5e+41) {
tmp = x - (y / (t / 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 (t <= (-8300000000.0d0)) then
tmp = x + y
else if (t <= 8.8d-98) then
tmp = x + ((z - t) / (a / y))
else if (t <= 5.5d+41) then
tmp = x - (y / (t / 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 (t <= -8300000000.0) {
tmp = x + y;
} else if (t <= 8.8e-98) {
tmp = x + ((z - t) / (a / y));
} else if (t <= 5.5e+41) {
tmp = x - (y / (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8300000000.0: tmp = x + y elif t <= 8.8e-98: tmp = x + ((z - t) / (a / y)) elif t <= 5.5e+41: tmp = x - (y / (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8300000000.0) tmp = Float64(x + y); elseif (t <= 8.8e-98) tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); elseif (t <= 5.5e+41) tmp = Float64(x - Float64(y / Float64(t / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8300000000.0) tmp = x + y; elseif (t <= 8.8e-98) tmp = x + ((z - t) / (a / y)); elseif (t <= 5.5e+41) tmp = x - (y / (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8300000000.0], N[(x + y), $MachinePrecision], If[LessEqual[t, 8.8e-98], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+41], N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8300000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{-98}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+41}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -8.3e9 or 5.5000000000000003e41 < t Initial program 99.9%
Taylor expanded in t around inf 83.7%
if -8.3e9 < t < 8.79999999999999985e-98Initial program 95.7%
Taylor expanded in a around inf 75.3%
*-commutative75.3%
associate-/l*81.8%
Simplified81.8%
if 8.79999999999999985e-98 < t < 5.5000000000000003e41Initial program 100.0%
Taylor expanded in a around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in z around inf 73.0%
associate-/l*73.1%
Simplified73.1%
Final simplification81.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.9e-96) (not (<= t 9.5e-98))) (+ x (/ (- t z) (/ t y))) (+ x (/ (- z t) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.9e-96) || !(t <= 9.5e-98)) {
tmp = x + ((t - z) / (t / y));
} else {
tmp = x + ((z - t) / (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 <= (-2.9d-96)) .or. (.not. (t <= 9.5d-98))) then
tmp = x + ((t - z) / (t / y))
else
tmp = x + ((z - t) / (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 <= -2.9e-96) || !(t <= 9.5e-98)) {
tmp = x + ((t - z) / (t / y));
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.9e-96) or not (t <= 9.5e-98): tmp = x + ((t - z) / (t / y)) else: tmp = x + ((z - t) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.9e-96) || !(t <= 9.5e-98)) tmp = Float64(x + Float64(Float64(t - z) / Float64(t / y))); else tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.9e-96) || ~((t <= 9.5e-98))) tmp = x + ((t - z) / (t / y)); else tmp = x + ((z - t) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.9e-96], N[Not[LessEqual[t, 9.5e-98]], $MachinePrecision]], N[(x + N[(N[(t - z), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-96} \lor \neg \left(t \leq 9.5 \cdot 10^{-98}\right):\\
\;\;\;\;x + \frac{t - z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.89999999999999994e-96 or 9.5000000000000001e-98 < t Initial program 99.4%
Taylor expanded in a around 0 73.8%
+-commutative73.8%
mul-1-neg73.8%
unsub-neg73.8%
associate-/l*82.2%
Simplified82.2%
if -2.89999999999999994e-96 < t < 9.5000000000000001e-98Initial program 95.4%
Taylor expanded in a around inf 83.2%
*-commutative83.2%
associate-/l*89.8%
Simplified89.8%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -34000000000.0) (not (<= t 1.7e-9))) (+ x y) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -34000000000.0) || !(t <= 1.7e-9)) {
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 <= (-34000000000.0d0)) .or. (.not. (t <= 1.7d-9))) 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 <= -34000000000.0) || !(t <= 1.7e-9)) {
tmp = x + y;
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -34000000000.0) or not (t <= 1.7e-9): tmp = x + y else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -34000000000.0) || !(t <= 1.7e-9)) 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 <= -34000000000.0) || ~((t <= 1.7e-9))) tmp = x + y; else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -34000000000.0], N[Not[LessEqual[t, 1.7e-9]], $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 -34000000000 \lor \neg \left(t \leq 1.7 \cdot 10^{-9}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -3.4e10 or 1.6999999999999999e-9 < t Initial program 99.9%
Taylor expanded in t around inf 80.4%
if -3.4e10 < t < 1.6999999999999999e-9Initial program 96.3%
Taylor expanded in t around 0 71.5%
associate-/l*77.5%
Simplified77.5%
associate-/r/78.3%
Applied egg-rr78.3%
*-commutative78.3%
clear-num78.3%
un-div-inv78.3%
Applied egg-rr78.3%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -4000000000000.0) (+ x y) (if (<= t 5.6e-11) (+ x (* y (/ z a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4000000000000.0) {
tmp = x + y;
} else if (t <= 5.6e-11) {
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 <= (-4000000000000.0d0)) then
tmp = x + y
else if (t <= 5.6d-11) 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 <= -4000000000000.0) {
tmp = x + y;
} else if (t <= 5.6e-11) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4000000000000.0: tmp = x + y elif t <= 5.6e-11: tmp = x + (y * (z / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4000000000000.0) tmp = Float64(x + y); elseif (t <= 5.6e-11) 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 <= -4000000000000.0) tmp = x + y; elseif (t <= 5.6e-11) tmp = x + (y * (z / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4000000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[t, 5.6e-11], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4000000000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-11}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -4e12 or 5.6e-11 < t Initial program 99.9%
Taylor expanded in t around inf 80.4%
if -4e12 < t < 5.6e-11Initial program 96.3%
Taylor expanded in t around 0 77.0%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.1e+15) (+ x y) (if (<= t 3.5e-10) (+ x (* z (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.1e+15) {
tmp = x + y;
} else if (t <= 3.5e-10) {
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 <= (-2.1d+15)) then
tmp = x + y
else if (t <= 3.5d-10) 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 <= -2.1e+15) {
tmp = x + y;
} else if (t <= 3.5e-10) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.1e+15: tmp = x + y elif t <= 3.5e-10: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.1e+15) tmp = Float64(x + y); elseif (t <= 3.5e-10) 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 <= -2.1e+15) tmp = x + y; elseif (t <= 3.5e-10) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.1e+15], N[(x + y), $MachinePrecision], If[LessEqual[t, 3.5e-10], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-10}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.1e15 or 3.4999999999999998e-10 < t Initial program 99.9%
Taylor expanded in t around inf 80.4%
if -2.1e15 < t < 3.4999999999999998e-10Initial program 96.3%
Taylor expanded in t around 0 71.5%
associate-/l*77.5%
Simplified77.5%
associate-/r/78.3%
Applied egg-rr78.3%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.3e-134) (+ x y) (if (<= t 5e+41) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e-134) {
tmp = x + y;
} else if (t <= 5e+41) {
tmp = x;
} 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 <= (-3.3d-134)) then
tmp = x + y
else if (t <= 5d+41) then
tmp = x
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 <= -3.3e-134) {
tmp = x + y;
} else if (t <= 5e+41) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.3e-134: tmp = x + y elif t <= 5e+41: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.3e-134) tmp = Float64(x + y); elseif (t <= 5e+41) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.3e-134) tmp = x + y; elseif (t <= 5e+41) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.3e-134], N[(x + y), $MachinePrecision], If[LessEqual[t, 5e+41], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-134}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -3.30000000000000019e-134 or 5.00000000000000022e41 < t Initial program 98.7%
Taylor expanded in t around inf 73.7%
if -3.30000000000000019e-134 < t < 5.00000000000000022e41Initial program 97.4%
Taylor expanded in x around inf 60.3%
Final simplification68.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 98.1%
Taylor expanded in x around inf 51.9%
Final simplification51.9%
(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 2023200
(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)))))