
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= t -7.5e-115) (+ x (* z (/ (- y x) t))) (+ x (/ (- y x) (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e-115) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-7.5d-115)) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e-115) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.5e-115: tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.5e-115) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.5e-115) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.5e-115], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-115}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -7.50000000000000038e-115Initial program 91.0%
*-commutative91.0%
associate-/l*99.4%
Applied egg-rr99.4%
if -7.50000000000000038e-115 < t Initial program 92.9%
associate-/l*98.2%
clear-num98.1%
un-div-inv98.5%
Applied egg-rr98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* z (- y x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+297)))
(+ x (* z (/ (- y x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+297)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+297)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z * (y - x)) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+297): tmp = x + (z * ((y - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(z * Float64(y - x)) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+297)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((z * (y - x)) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+297))) tmp = x + (z * ((y - x) / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+297]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+297}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 2e297 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 79.5%
*-commutative79.5%
associate-/l*99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2e297Initial program 98.3%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.25e+19) x (if (<= x 4e-91) (/ z (/ t y)) (if (<= x 4.2e+226) x (/ (* x (- z)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.25e+19) {
tmp = x;
} else if (x <= 4e-91) {
tmp = z / (t / y);
} else if (x <= 4.2e+226) {
tmp = x;
} else {
tmp = (x * -z) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.25d+19)) then
tmp = x
else if (x <= 4d-91) then
tmp = z / (t / y)
else if (x <= 4.2d+226) then
tmp = x
else
tmp = (x * -z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.25e+19) {
tmp = x;
} else if (x <= 4e-91) {
tmp = z / (t / y);
} else if (x <= 4.2e+226) {
tmp = x;
} else {
tmp = (x * -z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.25e+19: tmp = x elif x <= 4e-91: tmp = z / (t / y) elif x <= 4.2e+226: tmp = x else: tmp = (x * -z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.25e+19) tmp = x; elseif (x <= 4e-91) tmp = Float64(z / Float64(t / y)); elseif (x <= 4.2e+226) tmp = x; else tmp = Float64(Float64(x * Float64(-z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.25e+19) tmp = x; elseif (x <= 4e-91) tmp = z / (t / y); elseif (x <= 4.2e+226) tmp = x; else tmp = (x * -z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.25e+19], x, If[LessEqual[x, 4e-91], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+226], x, N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-91}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+226}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\end{array}
\end{array}
if x < -2.25e19 or 4.00000000000000009e-91 < x < 4.19999999999999986e226Initial program 92.1%
Taylor expanded in z around 0 53.3%
if -2.25e19 < x < 4.00000000000000009e-91Initial program 92.9%
Taylor expanded in z around -inf 72.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
associate-/l*69.1%
clear-num69.1%
un-div-inv69.8%
Applied egg-rr69.8%
if 4.19999999999999986e226 < x Initial program 86.3%
Taylor expanded in z around -inf 72.9%
Taylor expanded in y around 0 72.9%
mul-1-neg72.9%
distribute-rgt-neg-in72.9%
Simplified72.9%
(FPCore (x y z t) :precision binary64 (if (<= x -4.8e+16) x (if (<= x 4.3e-89) (/ z (/ t y)) (if (<= x 2.1e+225) x (* x (/ (- z) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e+16) {
tmp = x;
} else if (x <= 4.3e-89) {
tmp = z / (t / y);
} else if (x <= 2.1e+225) {
tmp = x;
} else {
tmp = x * (-z / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-4.8d+16)) then
tmp = x
else if (x <= 4.3d-89) then
tmp = z / (t / y)
else if (x <= 2.1d+225) then
tmp = x
else
tmp = x * (-z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e+16) {
tmp = x;
} else if (x <= 4.3e-89) {
tmp = z / (t / y);
} else if (x <= 2.1e+225) {
tmp = x;
} else {
tmp = x * (-z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.8e+16: tmp = x elif x <= 4.3e-89: tmp = z / (t / y) elif x <= 2.1e+225: tmp = x else: tmp = x * (-z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.8e+16) tmp = x; elseif (x <= 4.3e-89) tmp = Float64(z / Float64(t / y)); elseif (x <= 2.1e+225) tmp = x; else tmp = Float64(x * Float64(Float64(-z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.8e+16) tmp = x; elseif (x <= 4.3e-89) tmp = z / (t / y); elseif (x <= 2.1e+225) tmp = x; else tmp = x * (-z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e+16], x, If[LessEqual[x, 4.3e-89], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.1e+225], x, N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-89}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+225}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\end{array}
\end{array}
if x < -4.8e16 or 4.29999999999999987e-89 < x < 2.1e225Initial program 92.1%
Taylor expanded in z around 0 53.3%
if -4.8e16 < x < 4.29999999999999987e-89Initial program 92.9%
Taylor expanded in z around -inf 72.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
associate-/l*69.1%
clear-num69.1%
un-div-inv69.8%
Applied egg-rr69.8%
if 2.1e225 < x Initial program 86.3%
Taylor expanded in z around -inf 72.9%
*-commutative72.9%
associate-*l/72.8%
associate-/r/72.7%
Applied egg-rr72.7%
Taylor expanded in y around 0 72.9%
mul-1-neg72.9%
associate-*r/72.7%
distribute-rgt-neg-in72.7%
distribute-frac-neg272.7%
Simplified72.7%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.3e-162) (not (<= t 1.55e-205))) (+ x (* z (/ (- y x) t))) (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.3e-162) || !(t <= 1.55e-205)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = (y - x) / (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.3d-162)) .or. (.not. (t <= 1.55d-205))) then
tmp = x + (z * ((y - x) / t))
else
tmp = (y - x) / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.3e-162) || !(t <= 1.55e-205)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = (y - x) / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.3e-162) or not (t <= 1.55e-205): tmp = x + (z * ((y - x) / t)) else: tmp = (y - x) / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.3e-162) || !(t <= 1.55e-205)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(Float64(y - x) / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.3e-162) || ~((t <= 1.55e-205))) tmp = x + (z * ((y - x) / t)); else tmp = (y - x) / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.3e-162], N[Not[LessEqual[t, 1.55e-205]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-162} \lor \neg \left(t \leq 1.55 \cdot 10^{-205}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -1.3e-162 or 1.54999999999999991e-205 < t Initial program 90.9%
*-commutative90.9%
associate-/l*97.8%
Applied egg-rr97.8%
if -1.3e-162 < t < 1.54999999999999991e-205Initial program 97.9%
Taylor expanded in z around -inf 93.9%
*-commutative93.9%
associate-*l/74.1%
associate-/r/95.2%
Applied egg-rr95.2%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.9e+156) (not (<= x 3.8e+50))) (- x (* x (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e+156) || !(x <= 3.8e+50)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.9d+156)) .or. (.not. (x <= 3.8d+50))) then
tmp = x - (x * (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e+156) || !(x <= 3.8e+50)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.9e+156) or not (x <= 3.8e+50): tmp = x - (x * (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.9e+156) || !(x <= 3.8e+50)) tmp = Float64(x - Float64(x * Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.9e+156) || ~((x <= 3.8e+50))) tmp = x - (x * (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e+156], N[Not[LessEqual[x, 3.8e+50]], $MachinePrecision]], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+156} \lor \neg \left(x \leq 3.8 \cdot 10^{+50}\right):\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.90000000000000012e156 or 3.79999999999999987e50 < x Initial program 90.0%
Taylor expanded in x around inf 97.0%
distribute-lft-in97.0%
*-rgt-identity97.0%
mul-1-neg97.0%
distribute-rgt-neg-in97.0%
distribute-lft-neg-in97.0%
cancel-sign-sub-inv97.0%
Simplified97.0%
if -1.90000000000000012e156 < x < 3.79999999999999987e50Initial program 93.2%
Taylor expanded in y around inf 84.9%
associate-/l*87.9%
Simplified87.9%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.35e+16) (not (<= x 3e-87))) x (/ y (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e+16) || !(x <= 3e-87)) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.35d+16)) .or. (.not. (x <= 3d-87))) then
tmp = x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e+16) || !(x <= 3e-87)) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.35e+16) or not (x <= 3e-87): tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.35e+16) || !(x <= 3e-87)) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.35e+16) || ~((x <= 3e-87))) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.35e+16], N[Not[LessEqual[x, 3e-87]], $MachinePrecision]], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+16} \lor \neg \left(x \leq 3 \cdot 10^{-87}\right):\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -1.35e16 or 3.00000000000000016e-87 < x Initial program 91.5%
Taylor expanded in z around 0 51.1%
if -1.35e16 < x < 3.00000000000000016e-87Initial program 92.9%
Taylor expanded in z around -inf 72.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
*-commutative67.3%
associate-/l*69.6%
Applied egg-rr69.6%
clear-num69.2%
div-inv69.7%
Applied egg-rr69.7%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e+17) x (if (<= x 1.4e-85) (/ z (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e+17) {
tmp = x;
} else if (x <= 1.4e-85) {
tmp = z / (t / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.9d+17)) then
tmp = x
else if (x <= 1.4d-85) then
tmp = z / (t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e+17) {
tmp = x;
} else if (x <= 1.4e-85) {
tmp = z / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e+17: tmp = x elif x <= 1.4e-85: tmp = z / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e+17) tmp = x; elseif (x <= 1.4e-85) tmp = Float64(z / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e+17) tmp = x; elseif (x <= 1.4e-85) tmp = z / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e+17], x, If[LessEqual[x, 1.4e-85], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-85}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.9e17 or 1.40000000000000008e-85 < x Initial program 91.5%
Taylor expanded in z around 0 51.1%
if -3.9e17 < x < 1.40000000000000008e-85Initial program 92.9%
Taylor expanded in z around -inf 72.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
associate-/l*69.1%
clear-num69.1%
un-div-inv69.8%
Applied egg-rr69.8%
(FPCore (x y z t) :precision binary64 (if (<= x -3700000000000.0) x (if (<= x 9e-86) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3700000000000.0) {
tmp = x;
} else if (x <= 9e-86) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3700000000000.0d0)) then
tmp = x
else if (x <= 9d-86) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3700000000000.0) {
tmp = x;
} else if (x <= 9e-86) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3700000000000.0: tmp = x elif x <= 9e-86: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3700000000000.0) tmp = x; elseif (x <= 9e-86) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3700000000000.0) tmp = x; elseif (x <= 9e-86) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3700000000000.0], x, If[LessEqual[x, 9e-86], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3700000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-86}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.7e12 or 8.9999999999999995e-86 < x Initial program 91.5%
Taylor expanded in z around 0 51.1%
if -3.7e12 < x < 8.9999999999999995e-86Initial program 92.9%
Taylor expanded in z around -inf 72.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
*-commutative67.3%
associate-/l*69.6%
Applied egg-rr69.6%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ z t))))
double code(double x, double y, double z, double t) {
return x + (y * (z / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (y * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z / t));
}
def code(x, y, z, t): return x + (y * (z / t))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z}{t}
\end{array}
Initial program 92.2%
Taylor expanded in y around inf 76.3%
associate-/l*77.9%
Simplified77.9%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.2%
Taylor expanded in z around 0 37.7%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024097
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))