
(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 (or (<= t_1 -1e+294) (not (<= t_1 2e+299)))
(+ x (* z (/ (- y x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -1e+294) || !(t_1 <= 2e+299)) {
tmp = x + (z * ((y - x) / 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 = x + (((y - x) * z) / t)
if ((t_1 <= (-1d+294)) .or. (.not. (t_1 <= 2d+299))) then
tmp = x + (z * ((y - x) / 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 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -1e+294) || !(t_1 <= 2e+299)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((y - x) * z) / t) tmp = 0 if (t_1 <= -1e+294) or not (t_1 <= 2e+299): tmp = x + (z * ((y - x) / t)) else: tmp = t_1 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+294) || !(t_1 <= 2e+299)) 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 + (((y - x) * z) / t); tmp = 0.0; if ((t_1 <= -1e+294) || ~((t_1 <= 2e+299))) 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+294], N[Not[LessEqual[t$95$1, 2e+299]], $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{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+294} \lor \neg \left(t_1 \leq 2 \cdot 10^{+299}\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)) < -1.00000000000000007e294 or 2.0000000000000001e299 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 80.7%
associate-*l/99.9%
Applied egg-rr99.9%
if -1.00000000000000007e294 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.0000000000000001e299Initial program 99.3%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -2.22e+24)
(and (not (<= z -3.8e-42))
(or (<= z -3.3e-100) (not (<= z 6.2e-85)))))
(* (- y x) (/ z t))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.22e+24) || (!(z <= -3.8e-42) && ((z <= -3.3e-100) || !(z <= 6.2e-85)))) {
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 <= (-2.22d+24)) .or. (.not. (z <= (-3.8d-42))) .and. (z <= (-3.3d-100)) .or. (.not. (z <= 6.2d-85))) 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 <= -2.22e+24) || (!(z <= -3.8e-42) && ((z <= -3.3e-100) || !(z <= 6.2e-85)))) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.22e+24) or (not (z <= -3.8e-42) and ((z <= -3.3e-100) or not (z <= 6.2e-85))): tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.22e+24) || (!(z <= -3.8e-42) && ((z <= -3.3e-100) || !(z <= 6.2e-85)))) 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 <= -2.22e+24) || (~((z <= -3.8e-42)) && ((z <= -3.3e-100) || ~((z <= 6.2e-85))))) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.22e+24], And[N[Not[LessEqual[z, -3.8e-42]], $MachinePrecision], Or[LessEqual[z, -3.3e-100], N[Not[LessEqual[z, 6.2e-85]], $MachinePrecision]]]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.22 \cdot 10^{+24} \lor \neg \left(z \leq -3.8 \cdot 10^{-42}\right) \land \left(z \leq -3.3 \cdot 10^{-100} \lor \neg \left(z \leq 6.2 \cdot 10^{-85}\right)\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.21999999999999994e24 or -3.80000000000000017e-42 < z < -3.29999999999999996e-100 or 6.2000000000000005e-85 < z Initial program 88.9%
Taylor expanded in t around 0 75.9%
*-commutative75.9%
associate-*l/80.3%
Applied egg-rr80.3%
if -2.21999999999999994e24 < z < -3.80000000000000017e-42 or -3.29999999999999996e-100 < z < 6.2000000000000005e-85Initial program 99.0%
Taylor expanded in z around 0 73.7%
Final simplification77.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.02e+28)
(* z (/ (- y x) t))
(if (<= z -4.2e-44)
x
(if (or (<= z -4.5e-100) (not (<= z 4.2e-86))) (* (- y x) (/ z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e+28) {
tmp = z * ((y - x) / t);
} else if (z <= -4.2e-44) {
tmp = x;
} else if ((z <= -4.5e-100) || !(z <= 4.2e-86)) {
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 <= (-1.02d+28)) then
tmp = z * ((y - x) / t)
else if (z <= (-4.2d-44)) then
tmp = x
else if ((z <= (-4.5d-100)) .or. (.not. (z <= 4.2d-86))) 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 <= -1.02e+28) {
tmp = z * ((y - x) / t);
} else if (z <= -4.2e-44) {
tmp = x;
} else if ((z <= -4.5e-100) || !(z <= 4.2e-86)) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.02e+28: tmp = z * ((y - x) / t) elif z <= -4.2e-44: tmp = x elif (z <= -4.5e-100) or not (z <= 4.2e-86): tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.02e+28) tmp = Float64(z * Float64(Float64(y - x) / t)); elseif (z <= -4.2e-44) tmp = x; elseif ((z <= -4.5e-100) || !(z <= 4.2e-86)) 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 <= -1.02e+28) tmp = z * ((y - x) / t); elseif (z <= -4.2e-44) tmp = x; elseif ((z <= -4.5e-100) || ~((z <= 4.2e-86))) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.02e+28], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.2e-44], x, If[Or[LessEqual[z, -4.5e-100], N[Not[LessEqual[z, 4.2e-86]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+28}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-100} \lor \neg \left(z \leq 4.2 \cdot 10^{-86}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.02e28Initial program 84.6%
Taylor expanded in t around 0 78.5%
associate-*l/99.8%
Applied egg-rr89.4%
if -1.02e28 < z < -4.20000000000000003e-44 or -4.5000000000000001e-100 < z < 4.2e-86Initial program 99.0%
Taylor expanded in z around 0 73.7%
if -4.20000000000000003e-44 < z < -4.5000000000000001e-100 or 4.2e-86 < z Initial program 91.7%
Taylor expanded in t around 0 74.2%
*-commutative74.2%
associate-*l/78.2%
Applied egg-rr78.2%
Final simplification79.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+57)
(* z (/ (- y x) t))
(if (or (<= z 5.1e-65) (and (not (<= z 0.48)) (<= z 4.6e+89)))
(+ x (* y (/ z t)))
(* (- y x) (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+57) {
tmp = z * ((y - x) / t);
} else if ((z <= 5.1e-65) || (!(z <= 0.48) && (z <= 4.6e+89))) {
tmp = x + (y * (z / t));
} else {
tmp = (y - x) * (z / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.5d+57)) then
tmp = z * ((y - x) / t)
else if ((z <= 5.1d-65) .or. (.not. (z <= 0.48d0)) .and. (z <= 4.6d+89)) then
tmp = x + (y * (z / t))
else
tmp = (y - x) * (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.5e+57) {
tmp = z * ((y - x) / t);
} else if ((z <= 5.1e-65) || (!(z <= 0.48) && (z <= 4.6e+89))) {
tmp = x + (y * (z / t));
} else {
tmp = (y - x) * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+57: tmp = z * ((y - x) / t) elif (z <= 5.1e-65) or (not (z <= 0.48) and (z <= 4.6e+89)): tmp = x + (y * (z / t)) else: tmp = (y - x) * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+57) tmp = Float64(z * Float64(Float64(y - x) / t)); elseif ((z <= 5.1e-65) || (!(z <= 0.48) && (z <= 4.6e+89))) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(y - x) * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+57) tmp = z * ((y - x) / t); elseif ((z <= 5.1e-65) || (~((z <= 0.48)) && (z <= 4.6e+89))) tmp = x + (y * (z / t)); else tmp = (y - x) * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+57], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 5.1e-65], And[N[Not[LessEqual[z, 0.48]], $MachinePrecision], LessEqual[z, 4.6e+89]]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+57}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-65} \lor \neg \left(z \leq 0.48\right) \land z \leq 4.6 \cdot 10^{+89}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.49999999999999996e57Initial program 82.4%
Taylor expanded in t around 0 77.1%
associate-*l/99.9%
Applied egg-rr89.6%
if -4.49999999999999996e57 < z < 5.10000000000000001e-65 or 0.47999999999999998 < z < 4.5999999999999998e89Initial program 97.9%
Taylor expanded in y around inf 90.4%
associate-*r/30.0%
Simplified90.6%
if 5.10000000000000001e-65 < z < 0.47999999999999998 or 4.5999999999999998e89 < z Initial program 90.2%
Taylor expanded in t around 0 83.7%
*-commutative83.7%
associate-*l/88.4%
Applied egg-rr88.4%
Final simplification89.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.2e+57)
(* z (/ (- y x) t))
(if (<= z 2.4e-63)
(+ x (/ y (/ t z)))
(if (or (<= z 0.46) (not (<= z 3.3e+92)))
(* (- y x) (/ z t))
(+ x (* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+57) {
tmp = z * ((y - x) / t);
} else if (z <= 2.4e-63) {
tmp = x + (y / (t / z));
} else if ((z <= 0.46) || !(z <= 3.3e+92)) {
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.2d+57)) then
tmp = z * ((y - x) / t)
else if (z <= 2.4d-63) then
tmp = x + (y / (t / z))
else if ((z <= 0.46d0) .or. (.not. (z <= 3.3d+92))) 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.2e+57) {
tmp = z * ((y - x) / t);
} else if (z <= 2.4e-63) {
tmp = x + (y / (t / z));
} else if ((z <= 0.46) || !(z <= 3.3e+92)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+57: tmp = z * ((y - x) / t) elif z <= 2.4e-63: tmp = x + (y / (t / z)) elif (z <= 0.46) or not (z <= 3.3e+92): 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.2e+57) tmp = Float64(z * Float64(Float64(y - x) / t)); elseif (z <= 2.4e-63) tmp = Float64(x + Float64(y / Float64(t / z))); elseif ((z <= 0.46) || !(z <= 3.3e+92)) 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 <= -1.2e+57) tmp = z * ((y - x) / t); elseif (z <= 2.4e-63) tmp = x + (y / (t / z)); elseif ((z <= 0.46) || ~((z <= 3.3e+92))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+57], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.4e-63], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 0.46], N[Not[LessEqual[z, 3.3e+92]], $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 -1.2 \cdot 10^{+57}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-63}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 0.46 \lor \neg \left(z \leq 3.3 \cdot 10^{+92}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.20000000000000002e57Initial program 82.4%
Taylor expanded in t around 0 77.1%
associate-*l/99.9%
Applied egg-rr89.6%
if -1.20000000000000002e57 < z < 2.4000000000000001e-63Initial program 99.2%
Taylor expanded in y around inf 92.1%
associate-*r/28.6%
Simplified90.8%
clear-num28.6%
un-div-inv28.7%
Applied egg-rr90.9%
if 2.4000000000000001e-63 < z < 0.46000000000000002 or 3.29999999999999974e92 < z Initial program 90.2%
Taylor expanded in t around 0 83.7%
*-commutative83.7%
associate-*l/88.4%
Applied egg-rr88.4%
if 0.46000000000000002 < z < 3.29999999999999974e92Initial program 90.0%
Taylor expanded in y around inf 79.5%
associate-*r/39.2%
Simplified89.5%
Final simplification89.9%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.6e+81)
x
(if (<= t -4.4e-238)
(* z (/ y t))
(if (<= t 1.86e-196)
(* (/ z t) (- x))
(if (<= t 6.9e-18) (/ y (/ t z)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e+81) {
tmp = x;
} else if (t <= -4.4e-238) {
tmp = z * (y / t);
} else if (t <= 1.86e-196) {
tmp = (z / t) * -x;
} else if (t <= 6.9e-18) {
tmp = y / (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 (t <= (-1.6d+81)) then
tmp = x
else if (t <= (-4.4d-238)) then
tmp = z * (y / t)
else if (t <= 1.86d-196) then
tmp = (z / t) * -x
else if (t <= 6.9d-18) then
tmp = y / (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 (t <= -1.6e+81) {
tmp = x;
} else if (t <= -4.4e-238) {
tmp = z * (y / t);
} else if (t <= 1.86e-196) {
tmp = (z / t) * -x;
} else if (t <= 6.9e-18) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.6e+81: tmp = x elif t <= -4.4e-238: tmp = z * (y / t) elif t <= 1.86e-196: tmp = (z / t) * -x elif t <= 6.9e-18: tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e+81) tmp = x; elseif (t <= -4.4e-238) tmp = Float64(z * Float64(y / t)); elseif (t <= 1.86e-196) tmp = Float64(Float64(z / t) * Float64(-x)); elseif (t <= 6.9e-18) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.6e+81) tmp = x; elseif (t <= -4.4e-238) tmp = z * (y / t); elseif (t <= 1.86e-196) tmp = (z / t) * -x; elseif (t <= 6.9e-18) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e+81], x, If[LessEqual[t, -4.4e-238], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.86e-196], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[t, 6.9e-18], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 1.86 \cdot 10^{-196}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;t \leq 6.9 \cdot 10^{-18}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.6e81 or 6.9000000000000003e-18 < t Initial program 85.4%
Taylor expanded in z around 0 65.1%
if -1.6e81 < t < -4.39999999999999982e-238Initial program 99.8%
Taylor expanded in t around 0 77.8%
Taylor expanded in y around inf 56.2%
associate-*l/56.2%
*-commutative56.2%
Simplified56.2%
if -4.39999999999999982e-238 < t < 1.8600000000000001e-196Initial program 98.1%
Taylor expanded in t around 0 93.7%
Taylor expanded in y around 0 72.2%
associate-*r/72.2%
mul-1-neg72.2%
distribute-rgt-neg-out72.2%
associate-*l/72.8%
Simplified72.8%
if 1.8600000000000001e-196 < t < 6.9000000000000003e-18Initial program 99.8%
Taylor expanded in t around 0 82.2%
Taylor expanded in y around inf 63.9%
associate-*r/63.9%
Simplified63.9%
clear-num63.9%
un-div-inv64.0%
Applied egg-rr64.0%
Final simplification63.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e+21) (not (<= y 6.2e-33))) (+ x (/ y (/ t z))) (- x (* x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+21) || !(y <= 6.2e-33)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.4d+21)) .or. (.not. (y <= 6.2d-33))) then
tmp = x + (y / (t / z))
else
tmp = x - (x * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+21) || !(y <= 6.2e-33)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e+21) or not (y <= 6.2e-33): tmp = x + (y / (t / z)) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e+21) || !(y <= 6.2e-33)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(x * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.4e+21) || ~((y <= 6.2e-33))) tmp = x + (y / (t / z)); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+21], N[Not[LessEqual[y, 6.2e-33]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+21} \lor \neg \left(y \leq 6.2 \cdot 10^{-33}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -3.4e21 or 6.19999999999999994e-33 < y Initial program 88.8%
Taylor expanded in y around inf 86.2%
associate-*r/67.9%
Simplified93.5%
clear-num67.8%
un-div-inv67.9%
Applied egg-rr93.5%
if -3.4e21 < y < 6.19999999999999994e-33Initial program 96.4%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
distribute-lft-in86.2%
*-rgt-identity86.2%
mul-1-neg86.2%
distribute-rgt-neg-in86.2%
unsub-neg86.2%
Simplified86.2%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.12e+21) (not (<= y 1.1e-35))) (+ x (/ y (/ t z))) (- x (/ x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.12e+21) || !(y <= 1.1e-35)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (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 ((y <= (-1.12d+21)) .or. (.not. (y <= 1.1d-35))) then
tmp = x + (y / (t / z))
else
tmp = x - (x / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.12e+21) || !(y <= 1.1e-35)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.12e+21) or not (y <= 1.1e-35): tmp = x + (y / (t / z)) else: tmp = x - (x / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.12e+21) || !(y <= 1.1e-35)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(x / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.12e+21) || ~((y <= 1.1e-35))) tmp = x + (y / (t / z)); else tmp = x - (x / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.12e+21], N[Not[LessEqual[y, 1.1e-35]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+21} \lor \neg \left(y \leq 1.1 \cdot 10^{-35}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -1.12e21 or 1.09999999999999997e-35 < y Initial program 88.8%
Taylor expanded in y around inf 86.2%
associate-*r/67.9%
Simplified93.5%
clear-num67.8%
un-div-inv67.9%
Applied egg-rr93.5%
if -1.12e21 < y < 1.09999999999999997e-35Initial program 96.4%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
distribute-lft-in86.2%
*-rgt-identity86.2%
mul-1-neg86.2%
distribute-rgt-neg-in86.2%
unsub-neg86.2%
Simplified86.2%
clear-num86.1%
un-div-inv86.5%
Applied egg-rr86.5%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.45e+81) x (if (<= t 3.1e-19) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e+81) {
tmp = x;
} else if (t <= 3.1e-19) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.45d+81)) then
tmp = x
else if (t <= 3.1d-19) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e+81) {
tmp = x;
} else if (t <= 3.1e-19) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.45e+81: tmp = x elif t <= 3.1e-19: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.45e+81) tmp = x; elseif (t <= 3.1e-19) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.45e+81) tmp = x; elseif (t <= 3.1e-19) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.45e+81], x, If[LessEqual[t, 3.1e-19], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-19}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.45e81 or 3.0999999999999999e-19 < t Initial program 85.4%
Taylor expanded in z around 0 65.1%
if -1.45e81 < t < 3.0999999999999999e-19Initial program 99.4%
Taylor expanded in t around 0 82.9%
Taylor expanded in y around inf 55.0%
associate-*r/55.7%
Simplified55.7%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (+ x (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / 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 + (z * ((y - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
def code(x, y, z, t): return x + (z * ((y - x) / t))
function code(x, y, z, t) return Float64(x + Float64(z * Float64(Float64(y - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (z * ((y - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y - x}{t}
\end{array}
Initial program 92.9%
associate-*l/93.3%
Applied egg-rr93.3%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (+ x (/ z (/ t (- y x)))))
double code(double x, double y, double z, double t) {
return x + (z / (t / (y - 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 + (z / (t / (y - x)))
end function
public static double code(double x, double y, double z, double t) {
return x + (z / (t / (y - x)));
}
def code(x, y, z, t): return x + (z / (t / (y - x)))
function code(x, y, z, t) return Float64(x + Float64(z / Float64(t / Float64(y - x)))) end
function tmp = code(x, y, z, t) tmp = x + (z / (t / (y - x))); end
code[x_, y_, z_, t_] := N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{\frac{t}{y - x}}
\end{array}
Initial program 92.9%
associate-*l/93.3%
Applied egg-rr93.3%
*-commutative93.3%
clear-num92.9%
un-div-inv93.9%
Applied egg-rr93.9%
Final simplification93.9%
(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.9%
associate-/l*97.6%
Simplified97.6%
Final simplification97.6%
(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.9%
Taylor expanded in z around 0 40.1%
Final simplification40.1%
(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 2023195
(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)))