
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (/ (* (- y x) z) t)))) (if (<= t_1 (- INFINITY)) (+ x (* (- y x) (/ z 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 <= -((double) INFINITY)) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = t_1;
}
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 + ((y - x) * (z / 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 <= -math.inf: tmp = x + ((y - x) * (z / 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 <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / 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 <= -Inf) tmp = x + ((y - x) * (z / 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[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / 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 -\infty:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0Initial program 83.3%
associate-/l*100.0%
Simplified100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 96.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.8e-25)
(* z (/ y t))
(if (<= z 1.2e-14)
x
(if (<= z 0.00016)
(* z (/ (- x) t))
(if (<= z 4.9e+31) x (* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e-25) {
tmp = z * (y / t);
} else if (z <= 1.2e-14) {
tmp = x;
} else if (z <= 0.00016) {
tmp = z * (-x / t);
} else if (z <= 4.9e+31) {
tmp = x;
} else {
tmp = 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 <= (-3.8d-25)) then
tmp = z * (y / t)
else if (z <= 1.2d-14) then
tmp = x
else if (z <= 0.00016d0) then
tmp = z * (-x / t)
else if (z <= 4.9d+31) then
tmp = x
else
tmp = 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 <= -3.8e-25) {
tmp = z * (y / t);
} else if (z <= 1.2e-14) {
tmp = x;
} else if (z <= 0.00016) {
tmp = z * (-x / t);
} else if (z <= 4.9e+31) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.8e-25: tmp = z * (y / t) elif z <= 1.2e-14: tmp = x elif z <= 0.00016: tmp = z * (-x / t) elif z <= 4.9e+31: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e-25) tmp = Float64(z * Float64(y / t)); elseif (z <= 1.2e-14) tmp = x; elseif (z <= 0.00016) tmp = Float64(z * Float64(Float64(-x) / t)); elseif (z <= 4.9e+31) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.8e-25) tmp = z * (y / t); elseif (z <= 1.2e-14) tmp = x; elseif (z <= 0.00016) tmp = z * (-x / t); elseif (z <= 4.9e+31) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e-25], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-14], x, If[LessEqual[z, 0.00016], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+31], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-25}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.00016:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -3.7999999999999998e-25Initial program 94.0%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in z around inf 77.4%
Taylor expanded in y around inf 56.9%
if -3.7999999999999998e-25 < z < 1.2e-14 or 1.60000000000000013e-4 < z < 4.89999999999999996e31Initial program 97.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 64.2%
if 1.2e-14 < z < 1.60000000000000013e-4Initial program 99.3%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in z around inf 95.3%
Taylor expanded in y around 0 68.1%
mul-1-neg68.1%
distribute-frac-neg268.1%
Simplified68.1%
if 4.89999999999999996e31 < z Initial program 88.8%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in z around inf 83.8%
*-commutative83.8%
sub-div87.1%
associate-*l/84.2%
Applied egg-rr84.2%
associate-*r/81.5%
*-commutative81.5%
Applied egg-rr81.5%
Taylor expanded in y around inf 45.7%
associate-*r/55.1%
*-commutative55.1%
Simplified55.1%
Final simplification60.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.3e-25)
(* z (/ y t))
(if (<= z 8.2e-14)
x
(if (<= z 0.0064)
(/ (- z) (/ t x))
(if (<= z 7.2e+31) x (* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e-25) {
tmp = z * (y / t);
} else if (z <= 8.2e-14) {
tmp = x;
} else if (z <= 0.0064) {
tmp = -z / (t / x);
} else if (z <= 7.2e+31) {
tmp = x;
} else {
tmp = 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 <= (-3.3d-25)) then
tmp = z * (y / t)
else if (z <= 8.2d-14) then
tmp = x
else if (z <= 0.0064d0) then
tmp = -z / (t / x)
else if (z <= 7.2d+31) then
tmp = x
else
tmp = 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 <= -3.3e-25) {
tmp = z * (y / t);
} else if (z <= 8.2e-14) {
tmp = x;
} else if (z <= 0.0064) {
tmp = -z / (t / x);
} else if (z <= 7.2e+31) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.3e-25: tmp = z * (y / t) elif z <= 8.2e-14: tmp = x elif z <= 0.0064: tmp = -z / (t / x) elif z <= 7.2e+31: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.3e-25) tmp = Float64(z * Float64(y / t)); elseif (z <= 8.2e-14) tmp = x; elseif (z <= 0.0064) tmp = Float64(Float64(-z) / Float64(t / x)); elseif (z <= 7.2e+31) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.3e-25) tmp = z * (y / t); elseif (z <= 8.2e-14) tmp = x; elseif (z <= 0.0064) tmp = -z / (t / x); elseif (z <= 7.2e+31) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.3e-25], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e-14], x, If[LessEqual[z, 0.0064], N[((-z) / N[(t / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e+31], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-25}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.0064:\\
\;\;\;\;\frac{-z}{\frac{t}{x}}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -3.2999999999999998e-25Initial program 94.0%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in z around inf 77.4%
Taylor expanded in y around inf 56.9%
if -3.2999999999999998e-25 < z < 8.2000000000000004e-14 or 0.00640000000000000031 < z < 7.19999999999999992e31Initial program 97.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 64.2%
if 8.2000000000000004e-14 < z < 0.00640000000000000031Initial program 99.3%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in z around inf 95.3%
Taylor expanded in y around 0 68.1%
mul-1-neg68.1%
distribute-frac-neg268.1%
Simplified68.1%
associate-*r/67.9%
distribute-frac-neg267.9%
add-sqr-sqrt39.4%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod0.4%
add-sqr-sqrt1.7%
associate-*r/1.7%
*-commutative1.7%
*-commutative1.7%
clear-num1.7%
un-div-inv1.7%
add-sqr-sqrt0.4%
sqrt-unprod39.4%
sqr-neg39.4%
sqrt-unprod39.1%
add-sqr-sqrt67.9%
Applied egg-rr67.9%
if 7.19999999999999992e31 < z Initial program 88.8%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in z around inf 83.8%
*-commutative83.8%
sub-div87.1%
associate-*l/84.2%
Applied egg-rr84.2%
associate-*r/81.5%
*-commutative81.5%
Applied egg-rr81.5%
Taylor expanded in y around inf 45.7%
associate-*r/55.1%
*-commutative55.1%
Simplified55.1%
Final simplification60.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.85e+243) (* x (/ (- z) t)) (if (<= z -1.3e-24) (* z (/ y t)) (if (<= z 3.3e+31) x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.85e+243) {
tmp = x * (-z / t);
} else if (z <= -1.3e-24) {
tmp = z * (y / t);
} else if (z <= 3.3e+31) {
tmp = x;
} else {
tmp = 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.85d+243)) then
tmp = x * (-z / t)
else if (z <= (-1.3d-24)) then
tmp = z * (y / t)
else if (z <= 3.3d+31) then
tmp = x
else
tmp = 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.85e+243) {
tmp = x * (-z / t);
} else if (z <= -1.3e-24) {
tmp = z * (y / t);
} else if (z <= 3.3e+31) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.85e+243: tmp = x * (-z / t) elif z <= -1.3e-24: tmp = z * (y / t) elif z <= 3.3e+31: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.85e+243) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= -1.3e-24) tmp = Float64(z * Float64(y / t)); elseif (z <= 3.3e+31) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.85e+243) tmp = x * (-z / t); elseif (z <= -1.3e-24) tmp = z * (y / t); elseif (z <= 3.3e+31) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.85e+243], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.3e-24], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+31], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+243}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-24}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.8500000000000001e243Initial program 90.8%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in x around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
Simplified74.9%
sub-neg74.9%
distribute-lft-in74.9%
*-commutative74.9%
*-un-lft-identity74.9%
distribute-neg-frac274.9%
add-sqr-sqrt44.3%
sqrt-unprod34.4%
sqr-neg34.4%
sqrt-unprod0.0%
add-sqr-sqrt1.5%
div-inv1.5%
*-commutative1.5%
add-sqr-sqrt0.0%
sqrt-unprod34.2%
sqr-neg34.2%
sqrt-unprod44.2%
add-sqr-sqrt74.7%
associate-*l*64.1%
Applied egg-rr61.3%
Taylor expanded in z around inf 56.2%
mul-1-neg56.2%
associate-*r/74.9%
*-commutative74.9%
distribute-rgt-neg-in74.9%
Simplified74.9%
if -1.8500000000000001e243 < z < -1.3e-24Initial program 94.6%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in z around inf 74.6%
Taylor expanded in y around inf 61.2%
if -1.3e-24 < z < 3.29999999999999992e31Initial program 97.7%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 60.9%
if 3.29999999999999992e31 < z Initial program 88.8%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in z around inf 83.8%
*-commutative83.8%
sub-div87.1%
associate-*l/84.2%
Applied egg-rr84.2%
associate-*r/81.5%
*-commutative81.5%
Applied egg-rr81.5%
Taylor expanded in y around inf 45.7%
associate-*r/55.1%
*-commutative55.1%
Simplified55.1%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.1e-88) (not (<= t 4.4e-7))) (+ x (* y (/ z t))) (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-88) || !(t <= 4.4e-7)) {
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 ((t <= (-4.1d-88)) .or. (.not. (t <= 4.4d-7))) 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 ((t <= -4.1e-88) || !(t <= 4.4e-7)) {
tmp = x + (y * (z / t));
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.1e-88) or not (t <= 4.4e-7): tmp = x + (y * (z / t)) else: tmp = ((y - x) * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.1e-88) || !(t <= 4.4e-7)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(Float64(y - x) * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.1e-88) || ~((t <= 4.4e-7))) tmp = x + (y * (z / t)); else tmp = ((y - x) * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.1e-88], N[Not[LessEqual[t, 4.4e-7]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{-88} \lor \neg \left(t \leq 4.4 \cdot 10^{-7}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if t < -4.1000000000000001e-88 or 4.4000000000000002e-7 < t Initial program 92.0%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in y around inf 82.9%
associate-*r/86.5%
Simplified86.5%
if -4.1000000000000001e-88 < t < 4.4000000000000002e-7Initial program 97.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in z around inf 76.6%
*-commutative76.6%
sub-div81.6%
associate-*l/87.0%
Applied egg-rr87.0%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e-139) (not (<= y 2.85e-116))) (+ x (* y (/ z t))) (- x (/ z (/ t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-139) || !(y <= 2.85e-116)) {
tmp = x + (y * (z / 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 ((y <= (-4.8d-139)) .or. (.not. (y <= 2.85d-116))) then
tmp = x + (y * (z / 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 ((y <= -4.8e-139) || !(y <= 2.85e-116)) {
tmp = x + (y * (z / t));
} else {
tmp = x - (z / (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.8e-139) or not (y <= 2.85e-116): tmp = x + (y * (z / t)) else: tmp = x - (z / (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.8e-139) || !(y <= 2.85e-116)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x - Float64(z / Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.8e-139) || ~((y <= 2.85e-116))) tmp = x + (y * (z / t)); else tmp = x - (z / (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.8e-139], N[Not[LessEqual[y, 2.85e-116]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-139} \lor \neg \left(y \leq 2.85 \cdot 10^{-116}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{t}{x}}\\
\end{array}
\end{array}
if y < -4.80000000000000029e-139 or 2.8499999999999998e-116 < y Initial program 93.9%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in y around inf 82.9%
associate-*r/86.5%
Simplified86.5%
if -4.80000000000000029e-139 < y < 2.8499999999999998e-116Initial program 95.9%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in x around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
Simplified81.5%
sub-neg81.5%
distribute-lft-in81.5%
*-commutative81.5%
*-un-lft-identity81.5%
distribute-neg-frac281.5%
add-sqr-sqrt41.9%
sqrt-unprod55.6%
sqr-neg55.6%
sqrt-unprod21.7%
add-sqr-sqrt41.6%
div-inv41.6%
*-commutative41.6%
add-sqr-sqrt21.7%
sqrt-unprod55.6%
sqr-neg55.6%
sqrt-unprod41.9%
add-sqr-sqrt81.6%
associate-*l*84.1%
Applied egg-rr84.6%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-24) (not (<= z 8.5e-14))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-24) || !(z <= 8.5e-14)) {
tmp = 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.15d-24)) .or. (.not. (z <= 8.5d-14))) then
tmp = 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.15e-24) || !(z <= 8.5e-14)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-24) or not (z <= 8.5e-14): tmp = z * ((y - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-24) || !(z <= 8.5e-14)) tmp = Float64(z * Float64(Float64(y - x) / 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.15e-24) || ~((z <= 8.5e-14))) tmp = 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.15e-24], N[Not[LessEqual[z, 8.5e-14]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-24} \lor \neg \left(z \leq 8.5 \cdot 10^{-14}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.1500000000000001e-24 or 8.50000000000000038e-14 < z Initial program 92.4%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in z around inf 79.1%
Taylor expanded in t around 0 83.3%
if -1.1500000000000001e-24 < z < 8.50000000000000038e-14Initial program 97.5%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in y around inf 86.7%
associate-*r/87.6%
Simplified87.6%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.6e-25) (not (<= z 1.46e+16))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.6e-25) || !(z <= 1.46e+16)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.6d-25)) .or. (.not. (z <= 1.46d+16))) then
tmp = z * ((y - x) / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.6e-25) || !(z <= 1.46e+16)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.6e-25) or not (z <= 1.46e+16): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.6e-25) || !(z <= 1.46e+16)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.6e-25) || ~((z <= 1.46e+16))) tmp = z * ((y - x) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.6e-25], N[Not[LessEqual[z, 1.46e+16]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-25} \lor \neg \left(z \leq 1.46 \cdot 10^{+16}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -5.59999999999999976e-25 or 1.46e16 < z Initial program 91.6%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in z around inf 80.8%
Taylor expanded in t around 0 85.5%
if -5.59999999999999976e-25 < z < 1.46e16Initial program 97.7%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in x around inf 77.6%
mul-1-neg77.6%
unsub-neg77.6%
Simplified77.6%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-199) (not (<= x 8.5e-164))) (* x (- 1.0 (/ z t))) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-199) || !(x <= 8.5e-164)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.9d-199)) .or. (.not. (x <= 8.5d-164))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-199) || !(x <= 8.5e-164)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-199) or not (x <= 8.5e-164): tmp = x * (1.0 - (z / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-199) || !(x <= 8.5e-164)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e-199) || ~((x <= 8.5e-164))) tmp = x * (1.0 - (z / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-199], N[Not[LessEqual[x, 8.5e-164]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-199} \lor \neg \left(x \leq 8.5 \cdot 10^{-164}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.9e-199 or 8.50000000000000035e-164 < x Initial program 95.6%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in x around inf 75.0%
mul-1-neg75.0%
unsub-neg75.0%
Simplified75.0%
if -2.9e-199 < x < 8.50000000000000035e-164Initial program 91.3%
associate-/l*89.4%
Simplified89.4%
Taylor expanded in z around inf 88.2%
Taylor expanded in y around inf 76.5%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e-25) (not (<= z 1.2e+32))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-25) || !(z <= 1.2e+32)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.8d-25)) .or. (.not. (z <= 1.2d+32))) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-25) || !(z <= 1.2e+32)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e-25) or not (z <= 1.2e+32): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e-25) || !(z <= 1.2e+32)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.8e-25) || ~((z <= 1.2e+32))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e-25], N[Not[LessEqual[z, 1.2e+32]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-25} \lor \neg \left(z \leq 1.2 \cdot 10^{+32}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.8e-25 or 1.19999999999999996e32 < z Initial program 91.5%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in z around inf 80.5%
Taylor expanded in y around inf 53.0%
if -7.8e-25 < z < 1.19999999999999996e32Initial program 97.7%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 60.9%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e-24) (* z (/ y t)) (if (<= z 1.85e+31) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-24) {
tmp = z * (y / t);
} else if (z <= 1.85e+31) {
tmp = x;
} else {
tmp = 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.25d-24)) then
tmp = z * (y / t)
else if (z <= 1.85d+31) then
tmp = x
else
tmp = 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.25e-24) {
tmp = z * (y / t);
} else if (z <= 1.85e+31) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-24: tmp = z * (y / t) elif z <= 1.85e+31: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-24) tmp = Float64(z * Float64(y / t)); elseif (z <= 1.85e+31) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.25e-24) tmp = z * (y / t); elseif (z <= 1.85e+31) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-24], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+31], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-24}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.24999999999999995e-24Initial program 94.0%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in z around inf 77.4%
Taylor expanded in y around inf 56.9%
if -1.24999999999999995e-24 < z < 1.8499999999999999e31Initial program 97.7%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 60.9%
if 1.8499999999999999e31 < z Initial program 88.8%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in z around inf 83.8%
*-commutative83.8%
sub-div87.1%
associate-*l/84.2%
Applied egg-rr84.2%
associate-*r/81.5%
*-commutative81.5%
Applied egg-rr81.5%
Taylor expanded in y around inf 45.7%
associate-*r/55.1%
*-commutative55.1%
Simplified55.1%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 94.6%
associate-/l*94.8%
Simplified94.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.6%
associate-/l*94.8%
Simplified94.8%
Taylor expanded in z around 0 37.7%
(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 2024103
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(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)))