
(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 (let* ((t_1 (+ x (/ (* (- y x) z) t)))) (if (<= t_1 1e+289) t_1 (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if (t_1 <= 1e+289) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) * z) / t)
if (t_1 <= 1d+289) then
tmp = t_1
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 t_1 = x + (((y - x) * z) / t);
double tmp;
if (t_1 <= 1e+289) {
tmp = t_1;
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((y - x) * z) / t) tmp = 0 if t_1 <= 1e+289: tmp = t_1 else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) tmp = 0.0 if (t_1 <= 1e+289) tmp = t_1; else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((y - x) * z) / t); tmp = 0.0; if (t_1 <= 1e+289) tmp = t_1; else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+289], t$95$1, N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_1 \leq 10^{+289}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.0000000000000001e289Initial program 97.0%
if 1.0000000000000001e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 83.5%
associate-*l/99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (fma (- y x) (/ z t) x))
double code(double x, double y, double z, double t) {
return fma((y - x), (z / t), x);
}
function code(x, y, z, t) return fma(Float64(y - x), Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)
\end{array}
Initial program 94.6%
+-commutative94.6%
remove-double-neg94.6%
unsub-neg94.6%
associate-*r/97.1%
fma-neg97.1%
remove-double-neg97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5e-75) (not (<= x 1050.0))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e-75) || !(x <= 1050.0)) {
tmp = x * (1.0 - (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 <= (-2.5d-75)) .or. (.not. (x <= 1050.0d0))) then
tmp = x * (1.0d0 - (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 <= -2.5e-75) || !(x <= 1050.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5e-75) or not (x <= 1050.0): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5e-75) || !(x <= 1050.0)) tmp = Float64(x * Float64(1.0 - 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 <= -2.5e-75) || ~((x <= 1050.0))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5e-75], N[Not[LessEqual[x, 1050.0]], $MachinePrecision]], N[(x * N[(1.0 - 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 -2.5 \cdot 10^{-75} \lor \neg \left(x \leq 1050\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.49999999999999989e-75 or 1050 < x Initial program 96.6%
+-commutative96.6%
remove-double-neg96.6%
unsub-neg96.6%
associate-*r/99.9%
fma-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 85.7%
mul-1-neg85.7%
associate-*r/88.4%
*-rgt-identity88.4%
distribute-rgt-neg-in88.4%
mul-1-neg88.4%
distribute-lft-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -2.49999999999999989e-75 < x < 1050Initial program 91.9%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in y around inf 84.6%
associate-*r/87.7%
Simplified87.7%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-75) (not (<= x 620.0))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-75) || !(x <= 620.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (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 <= (-3.2d-75)) .or. (.not. (x <= 620.0d0))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (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 <= -3.2e-75) || !(x <= 620.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-75) or not (x <= 620.0): tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-75) || !(x <= 620.0)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.2e-75) || ~((x <= 620.0))) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-75], N[Not[LessEqual[x, 620.0]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-75} \lor \neg \left(x \leq 620\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -3.19999999999999977e-75 or 620 < x Initial program 96.6%
+-commutative96.6%
remove-double-neg96.6%
unsub-neg96.6%
associate-*r/99.9%
fma-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 85.7%
mul-1-neg85.7%
associate-*r/88.4%
*-rgt-identity88.4%
distribute-rgt-neg-in88.4%
mul-1-neg88.4%
distribute-lft-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -3.19999999999999977e-75 < x < 620Initial program 91.9%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in y around inf 86.5%
associate-*l/84.6%
associate-/l*87.7%
Applied egg-rr87.7%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (<= x 5.8e+183) (+ x (* z (/ (- y x) t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 5.8e+183) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x * (1.0 - (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 <= 5.8d+183) then
tmp = x + (z * ((y - x) / t))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 5.8e+183) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 5.8e+183: tmp = x + (z * ((y - x) / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 5.8e+183) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 5.8e+183) tmp = x + (z * ((y - x) / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 5.8e+183], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+183}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < 5.8000000000000001e183Initial program 94.1%
associate-*l/93.0%
Simplified93.0%
if 5.8000000000000001e183 < x Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
unsub-neg100.0%
associate-*r/100.0%
fma-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
distribute-lft-in100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= x 1.15e+185) (+ x (/ z (/ t (- y x)))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.15e+185) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = x * (1.0 - (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.15d+185) then
tmp = x + (z / (t / (y - x)))
else
tmp = x * (1.0d0 - (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.15e+185) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.15e+185: tmp = x + (z / (t / (y - x))) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.15e+185) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.15e+185) tmp = x + (z / (t / (y - x))); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.15e+185], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{+185}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < 1.1500000000000001e185Initial program 94.1%
associate-*l/93.0%
Simplified93.0%
*-commutative93.0%
clear-num93.0%
un-div-inv93.8%
Applied egg-rr93.8%
if 1.1500000000000001e185 < x Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
unsub-neg100.0%
associate-*r/100.0%
fma-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
distribute-lft-in100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.2e+60) (not (<= z 3.2e+18))) (* (/ x t) (- z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.2e+60) || !(z <= 3.2e+18)) {
tmp = (x / t) * -z;
} 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 <= (-8.2d+60)) .or. (.not. (z <= 3.2d+18))) then
tmp = (x / t) * -z
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 <= -8.2e+60) || !(z <= 3.2e+18)) {
tmp = (x / t) * -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.2e+60) or not (z <= 3.2e+18): tmp = (x / t) * -z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.2e+60) || !(z <= 3.2e+18)) tmp = Float64(Float64(x / t) * Float64(-z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.2e+60) || ~((z <= 3.2e+18))) tmp = (x / t) * -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.2e+60], N[Not[LessEqual[z, 3.2e+18]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+60} \lor \neg \left(z \leq 3.2 \cdot 10^{+18}\right):\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.2e60 or 3.2e18 < z Initial program 90.2%
associate-*l/99.0%
Simplified99.0%
*-commutative99.0%
clear-num99.0%
un-div-inv99.0%
Applied egg-rr99.0%
Taylor expanded in y around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
associate-/r/65.4%
associate-*l/62.8%
remove-double-neg62.8%
distribute-rgt-neg-out62.8%
div-inv62.7%
add-sqr-sqrt35.9%
sqrt-unprod41.1%
sqr-neg41.1%
sqrt-unprod6.2%
add-sqr-sqrt12.4%
cancel-sign-sub-inv12.4%
div-inv12.4%
frac-2neg12.4%
distribute-rgt-neg-out12.4%
remove-double-neg12.4%
associate-*l/16.4%
associate-/r/13.7%
div-inv13.7%
clear-num13.7%
add-sqr-sqrt6.6%
Applied egg-rr65.5%
Taylor expanded in z around inf 54.1%
mul-1-neg54.1%
associate-*l/55.0%
distribute-rgt-neg-in55.0%
Simplified55.0%
if -8.2e60 < z < 3.2e18Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/98.2%
fma-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in z around 0 57.8%
Final simplification56.6%
(FPCore (x y z t) :precision binary64 (if (<= z -2.3e+60) (/ x (/ (- t) z)) (if (<= z 3.8e+18) x (* (/ x t) (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+60) {
tmp = x / (-t / z);
} else if (z <= 3.8e+18) {
tmp = x;
} else {
tmp = (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 (z <= (-2.3d+60)) then
tmp = x / (-t / z)
else if (z <= 3.8d+18) then
tmp = x
else
tmp = (x / t) * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+60) {
tmp = x / (-t / z);
} else if (z <= 3.8e+18) {
tmp = x;
} else {
tmp = (x / t) * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.3e+60: tmp = x / (-t / z) elif z <= 3.8e+18: tmp = x else: tmp = (x / t) * -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.3e+60) tmp = Float64(x / Float64(Float64(-t) / z)); elseif (z <= 3.8e+18) tmp = x; else tmp = Float64(Float64(x / t) * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.3e+60) tmp = x / (-t / z); elseif (z <= 3.8e+18) tmp = x; else tmp = (x / t) * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.3e+60], N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+18], x, N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+60}:\\
\;\;\;\;\frac{x}{\frac{-t}{z}}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -2.30000000000000017e60Initial program 89.6%
associate-*l/97.8%
Simplified97.8%
*-commutative97.8%
clear-num97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Taylor expanded in y around 0 72.3%
associate-*r/72.3%
neg-mul-172.3%
Simplified72.3%
associate-/r/72.5%
associate-*l/70.2%
remove-double-neg70.2%
distribute-rgt-neg-out70.2%
div-inv70.2%
add-sqr-sqrt45.8%
sqrt-unprod48.5%
sqr-neg48.5%
sqrt-unprod4.6%
add-sqr-sqrt5.6%
cancel-sign-sub-inv5.6%
div-inv5.6%
frac-2neg5.6%
distribute-rgt-neg-out5.6%
remove-double-neg5.6%
associate-*l/8.5%
associate-/r/6.5%
div-inv6.5%
clear-num6.5%
add-sqr-sqrt1.9%
Applied egg-rr72.3%
Taylor expanded in z around inf 66.6%
associate-*l/66.5%
*-commutative66.5%
metadata-eval66.5%
distribute-lft-neg-in66.5%
metadata-eval66.5%
associate-*r/66.6%
times-frac66.6%
neg-mul-166.6%
neg-mul-166.6%
distribute-frac-neg66.6%
remove-double-neg66.6%
*-commutative66.6%
associate-/l*66.6%
Simplified66.6%
if -2.30000000000000017e60 < z < 3.8e18Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/98.2%
fma-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in z around 0 57.8%
if 3.8e18 < z Initial program 90.6%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 60.3%
associate-*r/60.3%
neg-mul-160.3%
Simplified60.3%
associate-/r/60.1%
associate-*l/57.2%
remove-double-neg57.2%
distribute-rgt-neg-out57.2%
div-inv57.1%
add-sqr-sqrt28.3%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod7.4%
add-sqr-sqrt17.6%
cancel-sign-sub-inv17.6%
div-inv17.6%
frac-2neg17.6%
distribute-rgt-neg-out17.6%
remove-double-neg17.6%
associate-*l/22.3%
associate-/r/19.1%
div-inv19.1%
clear-num19.1%
add-sqr-sqrt10.2%
Applied egg-rr60.3%
Taylor expanded in z around inf 44.7%
mul-1-neg44.7%
associate-*l/46.2%
distribute-rgt-neg-in46.2%
Simplified46.2%
Final simplification56.6%
(FPCore (x y z t) :precision binary64 (if (<= z -4.9e+64) (/ x (/ (- t) z)) (if (<= z 1.45e+18) x (/ z (/ t (- x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.9e+64) {
tmp = x / (-t / z);
} else if (z <= 1.45e+18) {
tmp = x;
} else {
tmp = 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 (z <= (-4.9d+64)) then
tmp = x / (-t / z)
else if (z <= 1.45d+18) then
tmp = x
else
tmp = z / (t / -x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.9e+64) {
tmp = x / (-t / z);
} else if (z <= 1.45e+18) {
tmp = x;
} else {
tmp = z / (t / -x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.9e+64: tmp = x / (-t / z) elif z <= 1.45e+18: tmp = x else: tmp = z / (t / -x) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.9e+64) tmp = Float64(x / Float64(Float64(-t) / z)); elseif (z <= 1.45e+18) tmp = x; else tmp = Float64(z / Float64(t / Float64(-x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.9e+64) tmp = x / (-t / z); elseif (z <= 1.45e+18) tmp = x; else tmp = z / (t / -x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.9e+64], N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+18], x, N[(z / N[(t / (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{\frac{-t}{z}}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{-x}}\\
\end{array}
\end{array}
if z < -4.9000000000000003e64Initial program 89.6%
associate-*l/97.8%
Simplified97.8%
*-commutative97.8%
clear-num97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Taylor expanded in y around 0 72.3%
associate-*r/72.3%
neg-mul-172.3%
Simplified72.3%
associate-/r/72.5%
associate-*l/70.2%
remove-double-neg70.2%
distribute-rgt-neg-out70.2%
div-inv70.2%
add-sqr-sqrt45.8%
sqrt-unprod48.5%
sqr-neg48.5%
sqrt-unprod4.6%
add-sqr-sqrt5.6%
cancel-sign-sub-inv5.6%
div-inv5.6%
frac-2neg5.6%
distribute-rgt-neg-out5.6%
remove-double-neg5.6%
associate-*l/8.5%
associate-/r/6.5%
div-inv6.5%
clear-num6.5%
add-sqr-sqrt1.9%
Applied egg-rr72.3%
Taylor expanded in z around inf 66.6%
associate-*l/66.5%
*-commutative66.5%
metadata-eval66.5%
distribute-lft-neg-in66.5%
metadata-eval66.5%
associate-*r/66.6%
times-frac66.6%
neg-mul-166.6%
neg-mul-166.6%
distribute-frac-neg66.6%
remove-double-neg66.6%
*-commutative66.6%
associate-/l*66.6%
Simplified66.6%
if -4.9000000000000003e64 < z < 1.45e18Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/98.2%
fma-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in z around 0 57.8%
if 1.45e18 < z Initial program 90.6%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 60.3%
associate-*r/60.3%
neg-mul-160.3%
Simplified60.3%
associate-/r/60.1%
associate-*l/57.2%
remove-double-neg57.2%
distribute-rgt-neg-out57.2%
div-inv57.1%
add-sqr-sqrt28.3%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod7.4%
add-sqr-sqrt17.6%
cancel-sign-sub-inv17.6%
div-inv17.6%
frac-2neg17.6%
distribute-rgt-neg-out17.6%
remove-double-neg17.6%
associate-*l/22.3%
associate-/r/19.1%
div-inv19.1%
clear-num19.1%
add-sqr-sqrt10.2%
Applied egg-rr60.3%
Taylor expanded in z around inf 44.7%
associate-*r/44.7%
*-commutative44.7%
neg-mul-144.7%
distribute-rgt-neg-in44.7%
associate-/l*46.2%
Simplified46.2%
Final simplification56.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 94.6%
associate-/l*97.1%
Simplified97.1%
Final simplification97.1%
(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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 94.6%
+-commutative94.6%
remove-double-neg94.6%
unsub-neg94.6%
associate-*r/97.1%
fma-neg97.1%
remove-double-neg97.1%
Simplified97.1%
fma-udef97.1%
Applied egg-rr97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 94.6%
+-commutative94.6%
remove-double-neg94.6%
unsub-neg94.6%
associate-*r/97.1%
fma-neg97.1%
remove-double-neg97.1%
Simplified97.1%
Taylor expanded in y around 0 66.0%
mul-1-neg66.0%
associate-*r/67.5%
*-rgt-identity67.5%
distribute-rgt-neg-in67.5%
mul-1-neg67.5%
distribute-lft-in67.5%
mul-1-neg67.5%
unsub-neg67.5%
Simplified67.5%
Final simplification67.5%
(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 94.6%
+-commutative94.6%
remove-double-neg94.6%
unsub-neg94.6%
associate-*r/97.1%
fma-neg97.1%
remove-double-neg97.1%
Simplified97.1%
Taylor expanded in z around 0 38.6%
Final simplification38.6%
(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 2024024
(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)))