
(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 (/ (* z (- y x)) t))))
(if (<= t_1 (- INFINITY))
(+ x (* z (/ (- y x) t)))
(if (<= t_1 5e+284) t_1 (+ x (/ (- y x) (/ t z)))))))
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)) {
tmp = x + (z * ((y - x) / t));
} else if (t_1 <= 5e+284) {
tmp = t_1;
} else {
tmp = x + ((y - x) / (t / z));
}
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) {
tmp = x + (z * ((y - x) / t));
} else if (t_1 <= 5e+284) {
tmp = t_1;
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z * (y - x)) / t) tmp = 0 if t_1 <= -math.inf: tmp = x + (z * ((y - x) / t)) elif t_1 <= 5e+284: tmp = t_1 else: tmp = x + ((y - x) / (t / z)) 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)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); elseif (t_1 <= 5e+284) tmp = t_1; else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); 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) tmp = x + (z * ((y - x) / t)); elseif (t_1 <= 5e+284) tmp = t_1; else tmp = x + ((y - x) / (t / z)); 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[LessEqual[t$95$1, (-Infinity)], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+284], t$95$1, N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0Initial program 73.6%
associate-*l/100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4.9999999999999999e284Initial program 99.2%
if 4.9999999999999999e284 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 89.7%
associate-/l*100.0%
Simplified100.0%
Final simplification99.4%
(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 93.6%
+-commutative93.6%
*-commutative93.6%
associate-*l/96.5%
fma-def96.5%
Simplified96.5%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* z (- y x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+295)))
(+ 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 <= 1e+295)) {
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 <= 1e+295)) {
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 <= 1e+295): 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 <= 1e+295)) 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 <= 1e+295))) 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, 1e+295]], $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 10^{+295}\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 9.9999999999999998e294 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 81.0%
associate-*l/99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 9.9999999999999998e294Initial program 99.2%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -126000000000.0)
(/ (* z y) t)
(if (<= y 1.8e-217)
(* (/ x t) (- z))
(if (<= y 2.16e-100)
x
(if (<= y 2.6e+95)
(* z (/ y t))
(if (<= y 1.26e+162) x (* (/ z t) y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -126000000000.0) {
tmp = (z * y) / t;
} else if (y <= 1.8e-217) {
tmp = (x / t) * -z;
} else if (y <= 2.16e-100) {
tmp = x;
} else if (y <= 2.6e+95) {
tmp = z * (y / t);
} else if (y <= 1.26e+162) {
tmp = x;
} else {
tmp = (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 (y <= (-126000000000.0d0)) then
tmp = (z * y) / t
else if (y <= 1.8d-217) then
tmp = (x / t) * -z
else if (y <= 2.16d-100) then
tmp = x
else if (y <= 2.6d+95) then
tmp = z * (y / t)
else if (y <= 1.26d+162) then
tmp = x
else
tmp = (z / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -126000000000.0) {
tmp = (z * y) / t;
} else if (y <= 1.8e-217) {
tmp = (x / t) * -z;
} else if (y <= 2.16e-100) {
tmp = x;
} else if (y <= 2.6e+95) {
tmp = z * (y / t);
} else if (y <= 1.26e+162) {
tmp = x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -126000000000.0: tmp = (z * y) / t elif y <= 1.8e-217: tmp = (x / t) * -z elif y <= 2.16e-100: tmp = x elif y <= 2.6e+95: tmp = z * (y / t) elif y <= 1.26e+162: tmp = x else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -126000000000.0) tmp = Float64(Float64(z * y) / t); elseif (y <= 1.8e-217) tmp = Float64(Float64(x / t) * Float64(-z)); elseif (y <= 2.16e-100) tmp = x; elseif (y <= 2.6e+95) tmp = Float64(z * Float64(y / t)); elseif (y <= 1.26e+162) tmp = x; else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -126000000000.0) tmp = (z * y) / t; elseif (y <= 1.8e-217) tmp = (x / t) * -z; elseif (y <= 2.16e-100) tmp = x; elseif (y <= 2.6e+95) tmp = z * (y / t); elseif (y <= 1.26e+162) tmp = x; else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -126000000000.0], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 1.8e-217], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[y, 2.16e-100], x, If[LessEqual[y, 2.6e+95], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+162], x, N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -126000000000:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-217}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\mathbf{elif}\;y \leq 2.16 \cdot 10^{-100}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+95}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+162}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if y < -1.26e11Initial program 93.1%
Taylor expanded in t around 0 76.6%
Taylor expanded in y around inf 66.9%
*-commutative66.9%
Simplified66.9%
if -1.26e11 < y < 1.79999999999999991e-217Initial program 91.9%
Taylor expanded in t around 0 68.7%
Taylor expanded in y around 0 57.2%
mul-1-neg57.2%
distribute-rgt-neg-out57.2%
Simplified57.2%
Taylor expanded in z around 0 57.2%
mul-1-neg57.2%
associate-*r/61.2%
distribute-rgt-neg-in61.2%
Simplified61.2%
if 1.79999999999999991e-217 < y < 2.1600000000000001e-100 or 2.5999999999999999e95 < y < 1.26e162Initial program 97.0%
Taylor expanded in z around 0 62.6%
if 2.1600000000000001e-100 < y < 2.5999999999999999e95Initial program 99.8%
Taylor expanded in t around 0 63.0%
Taylor expanded in y around inf 49.8%
associate-*l/49.9%
*-commutative49.9%
Simplified49.9%
if 1.26e162 < y Initial program 86.9%
Taylor expanded in t around 0 65.7%
Taylor expanded in y around inf 63.2%
associate-*r/70.4%
Simplified70.4%
Final simplification62.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.12e-79) (not (<= z 2.2e-174))) (* z (/ (- y x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.12e-79) || !(z <= 2.2e-174)) {
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 <= (-1.12d-79)) .or. (.not. (z <= 2.2d-174))) 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 <= -1.12e-79) || !(z <= 2.2e-174)) {
tmp = z * ((y - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.12e-79) or not (z <= 2.2e-174): tmp = z * ((y - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.12e-79) || !(z <= 2.2e-174)) 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 <= -1.12e-79) || ~((z <= 2.2e-174))) tmp = z * ((y - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.12e-79], N[Not[LessEqual[z, 2.2e-174]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{-79} \lor \neg \left(z \leq 2.2 \cdot 10^{-174}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.11999999999999996e-79 or 2.20000000000000022e-174 < z Initial program 91.3%
Taylor expanded in t around 0 78.1%
associate-*l/95.8%
Applied egg-rr80.0%
if -1.11999999999999996e-79 < z < 2.20000000000000022e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4100000000000.0) (not (<= z 13.0))) (* z (/ (- y x) t)) (+ x (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4100000000000.0) || !(z <= 13.0)) {
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 <= (-4100000000000.0d0)) .or. (.not. (z <= 13.0d0))) 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 <= -4100000000000.0) || !(z <= 13.0)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + ((z / t) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4100000000000.0) or not (z <= 13.0): tmp = z * ((y - x) / t) else: tmp = x + ((z / t) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4100000000000.0) || !(z <= 13.0)) 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 <= -4100000000000.0) || ~((z <= 13.0))) 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, -4100000000000.0], N[Not[LessEqual[z, 13.0]], $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 -4100000000000 \lor \neg \left(z \leq 13\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\end{array}
\end{array}
if z < -4.1e12 or 13 < z Initial program 87.8%
Taylor expanded in t around 0 80.7%
associate-*l/98.4%
Applied egg-rr88.3%
if -4.1e12 < z < 13Initial program 98.4%
Taylor expanded in y around inf 84.2%
associate-*r/34.0%
Simplified83.7%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (<= x 2.2e+189) (+ x (* z (/ (- y x) t))) (- x (* (/ z t) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.2e+189) {
tmp = x + (z * ((y - x) / t));
} 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 (x <= 2.2d+189) then
tmp = x + (z * ((y - x) / t))
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 (x <= 2.2e+189) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x - ((z / t) * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 2.2e+189: tmp = x + (z * ((y - x) / t)) else: tmp = x - ((z / t) * x) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 2.2e+189) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); 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 (x <= 2.2e+189) tmp = x + (z * ((y - x) / t)); else tmp = x - ((z / t) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 2.2e+189], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(z / t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2 \cdot 10^{+189}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t} \cdot x\\
\end{array}
\end{array}
if x < 2.20000000000000005e189Initial program 93.2%
associate-*l/92.9%
Applied egg-rr92.9%
if 2.20000000000000005e189 < x Initial program 96.4%
Taylor expanded in x around inf 99.9%
*-commutative99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
mul-1-neg99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
Simplified99.9%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.8e-78) (not (<= z 3.6e-174))) (* (/ z t) y) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e-78) || !(z <= 3.6e-174)) {
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 <= (-6.8d-78)) .or. (.not. (z <= 3.6d-174))) 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 <= -6.8e-78) || !(z <= 3.6e-174)) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.8e-78) or not (z <= 3.6e-174): tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.8e-78) || !(z <= 3.6e-174)) 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 <= -6.8e-78) || ~((z <= 3.6e-174))) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.8e-78], N[Not[LessEqual[z, 3.6e-174]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-78} \lor \neg \left(z \leq 3.6 \cdot 10^{-174}\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.80000000000000023e-78 or 3.59999999999999999e-174 < z Initial program 91.3%
Taylor expanded in t around 0 78.1%
Taylor expanded in y around inf 47.8%
associate-*r/49.0%
Simplified49.0%
if -6.80000000000000023e-78 < z < 3.59999999999999999e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
Final simplification55.0%
(FPCore (x y z t) :precision binary64 (if (<= z -4.2e-80) (* z (/ y t)) (if (<= z 5.2e-174) x (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e-80) {
tmp = z * (y / t);
} else if (z <= 5.2e-174) {
tmp = x;
} else {
tmp = (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 <= (-4.2d-80)) then
tmp = z * (y / t)
else if (z <= 5.2d-174) then
tmp = x
else
tmp = (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 <= -4.2e-80) {
tmp = z * (y / t);
} else if (z <= 5.2e-174) {
tmp = x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e-80: tmp = z * (y / t) elif z <= 5.2e-174: tmp = x else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e-80) tmp = Float64(z * Float64(y / t)); elseif (z <= 5.2e-174) tmp = x; else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e-80) tmp = z * (y / t); elseif (z <= 5.2e-174) tmp = x; else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e-80], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-174], x, N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-80}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-174}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if z < -4.20000000000000003e-80Initial program 92.4%
Taylor expanded in t around 0 80.6%
Taylor expanded in y around inf 43.6%
associate-*l/42.4%
*-commutative42.4%
Simplified42.4%
if -4.20000000000000003e-80 < z < 5.2000000000000004e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
if 5.2000000000000004e-174 < z Initial program 90.5%
Taylor expanded in t around 0 76.1%
Taylor expanded in y around inf 51.0%
associate-*r/54.2%
Simplified54.2%
Final simplification55.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.3e-80) (* z (/ y t)) (if (<= z 3.6e-174) x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.3e-80) {
tmp = z * (y / t);
} else if (z <= 3.6e-174) {
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 (z <= (-1.3d-80)) then
tmp = z * (y / t)
else if (z <= 3.6d-174) 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 (z <= -1.3e-80) {
tmp = z * (y / t);
} else if (z <= 3.6e-174) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.3e-80: tmp = z * (y / t) elif z <= 3.6e-174: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.3e-80) tmp = Float64(z * Float64(y / t)); elseif (z <= 3.6e-174) 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 (z <= -1.3e-80) tmp = z * (y / t); elseif (z <= 3.6e-174) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.3e-80], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-174], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-174}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -1.3e-80Initial program 92.4%
Taylor expanded in t around 0 80.6%
Taylor expanded in y around inf 43.6%
associate-*l/42.4%
*-commutative42.4%
Simplified42.4%
if -1.3e-80 < z < 3.59999999999999999e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
if 3.59999999999999999e-174 < z Initial program 90.5%
Taylor expanded in t around 0 76.1%
Taylor expanded in y around inf 51.0%
associate-*r/54.2%
Simplified54.2%
clear-num54.2%
un-div-inv54.3%
Applied egg-rr54.3%
Final simplification55.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.08e-82) (* z (/ y t)) (if (<= z 5.9e-174) x (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.08e-82) {
tmp = z * (y / t);
} else if (z <= 5.9e-174) {
tmp = x;
} else {
tmp = 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 <= (-1.08d-82)) then
tmp = z * (y / t)
else if (z <= 5.9d-174) then
tmp = x
else
tmp = 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 <= -1.08e-82) {
tmp = z * (y / t);
} else if (z <= 5.9e-174) {
tmp = x;
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.08e-82: tmp = z * (y / t) elif z <= 5.9e-174: tmp = x else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.08e-82) tmp = Float64(z * Float64(y / t)); elseif (z <= 5.9e-174) tmp = x; else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.08e-82) tmp = z * (y / t); elseif (z <= 5.9e-174) tmp = x; else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.08e-82], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.9e-174], x, N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{-82}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -1.07999999999999996e-82Initial program 92.4%
Taylor expanded in t around 0 80.6%
Taylor expanded in y around inf 43.6%
associate-*l/42.4%
*-commutative42.4%
Simplified42.4%
if -1.07999999999999996e-82 < z < 5.9000000000000003e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
if 5.9000000000000003e-174 < z Initial program 90.5%
Taylor expanded in t around 0 76.1%
Taylor expanded in y around inf 51.0%
associate-*r/54.2%
Simplified54.2%
*-commutative54.2%
associate-*l/51.0%
associate-/l*54.5%
Applied egg-rr54.5%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (<= z -3.8e-83) (/ (* z y) t) (if (<= z 5.9e-174) x (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e-83) {
tmp = (z * y) / t;
} else if (z <= 5.9e-174) {
tmp = x;
} else {
tmp = 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 <= (-3.8d-83)) then
tmp = (z * y) / t
else if (z <= 5.9d-174) then
tmp = x
else
tmp = 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 <= -3.8e-83) {
tmp = (z * y) / t;
} else if (z <= 5.9e-174) {
tmp = x;
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.8e-83: tmp = (z * y) / t elif z <= 5.9e-174: tmp = x else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e-83) tmp = Float64(Float64(z * y) / t); elseif (z <= 5.9e-174) tmp = x; else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.8e-83) tmp = (z * y) / t; elseif (z <= 5.9e-174) tmp = x; else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e-83], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 5.9e-174], x, N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-83}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -3.79999999999999977e-83Initial program 92.4%
Taylor expanded in t around 0 80.6%
Taylor expanded in y around inf 43.6%
*-commutative43.6%
Simplified43.6%
if -3.79999999999999977e-83 < z < 5.9000000000000003e-174Initial program 98.6%
Taylor expanded in z around 0 68.4%
if 5.9000000000000003e-174 < z Initial program 90.5%
Taylor expanded in t around 0 76.1%
Taylor expanded in y around inf 51.0%
associate-*r/54.2%
Simplified54.2%
*-commutative54.2%
associate-*l/51.0%
associate-/l*54.5%
Applied egg-rr54.5%
Final simplification55.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 93.6%
Taylor expanded in z around 0 33.4%
Final simplification33.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 2023224
(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)))