
(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 13 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 -3.85e-41) (+ x (* z (/ (- y x) t))) (if (<= t 7.2e-23) (+ x (/ (* z (- y x)) t)) (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.85e-41) {
tmp = x + (z * ((y - x) / t));
} else if (t <= 7.2e-23) {
tmp = x + ((z * (y - x)) / t);
} else {
tmp = x + (z / (t / (y - 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 (t <= (-3.85d-41)) then
tmp = x + (z * ((y - x) / t))
else if (t <= 7.2d-23) then
tmp = x + ((z * (y - x)) / t)
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.85e-41) {
tmp = x + (z * ((y - x) / t));
} else if (t <= 7.2e-23) {
tmp = x + ((z * (y - x)) / t);
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.85e-41: tmp = x + (z * ((y - x) / t)) elif t <= 7.2e-23: tmp = x + ((z * (y - x)) / t) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.85e-41) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); elseif (t <= 7.2e-23) tmp = Float64(x + Float64(Float64(z * Float64(y - x)) / t)); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.85e-41) tmp = x + (z * ((y - x) / t)); elseif (t <= 7.2e-23) tmp = x + ((z * (y - x)) / t); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.85e-41], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e-23], N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.85 \cdot 10^{-41}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if t < -3.8499999999999999e-41Initial program 88.0%
associate-*l/99.8%
Simplified99.8%
if -3.8499999999999999e-41 < t < 7.1999999999999996e-23Initial program 98.4%
if 7.1999999999999996e-23 < t Initial program 82.4%
associate-*l/99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
\end{array}
Initial program 91.5%
+-commutative91.5%
*-commutative91.5%
associate-*l/97.6%
fma-def97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) y)))
(if (<= t -9e-27)
x
(if (<= t -2.5e-306)
t_1
(if (<= t 2.8e-252)
(/ (* z (- x)) t)
(if (<= t 4.1e-184)
t_1
(if (<= t 1.15e-93)
(* z (/ (- x) t))
(if (<= t 1.45e+33) t_1 x))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if (t <= -9e-27) {
tmp = x;
} else if (t <= -2.5e-306) {
tmp = t_1;
} else if (t <= 2.8e-252) {
tmp = (z * -x) / t;
} else if (t <= 4.1e-184) {
tmp = t_1;
} else if (t <= 1.15e-93) {
tmp = z * (-x / t);
} else if (t <= 1.45e+33) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (z / t) * y
if (t <= (-9d-27)) then
tmp = x
else if (t <= (-2.5d-306)) then
tmp = t_1
else if (t <= 2.8d-252) then
tmp = (z * -x) / t
else if (t <= 4.1d-184) then
tmp = t_1
else if (t <= 1.15d-93) then
tmp = z * (-x / t)
else if (t <= 1.45d+33) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if (t <= -9e-27) {
tmp = x;
} else if (t <= -2.5e-306) {
tmp = t_1;
} else if (t <= 2.8e-252) {
tmp = (z * -x) / t;
} else if (t <= 4.1e-184) {
tmp = t_1;
} else if (t <= 1.15e-93) {
tmp = z * (-x / t);
} else if (t <= 1.45e+33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * y tmp = 0 if t <= -9e-27: tmp = x elif t <= -2.5e-306: tmp = t_1 elif t <= 2.8e-252: tmp = (z * -x) / t elif t <= 4.1e-184: tmp = t_1 elif t <= 1.15e-93: tmp = z * (-x / t) elif t <= 1.45e+33: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * y) tmp = 0.0 if (t <= -9e-27) tmp = x; elseif (t <= -2.5e-306) tmp = t_1; elseif (t <= 2.8e-252) tmp = Float64(Float64(z * Float64(-x)) / t); elseif (t <= 4.1e-184) tmp = t_1; elseif (t <= 1.15e-93) tmp = Float64(z * Float64(Float64(-x) / t)); elseif (t <= 1.45e+33) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * y; tmp = 0.0; if (t <= -9e-27) tmp = x; elseif (t <= -2.5e-306) tmp = t_1; elseif (t <= 2.8e-252) tmp = (z * -x) / t; elseif (t <= 4.1e-184) tmp = t_1; elseif (t <= 1.15e-93) tmp = z * (-x / t); elseif (t <= 1.45e+33) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t, -9e-27], x, If[LessEqual[t, -2.5e-306], t$95$1, If[LessEqual[t, 2.8e-252], N[(N[(z * (-x)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 4.1e-184], t$95$1, If[LessEqual[t, 1.15e-93], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+33], t$95$1, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
\mathbf{if}\;t \leq -9 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-252}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{t}\\
\mathbf{elif}\;t \leq 4.1 \cdot 10^{-184}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-93}:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.0000000000000003e-27 or 1.45000000000000012e33 < t Initial program 83.9%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 64.5%
if -9.0000000000000003e-27 < t < -2.49999999999999999e-306 or 2.80000000000000018e-252 < t < 4.1e-184 or 1.1499999999999999e-93 < t < 1.45000000000000012e33Initial program 99.1%
associate-*l/80.4%
Simplified80.4%
Taylor expanded in z around inf 66.2%
Taylor expanded in y around inf 48.4%
clear-num48.4%
un-div-inv50.8%
Applied egg-rr50.8%
associate-/r/60.8%
Applied egg-rr60.8%
if -2.49999999999999999e-306 < t < 2.80000000000000018e-252Initial program 99.5%
associate-*l/84.2%
Simplified84.2%
Taylor expanded in z around inf 75.9%
Taylor expanded in y around 0 75.9%
neg-mul-175.9%
+-commutative75.9%
sub-neg75.9%
div-sub84.2%
Simplified84.2%
clear-num84.1%
div-inv84.3%
Applied egg-rr84.3%
Taylor expanded in y around 0 95.9%
associate-*r/95.9%
mul-1-neg95.9%
distribute-lft-neg-out95.9%
Simplified95.9%
if 4.1e-184 < t < 1.1499999999999999e-93Initial program 93.8%
associate-*l/94.0%
Simplified94.0%
Taylor expanded in z around inf 76.2%
Taylor expanded in y around 0 56.0%
neg-mul-156.0%
distribute-neg-frac56.0%
Simplified56.0%
Final simplification63.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e-225) (not (<= z 4.5e-140))) (+ x (* z (/ (- y x) t))) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-225) || !(z <= 4.5e-140)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((z * y) / 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 ((z <= (-7.8d-225)) .or. (.not. (z <= 4.5d-140))) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-225) || !(z <= 4.5e-140)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e-225) or not (z <= 4.5e-140): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e-225) || !(z <= 4.5e-140)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.8e-225) || ~((z <= 4.5e-140))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e-225], N[Not[LessEqual[z, 4.5e-140]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-225} \lor \neg \left(z \leq 4.5 \cdot 10^{-140}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -7.8000000000000001e-225 or 4.50000000000000004e-140 < z Initial program 89.0%
associate-*l/97.0%
Simplified97.0%
if -7.8000000000000001e-225 < z < 4.50000000000000004e-140Initial program 99.8%
Taylor expanded in y around inf 96.7%
*-commutative96.7%
Simplified96.7%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (<= z -7.8e-225) (+ x (* z (/ (- y x) t))) (if (<= z 5.2e-140) (+ x (/ (* z y) t)) (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e-225) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 5.2e-140) {
tmp = x + ((z * y) / t);
} else {
tmp = x + (z / (t / (y - 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 (z <= (-7.8d-225)) then
tmp = x + (z * ((y - x) / t))
else if (z <= 5.2d-140) then
tmp = x + ((z * y) / t)
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e-225) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 5.2e-140) {
tmp = x + ((z * y) / t);
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.8e-225: tmp = x + (z * ((y - x) / t)) elif z <= 5.2e-140: tmp = x + ((z * y) / t) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.8e-225) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); elseif (z <= 5.2e-140) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.8e-225) tmp = x + (z * ((y - x) / t)); elseif (z <= 5.2e-140) tmp = x + ((z * y) / t); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.8e-225], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-140], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-225}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-140}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if z < -7.8000000000000001e-225Initial program 88.3%
associate-*l/97.2%
Simplified97.2%
if -7.8000000000000001e-225 < z < 5.1999999999999996e-140Initial program 99.8%
Taylor expanded in y around inf 96.7%
*-commutative96.7%
Simplified96.7%
if 5.1999999999999996e-140 < z Initial program 89.7%
associate-*l/96.8%
Simplified96.8%
*-commutative96.8%
clear-num96.7%
un-div-inv97.7%
Applied egg-rr97.7%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e-24) (not (<= z 7.5e-58))) (* z (/ (- y x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e-24) || !(z <= 7.5e-58)) {
tmp = z * ((y - x) / 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 ((z <= (-2.1d-24)) .or. (.not. (z <= 7.5d-58))) then
tmp = z * ((y - x) / 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 ((z <= -2.1e-24) || !(z <= 7.5e-58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e-24) or not (z <= 7.5e-58): tmp = z * ((y - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.1e-24) || !(z <= 7.5e-58)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.1e-24) || ~((z <= 7.5e-58))) tmp = z * ((y - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.1e-24], N[Not[LessEqual[z, 7.5e-58]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-24} \lor \neg \left(z \leq 7.5 \cdot 10^{-58}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.0999999999999999e-24 or 7.50000000000000002e-58 < z Initial program 85.3%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 81.3%
Taylor expanded in y around 0 81.3%
neg-mul-181.3%
+-commutative81.3%
sub-neg81.3%
div-sub83.5%
Simplified83.5%
if -2.0999999999999999e-24 < z < 7.50000000000000002e-58Initial program 98.4%
associate-*l/80.7%
Simplified80.7%
Taylor expanded in t around inf 62.7%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -110000.0) (not (<= z 9.2e-58))) (* z (/ (- y x) t)) (+ x (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -110000.0) || !(z <= 9.2e-58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + ((z / t) * y);
}
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 ((z <= (-110000.0d0)) .or. (.not. (z <= 9.2d-58))) then
tmp = z * ((y - x) / t)
else
tmp = x + ((z / t) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -110000.0) || !(z <= 9.2e-58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + ((z / t) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -110000.0) or not (z <= 9.2e-58): tmp = z * ((y - x) / t) else: tmp = x + ((z / t) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -110000.0) || !(z <= 9.2e-58)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x + Float64(Float64(z / t) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -110000.0) || ~((z <= 9.2e-58))) tmp = z * ((y - x) / t); else tmp = x + ((z / t) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -110000.0], N[Not[LessEqual[z, 9.2e-58]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -110000 \lor \neg \left(z \leq 9.2 \cdot 10^{-58}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\end{array}
\end{array}
if z < -1.1e5 or 9.1999999999999995e-58 < z Initial program 84.3%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 82.4%
Taylor expanded in y around 0 82.4%
neg-mul-182.4%
+-commutative82.4%
sub-neg82.4%
div-sub84.7%
Simplified84.7%
if -1.1e5 < z < 9.1999999999999995e-58Initial program 98.5%
associate-*l/81.9%
Simplified81.9%
Taylor expanded in y around inf 86.0%
associate-*r/85.2%
Simplified85.2%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -85000.0) (not (<= z 8.8e-58))) (* z (/ (- y x) t)) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -85000.0) || !(z <= 8.8e-58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + ((z * y) / 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 ((z <= (-85000.0d0)) .or. (.not. (z <= 8.8d-58))) then
tmp = z * ((y - x) / t)
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -85000.0) || !(z <= 8.8e-58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -85000.0) or not (z <= 8.8e-58): tmp = z * ((y - x) / t) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -85000.0) || !(z <= 8.8e-58)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -85000.0) || ~((z <= 8.8e-58))) tmp = z * ((y - x) / t); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -85000.0], N[Not[LessEqual[z, 8.8e-58]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -85000 \lor \neg \left(z \leq 8.8 \cdot 10^{-58}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -85000 or 8.80000000000000023e-58 < z Initial program 84.3%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 82.4%
Taylor expanded in y around 0 82.4%
neg-mul-182.4%
+-commutative82.4%
sub-neg82.4%
div-sub84.7%
Simplified84.7%
if -85000 < z < 8.80000000000000023e-58Initial program 98.5%
Taylor expanded in y around inf 86.0%
*-commutative86.0%
Simplified86.0%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.3e-57) (not (<= y 5.5e+67))) (+ x (* (/ z t) y)) (- x (* (/ z t) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.3e-57) || !(y <= 5.5e+67)) {
tmp = x + ((z / t) * y);
} else {
tmp = x - ((z / t) * 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 ((y <= (-3.3d-57)) .or. (.not. (y <= 5.5d+67))) then
tmp = x + ((z / t) * y)
else
tmp = x - ((z / t) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.3e-57) || !(y <= 5.5e+67)) {
tmp = x + ((z / t) * y);
} else {
tmp = x - ((z / t) * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.3e-57) or not (y <= 5.5e+67): tmp = x + ((z / t) * y) else: tmp = x - ((z / t) * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.3e-57) || !(y <= 5.5e+67)) tmp = Float64(x + Float64(Float64(z / t) * y)); else tmp = Float64(x - Float64(Float64(z / t) * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.3e-57) || ~((y <= 5.5e+67))) tmp = x + ((z / t) * y); else tmp = x - ((z / t) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.3e-57], N[Not[LessEqual[y, 5.5e+67]], $MachinePrecision]], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(z / t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-57} \lor \neg \left(y \leq 5.5 \cdot 10^{+67}\right):\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t} \cdot x\\
\end{array}
\end{array}
if y < -3.2999999999999998e-57 or 5.49999999999999968e67 < y Initial program 89.1%
associate-*l/84.6%
Simplified84.6%
Taylor expanded in y around inf 85.3%
associate-*r/89.6%
Simplified89.6%
if -3.2999999999999998e-57 < y < 5.49999999999999968e67Initial program 94.0%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in x around inf 88.2%
distribute-lft-in88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
unsub-neg88.2%
*-rgt-identity88.2%
Simplified88.2%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e-20) (not (<= z 1.08e-54))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-20) || !(z <= 1.08e-54)) {
tmp = z * (y / 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 ((z <= (-5.5d-20)) .or. (.not. (z <= 1.08d-54))) then
tmp = z * (y / 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 ((z <= -5.5e-20) || !(z <= 1.08e-54)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e-20) or not (z <= 1.08e-54): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e-20) || !(z <= 1.08e-54)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e-20) || ~((z <= 1.08e-54))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e-20], N[Not[LessEqual[z, 1.08e-54]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-20} \lor \neg \left(z \leq 1.08 \cdot 10^{-54}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.4999999999999996e-20 or 1.08000000000000002e-54 < z Initial program 85.2%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 81.1%
Taylor expanded in y around inf 52.6%
if -5.4999999999999996e-20 < z < 1.08000000000000002e-54Initial program 98.4%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in t around inf 62.2%
Final simplification57.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.6e-23) (not (<= z 1.02e-51))) (* (/ z t) y) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e-23) || !(z <= 1.02e-51)) {
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 ((z <= (-2.6d-23)) .or. (.not. (z <= 1.02d-51))) 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 ((z <= -2.6e-23) || !(z <= 1.02e-51)) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.6e-23) or not (z <= 1.02e-51): tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.6e-23) || !(z <= 1.02e-51)) tmp = Float64(Float64(z / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.6e-23) || ~((z <= 1.02e-51))) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.6e-23], N[Not[LessEqual[z, 1.02e-51]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-23} \lor \neg \left(z \leq 1.02 \cdot 10^{-51}\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.6e-23 or 1.01999999999999998e-51 < z Initial program 85.2%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 81.1%
Taylor expanded in y around inf 52.6%
clear-num52.5%
un-div-inv52.6%
Applied egg-rr52.6%
associate-/r/53.4%
Applied egg-rr53.4%
if -2.6e-23 < z < 1.01999999999999998e-51Initial program 98.4%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in t around inf 62.2%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
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) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 91.5%
associate-/l*97.3%
Simplified97.3%
Final simplification97.3%
(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 91.5%
associate-*l/90.7%
Simplified90.7%
Taylor expanded in t around inf 39.4%
Final simplification39.4%
(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 2023290
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(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)))