
(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 10 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 (- INFINITY))
(+ x (/ z (/ t (- y x))))
(if (<= t_1 2e+284) t_1 (+ x (* z (/ (- y x) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (z / (t / (y - x)));
} else if (t_1 <= 2e+284) {
tmp = t_1;
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = x + (z / (t / (y - x)));
} else if (t_1 <= 2e+284) {
tmp = t_1;
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((y - x) * z) / t) tmp = 0 if t_1 <= -math.inf: tmp = x + (z / (t / (y - x))) elif t_1 <= 2e+284: tmp = t_1 else: tmp = x + (z * ((y - x) / t)) 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 <= Float64(-Inf)) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); elseif (t_1 <= 2e+284) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); 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 <= -Inf) tmp = x + (z / (t / (y - x))); elseif (t_1 <= 2e+284) tmp = t_1; else tmp = x + (z * ((y - x) / t)); 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, (-Infinity)], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+284], t$95$1, N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $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 -\infty:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+284}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0Initial program 78.6%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.00000000000000016e284Initial program 99.3%
if 2.00000000000000016e284 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 79.1%
associate-*l/99.9%
Simplified99.9%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -3.5e-90)
(not (or (<= z 2.2e-220) (and (not (<= z 2.1e-204)) (<= z 2.1e-17)))))
(* (- y x) (/ z t))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-90) || !((z <= 2.2e-220) || (!(z <= 2.1e-204) && (z <= 2.1e-17)))) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.5d-90)) .or. (.not. (z <= 2.2d-220) .or. (.not. (z <= 2.1d-204)) .and. (z <= 2.1d-17))) then
tmp = (y - x) * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-90) || !((z <= 2.2e-220) || (!(z <= 2.1e-204) && (z <= 2.1e-17)))) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e-90) or not ((z <= 2.2e-220) or (not (z <= 2.1e-204) and (z <= 2.1e-17))): tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e-90) || !((z <= 2.2e-220) || (!(z <= 2.1e-204) && (z <= 2.1e-17)))) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.5e-90) || ~(((z <= 2.2e-220) || (~((z <= 2.1e-204)) && (z <= 2.1e-17))))) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e-90], N[Not[Or[LessEqual[z, 2.2e-220], And[N[Not[LessEqual[z, 2.1e-204]], $MachinePrecision], LessEqual[z, 2.1e-17]]]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-90} \lor \neg \left(z \leq 2.2 \cdot 10^{-220} \lor \neg \left(z \leq 2.1 \cdot 10^{-204}\right) \land z \leq 2.1 \cdot 10^{-17}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.4999999999999999e-90 or 2.19999999999999987e-220 < z < 2.10000000000000009e-204 or 2.09999999999999992e-17 < z Initial program 87.5%
associate-*l/95.1%
Simplified95.1%
Taylor expanded in x around 0 77.3%
Taylor expanded in z around inf 61.2%
associate-*r/61.2%
neg-mul-161.2%
Simplified61.2%
Taylor expanded in x around 0 62.4%
associate-*l/64.6%
associate-*r*64.6%
neg-mul-164.6%
associate-*l/67.0%
distribute-rgt-in74.8%
+-commutative74.8%
unsub-neg74.8%
distribute-lft-out--67.0%
associate-*r/64.6%
associate-*l/68.2%
associate-*r/65.4%
associate-*l/66.1%
distribute-lft-out--81.3%
Simplified81.3%
if -3.4999999999999999e-90 < z < 2.19999999999999987e-220 or 2.10000000000000009e-204 < z < 2.09999999999999992e-17Initial program 99.0%
associate-*l/87.2%
Simplified87.2%
Taylor expanded in t around inf 70.3%
Final simplification76.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))))
(if (<= z -3.5e+62)
t_1
(if (<= z 1.55e-32)
(+ x (/ (* y z) t))
(if (<= z 1.22e+76)
(- x (* x (/ z t)))
(if (<= z 3.25e+153) (+ x (* y (/ z t))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double tmp;
if (z <= -3.5e+62) {
tmp = t_1;
} else if (z <= 1.55e-32) {
tmp = x + ((y * z) / t);
} else if (z <= 1.22e+76) {
tmp = x - (x * (z / t));
} else if (z <= 3.25e+153) {
tmp = x + (y * (z / t));
} else {
tmp = t_1;
}
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 = (y - x) * (z / t)
if (z <= (-3.5d+62)) then
tmp = t_1
else if (z <= 1.55d-32) then
tmp = x + ((y * z) / t)
else if (z <= 1.22d+76) then
tmp = x - (x * (z / t))
else if (z <= 3.25d+153) then
tmp = x + (y * (z / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double tmp;
if (z <= -3.5e+62) {
tmp = t_1;
} else if (z <= 1.55e-32) {
tmp = x + ((y * z) / t);
} else if (z <= 1.22e+76) {
tmp = x - (x * (z / t));
} else if (z <= 3.25e+153) {
tmp = x + (y * (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) tmp = 0 if z <= -3.5e+62: tmp = t_1 elif z <= 1.55e-32: tmp = x + ((y * z) / t) elif z <= 1.22e+76: tmp = x - (x * (z / t)) elif z <= 3.25e+153: tmp = x + (y * (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) tmp = 0.0 if (z <= -3.5e+62) tmp = t_1; elseif (z <= 1.55e-32) tmp = Float64(x + Float64(Float64(y * z) / t)); elseif (z <= 1.22e+76) tmp = Float64(x - Float64(x * Float64(z / t))); elseif (z <= 3.25e+153) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); tmp = 0.0; if (z <= -3.5e+62) tmp = t_1; elseif (z <= 1.55e-32) tmp = x + ((y * z) / t); elseif (z <= 1.22e+76) tmp = x - (x * (z / t)); elseif (z <= 3.25e+153) tmp = x + (y * (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+62], t$95$1, If[LessEqual[z, 1.55e-32], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.22e+76], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.25e+153], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-32}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+76}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{+153}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.49999999999999984e62 or 3.24999999999999986e153 < z Initial program 84.5%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in x around 0 66.5%
Taylor expanded in z around inf 58.8%
associate-*r/58.8%
neg-mul-158.8%
Simplified58.8%
Taylor expanded in x around 0 59.6%
associate-*l/63.3%
associate-*r*63.3%
neg-mul-163.3%
associate-*l/70.0%
distribute-rgt-in83.2%
+-commutative83.2%
unsub-neg83.2%
distribute-lft-out--70.0%
associate-*r/63.3%
associate-*l/69.3%
associate-*r/64.6%
associate-*l/66.8%
distribute-lft-out--90.1%
Simplified90.1%
if -3.49999999999999984e62 < z < 1.55000000000000005e-32Initial program 99.2%
Taylor expanded in y around inf 90.6%
*-commutative90.6%
Simplified90.6%
if 1.55000000000000005e-32 < z < 1.22000000000000002e76Initial program 99.9%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in x around inf 95.4%
distribute-lft-in95.4%
mul-1-neg95.4%
distribute-rgt-neg-in95.4%
unsub-neg95.4%
*-rgt-identity95.4%
Simplified95.4%
if 1.22000000000000002e76 < z < 3.24999999999999986e153Initial program 72.0%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in y around inf 71.4%
associate-*r/82.5%
Simplified82.5%
Final simplification90.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (/ z t)))) (t_2 (- x (* x (/ z t)))))
(if (<= x -7e+82)
t_2
(if (<= x -7e-36)
t_1
(if (<= x -3.8e-92)
(/ (* (- y x) z) t)
(if (<= x 1.25e+62) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double t_2 = x - (x * (z / t));
double tmp;
if (x <= -7e+82) {
tmp = t_2;
} else if (x <= -7e-36) {
tmp = t_1;
} else if (x <= -3.8e-92) {
tmp = ((y - x) * z) / t;
} else if (x <= 1.25e+62) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x + (y * (z / t))
t_2 = x - (x * (z / t))
if (x <= (-7d+82)) then
tmp = t_2
else if (x <= (-7d-36)) then
tmp = t_1
else if (x <= (-3.8d-92)) then
tmp = ((y - x) * z) / t
else if (x <= 1.25d+62) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double t_2 = x - (x * (z / t));
double tmp;
if (x <= -7e+82) {
tmp = t_2;
} else if (x <= -7e-36) {
tmp = t_1;
} else if (x <= -3.8e-92) {
tmp = ((y - x) * z) / t;
} else if (x <= 1.25e+62) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (z / t)) t_2 = x - (x * (z / t)) tmp = 0 if x <= -7e+82: tmp = t_2 elif x <= -7e-36: tmp = t_1 elif x <= -3.8e-92: tmp = ((y - x) * z) / t elif x <= 1.25e+62: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(z / t))) t_2 = Float64(x - Float64(x * Float64(z / t))) tmp = 0.0 if (x <= -7e+82) tmp = t_2; elseif (x <= -7e-36) tmp = t_1; elseif (x <= -3.8e-92) tmp = Float64(Float64(Float64(y - x) * z) / t); elseif (x <= 1.25e+62) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (z / t)); t_2 = x - (x * (z / t)); tmp = 0.0; if (x <= -7e+82) tmp = t_2; elseif (x <= -7e-36) tmp = t_1; elseif (x <= -3.8e-92) tmp = ((y - x) * z) / t; elseif (x <= 1.25e+62) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+82], t$95$2, If[LessEqual[x, -7e-36], t$95$1, If[LessEqual[x, -3.8e-92], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, 1.25e+62], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
t_2 := x - x \cdot \frac{z}{t}\\
\mathbf{if}\;x \leq -7 \cdot 10^{+82}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-92}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -7.0000000000000001e82 or 1.25000000000000007e62 < x Initial program 89.8%
associate-*l/92.6%
Simplified92.6%
Taylor expanded in x around inf 91.5%
distribute-lft-in91.5%
mul-1-neg91.5%
distribute-rgt-neg-in91.5%
unsub-neg91.5%
*-rgt-identity91.5%
Simplified91.5%
if -7.0000000000000001e82 < x < -6.9999999999999999e-36 or -3.8000000000000001e-92 < x < 1.25000000000000007e62Initial program 93.0%
associate-*l/91.9%
Simplified91.9%
Taylor expanded in y around inf 84.3%
associate-*r/88.9%
Simplified88.9%
if -6.9999999999999999e-36 < x < -3.8000000000000001e-92Initial program 99.9%
associate-*l/87.9%
Simplified87.9%
Taylor expanded in x around 0 94.0%
Taylor expanded in z around inf 88.0%
associate-*r/88.0%
neg-mul-188.0%
Simplified88.0%
Taylor expanded in t around 0 93.9%
mul-1-neg93.9%
distribute-lft-neg-out93.9%
+-commutative93.9%
distribute-rgt-out93.9%
Simplified93.9%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e-103) (not (<= z 3.7e-94))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-103) || !(z <= 3.7e-94)) {
tmp = x + (z * ((y - x) / 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 ((z <= (-1.45d-103)) .or. (.not. (z <= 3.7d-94))) then
tmp = x + (z * ((y - x) / 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 ((z <= -1.45e-103) || !(z <= 3.7e-94)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-103) or not (z <= 3.7e-94): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-103) || !(z <= 3.7e-94)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e-103) || ~((z <= 3.7e-94))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e-103], N[Not[LessEqual[z, 3.7e-94]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-103} \lor \neg \left(z \leq 3.7 \cdot 10^{-94}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.4499999999999999e-103 or 3.6999999999999998e-94 < z Initial program 88.6%
associate-*l/96.1%
Simplified96.1%
if -1.4499999999999999e-103 < z < 3.6999999999999998e-94Initial program 98.8%
Taylor expanded in y around inf 95.7%
*-commutative95.7%
Simplified95.7%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e-103) (+ x (/ z (/ t (- y x)))) (if (<= z 9e-95) (+ x (/ (* y z) t)) (+ x (* z (/ (- y x) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-103) {
tmp = x + (z / (t / (y - x)));
} else if (z <= 9e-95) {
tmp = x + ((y * z) / t);
} else {
tmp = x + (z * ((y - x) / 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.5d-103)) then
tmp = x + (z / (t / (y - x)))
else if (z <= 9d-95) then
tmp = x + ((y * z) / t)
else
tmp = x + (z * ((y - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-103) {
tmp = x + (z / (t / (y - x)));
} else if (z <= 9e-95) {
tmp = x + ((y * z) / t);
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e-103: tmp = x + (z / (t / (y - x))) elif z <= 9e-95: tmp = x + ((y * z) / t) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e-103) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); elseif (z <= 9e-95) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e-103) tmp = x + (z / (t / (y - x))); elseif (z <= 9e-95) tmp = x + ((y * z) / t); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e-103], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-95], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-103}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-95}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if z < -7.5e-103Initial program 93.4%
associate-*l/96.6%
Simplified96.6%
*-commutative96.6%
clear-num96.6%
un-div-inv96.6%
Applied egg-rr96.6%
if -7.5e-103 < z < 9e-95Initial program 98.8%
Taylor expanded in y around inf 95.7%
*-commutative95.7%
Simplified95.7%
if 9e-95 < z Initial program 83.5%
associate-*l/95.5%
Simplified95.5%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.3e+62) (not (<= z 1.74e-9))) (* (- y x) (/ z t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e+62) || !(z <= 1.74e-9)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.3d+62)) .or. (.not. (z <= 1.74d-9))) then
tmp = (y - x) * (z / t)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e+62) || !(z <= 1.74e-9)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.3e+62) or not (z <= 1.74e-9): tmp = (y - x) * (z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.3e+62) || !(z <= 1.74e-9)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.3e+62) || ~((z <= 1.74e-9))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.3e+62], N[Not[LessEqual[z, 1.74e-9]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+62} \lor \neg \left(z \leq 1.74 \cdot 10^{-9}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.2999999999999997e62 or 1.73999999999999999e-9 < z Initial program 83.8%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around 0 71.4%
Taylor expanded in z around inf 59.7%
associate-*r/59.7%
neg-mul-159.7%
Simplified59.7%
Taylor expanded in x around 0 61.2%
associate-*l/64.1%
associate-*r*64.1%
neg-mul-164.1%
associate-*l/69.5%
distribute-rgt-in79.7%
+-commutative79.7%
unsub-neg79.7%
distribute-lft-out--69.5%
associate-*r/64.1%
associate-*l/69.6%
associate-*r/65.9%
associate-*l/66.8%
distribute-lft-out--85.7%
Simplified85.7%
if -4.2999999999999997e62 < z < 1.73999999999999999e-9Initial program 99.2%
associate-*l/88.4%
Simplified88.4%
Taylor expanded in y around inf 90.7%
associate-*r/88.7%
Simplified88.7%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.56e+63) (not (<= z 5.8e-8))) (* (- y x) (/ z t)) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.56e+63) || !(z <= 5.8e-8)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.56d+63)) .or. (.not. (z <= 5.8d-8))) then
tmp = (y - x) * (z / t)
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.56e+63) || !(z <= 5.8e-8)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.56e+63) or not (z <= 5.8e-8): tmp = (y - x) * (z / t) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.56e+63) || !(z <= 5.8e-8)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.56e+63) || ~((z <= 5.8e-8))) tmp = (y - x) * (z / t); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.56e+63], N[Not[LessEqual[z, 5.8e-8]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{+63} \lor \neg \left(z \leq 5.8 \cdot 10^{-8}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.56e63 or 5.8000000000000003e-8 < z Initial program 83.8%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around 0 71.4%
Taylor expanded in z around inf 59.7%
associate-*r/59.7%
neg-mul-159.7%
Simplified59.7%
Taylor expanded in x around 0 61.2%
associate-*l/64.1%
associate-*r*64.1%
neg-mul-164.1%
associate-*l/69.5%
distribute-rgt-in79.7%
+-commutative79.7%
unsub-neg79.7%
distribute-lft-out--69.5%
associate-*r/64.1%
associate-*l/69.6%
associate-*r/65.9%
associate-*l/66.8%
distribute-lft-out--85.7%
Simplified85.7%
if -1.56e63 < z < 5.8000000000000003e-8Initial program 99.2%
Taylor expanded in y around inf 90.7%
*-commutative90.7%
Simplified90.7%
Final simplification88.4%
(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 92.2%
associate-/l*98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.2%
associate-*l/91.9%
Simplified91.9%
Taylor expanded in t around inf 39.3%
Final simplification39.3%
(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 2023271
(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)))