
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / 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 - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.4%
+-commutative92.4%
associate-/l*96.3%
fma-define96.3%
Simplified96.3%
fma-undefine96.3%
associate-/l*92.4%
*-commutative92.4%
associate-/l*96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.6e-118)
x
(if (or (<= t 125.0) (and (not (<= t 1.3e+72)) (<= t 7.6e+189)))
(* y (/ z t))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e-118) {
tmp = x;
} else if ((t <= 125.0) || (!(t <= 1.3e+72) && (t <= 7.6e+189))) {
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.6d-118)) then
tmp = x
else if ((t <= 125.0d0) .or. (.not. (t <= 1.3d+72)) .and. (t <= 7.6d+189)) 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.6e-118) {
tmp = x;
} else if ((t <= 125.0) || (!(t <= 1.3e+72) && (t <= 7.6e+189))) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.6e-118: tmp = x elif (t <= 125.0) or (not (t <= 1.3e+72) and (t <= 7.6e+189)): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e-118) tmp = x; elseif ((t <= 125.0) || (!(t <= 1.3e+72) && (t <= 7.6e+189))) 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.6e-118) tmp = x; elseif ((t <= 125.0) || (~((t <= 1.3e+72)) && (t <= 7.6e+189))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e-118], x, If[Or[LessEqual[t, 125.0], And[N[Not[LessEqual[t, 1.3e+72]], $MachinePrecision], LessEqual[t, 7.6e+189]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-118}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 125 \lor \neg \left(t \leq 1.3 \cdot 10^{+72}\right) \land t \leq 7.6 \cdot 10^{+189}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.60000000000000002e-118 or 125 < t < 1.29999999999999991e72 or 7.5999999999999997e189 < t Initial program 87.1%
+-commutative87.1%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in y around 0 64.9%
if -1.60000000000000002e-118 < t < 125 or 1.29999999999999991e72 < t < 7.5999999999999997e189Initial program 97.0%
+-commutative97.0%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in y around -inf 85.5%
Taylor expanded in z around inf 52.7%
associate-/l*51.4%
Simplified51.4%
Final simplification57.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.7e-120)
x
(if (<= t 220.0)
(/ y (/ t z))
(if (<= t 2.4e+72) x (if (<= t 2.6e+190) (* y (/ z t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.7e-120) {
tmp = x;
} else if (t <= 220.0) {
tmp = y / (t / z);
} else if (t <= 2.4e+72) {
tmp = x;
} else if (t <= 2.6e+190) {
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 <= (-4.7d-120)) then
tmp = x
else if (t <= 220.0d0) then
tmp = y / (t / z)
else if (t <= 2.4d+72) then
tmp = x
else if (t <= 2.6d+190) 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 <= -4.7e-120) {
tmp = x;
} else if (t <= 220.0) {
tmp = y / (t / z);
} else if (t <= 2.4e+72) {
tmp = x;
} else if (t <= 2.6e+190) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.7e-120: tmp = x elif t <= 220.0: tmp = y / (t / z) elif t <= 2.4e+72: tmp = x elif t <= 2.6e+190: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.7e-120) tmp = x; elseif (t <= 220.0) tmp = Float64(y / Float64(t / z)); elseif (t <= 2.4e+72) tmp = x; elseif (t <= 2.6e+190) 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 <= -4.7e-120) tmp = x; elseif (t <= 220.0) tmp = y / (t / z); elseif (t <= 2.4e+72) tmp = x; elseif (t <= 2.6e+190) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.7e-120], x, If[LessEqual[t, 220.0], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+72], x, If[LessEqual[t, 2.6e+190], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{-120}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 220:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+72}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+190}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.70000000000000016e-120 or 220 < t < 2.4000000000000001e72 or 2.60000000000000011e190 < t Initial program 87.1%
+-commutative87.1%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in y around 0 64.9%
if -4.70000000000000016e-120 < t < 220Initial program 98.2%
+-commutative98.2%
associate-/l*93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in y around -inf 88.4%
Taylor expanded in z around inf 52.9%
associate-/l*50.6%
Simplified50.6%
clear-num50.6%
un-div-inv50.8%
Applied egg-rr50.8%
if 2.4000000000000001e72 < t < 2.60000000000000011e190Initial program 87.8%
+-commutative87.8%
associate-/l*95.8%
fma-define95.8%
Simplified95.8%
Taylor expanded in y around -inf 63.9%
Taylor expanded in z around inf 51.6%
associate-/l*57.5%
Simplified57.5%
Final simplification57.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* z y) t)))
(if (<= z -2.35e-22)
t_1
(if (<= z 4.8e-295) x (if (<= z 6.8e+51) (* (/ y t) (- x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z * y) / t;
double tmp;
if (z <= -2.35e-22) {
tmp = t_1;
} else if (z <= 4.8e-295) {
tmp = x;
} else if (z <= 6.8e+51) {
tmp = (y / t) * -x;
} 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 = (z * y) / t
if (z <= (-2.35d-22)) then
tmp = t_1
else if (z <= 4.8d-295) then
tmp = x
else if (z <= 6.8d+51) then
tmp = (y / t) * -x
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 = (z * y) / t;
double tmp;
if (z <= -2.35e-22) {
tmp = t_1;
} else if (z <= 4.8e-295) {
tmp = x;
} else if (z <= 6.8e+51) {
tmp = (y / t) * -x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * y) / t tmp = 0 if z <= -2.35e-22: tmp = t_1 elif z <= 4.8e-295: tmp = x elif z <= 6.8e+51: tmp = (y / t) * -x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * y) / t) tmp = 0.0 if (z <= -2.35e-22) tmp = t_1; elseif (z <= 4.8e-295) tmp = x; elseif (z <= 6.8e+51) tmp = Float64(Float64(y / t) * Float64(-x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * y) / t; tmp = 0.0; if (z <= -2.35e-22) tmp = t_1; elseif (z <= 4.8e-295) tmp = x; elseif (z <= 6.8e+51) tmp = (y / t) * -x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -2.35e-22], t$95$1, If[LessEqual[z, 4.8e-295], x, If[LessEqual[z, 6.8e+51], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{t}\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-295}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+51}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.3500000000000001e-22 or 6.79999999999999969e51 < z Initial program 93.0%
+-commutative93.0%
associate-/l*95.6%
fma-define95.6%
Simplified95.6%
Taylor expanded in y around -inf 71.5%
Taylor expanded in z around inf 65.3%
if -2.3500000000000001e-22 < z < 4.7999999999999996e-295Initial program 88.4%
+-commutative88.4%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in y around 0 56.1%
if 4.7999999999999996e-295 < z < 6.79999999999999969e51Initial program 95.1%
+-commutative95.1%
associate-/l*97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in y around -inf 61.8%
Taylor expanded in z around 0 50.8%
mul-1-neg50.8%
associate-/l*50.7%
distribute-rgt-neg-in50.7%
mul-1-neg50.7%
associate-*r/50.7%
mul-1-neg50.7%
Simplified50.7%
Final simplification58.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* z y) t)))
(if (<= z -2.25e-24)
t_1
(if (<= z 1.02e-294) x (if (<= z 9e+43) (* y (/ (- x) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z * y) / t;
double tmp;
if (z <= -2.25e-24) {
tmp = t_1;
} else if (z <= 1.02e-294) {
tmp = x;
} else if (z <= 9e+43) {
tmp = 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 = (z * y) / t
if (z <= (-2.25d-24)) then
tmp = t_1
else if (z <= 1.02d-294) then
tmp = x
else if (z <= 9d+43) then
tmp = 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 = (z * y) / t;
double tmp;
if (z <= -2.25e-24) {
tmp = t_1;
} else if (z <= 1.02e-294) {
tmp = x;
} else if (z <= 9e+43) {
tmp = y * (-x / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * y) / t tmp = 0 if z <= -2.25e-24: tmp = t_1 elif z <= 1.02e-294: tmp = x elif z <= 9e+43: tmp = y * (-x / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * y) / t) tmp = 0.0 if (z <= -2.25e-24) tmp = t_1; elseif (z <= 1.02e-294) tmp = x; elseif (z <= 9e+43) tmp = Float64(y * Float64(Float64(-x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * y) / t; tmp = 0.0; if (z <= -2.25e-24) tmp = t_1; elseif (z <= 1.02e-294) tmp = x; elseif (z <= 9e+43) tmp = y * (-x / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -2.25e-24], t$95$1, If[LessEqual[z, 1.02e-294], x, If[LessEqual[z, 9e+43], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{t}\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-294}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+43}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.2499999999999999e-24 or 9e43 < z Initial program 93.2%
+-commutative93.2%
associate-/l*95.0%
fma-define94.9%
Simplified94.9%
Taylor expanded in y around -inf 71.4%
Taylor expanded in z around inf 64.5%
if -2.2499999999999999e-24 < z < 1.01999999999999998e-294Initial program 88.4%
+-commutative88.4%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in y around 0 56.1%
if 1.01999999999999998e-294 < z < 9e43Initial program 94.9%
+-commutative94.9%
associate-/l*98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in y around -inf 61.5%
associate-/l*64.8%
*-commutative64.8%
Applied egg-rr64.8%
Taylor expanded in z around 0 53.5%
neg-mul-153.5%
distribute-neg-frac253.5%
Simplified53.5%
Final simplification59.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.1e+62) (not (<= z 2.2e+58))) (/ (* z y) t) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e+62) || !(z <= 2.2e+58)) {
tmp = (z * y) / t;
} else {
tmp = x * (1.0 - (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 ((z <= (-5.1d+62)) .or. (.not. (z <= 2.2d+58))) then
tmp = (z * y) / t
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e+62) || !(z <= 2.2e+58)) {
tmp = (z * y) / t;
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.1e+62) or not (z <= 2.2e+58): tmp = (z * y) / t else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.1e+62) || !(z <= 2.2e+58)) tmp = Float64(Float64(z * y) / t); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.1e+62) || ~((z <= 2.2e+58))) tmp = (z * y) / t; else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.1e+62], N[Not[LessEqual[z, 2.2e+58]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{+62} \lor \neg \left(z \leq 2.2 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -5.09999999999999998e62 or 2.2000000000000001e58 < z Initial program 91.3%
+-commutative91.3%
associate-/l*94.6%
fma-define94.5%
Simplified94.5%
Taylor expanded in y around -inf 72.7%
Taylor expanded in z around inf 69.4%
if -5.09999999999999998e62 < z < 2.2000000000000001e58Initial program 93.1%
+-commutative93.1%
associate-/l*97.2%
fma-define97.2%
Simplified97.2%
Taylor expanded in z around 0 80.4%
*-rgt-identity80.4%
mul-1-neg80.4%
associate-/l*84.4%
distribute-rgt-neg-in84.4%
mul-1-neg84.4%
distribute-lft-in84.4%
mul-1-neg84.4%
unsub-neg84.4%
Simplified84.4%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.25e-16) (not (<= x 4.3e-93))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e-16) || !(x <= 4.3e-93)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - 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 ((x <= (-1.25d-16)) .or. (.not. (x <= 4.3d-93))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e-16) || !(x <= 4.3e-93)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.25e-16) or not (x <= 4.3e-93): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.25e-16) || !(x <= 4.3e-93)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.25e-16) || ~((x <= 4.3e-93))) tmp = x * (1.0 - (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.25e-16], N[Not[LessEqual[x, 4.3e-93]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-16} \lor \neg \left(x \leq 4.3 \cdot 10^{-93}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -1.2500000000000001e-16 or 4.29999999999999963e-93 < x Initial program 90.0%
+-commutative90.0%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in z around 0 82.0%
*-rgt-identity82.0%
mul-1-neg82.0%
associate-/l*88.8%
distribute-rgt-neg-in88.8%
mul-1-neg88.8%
distribute-lft-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
if -1.2500000000000001e-16 < x < 4.29999999999999963e-93Initial program 96.1%
+-commutative96.1%
associate-/l*96.5%
fma-define96.4%
Simplified96.4%
Taylor expanded in y around -inf 70.4%
associate-/l*70.7%
*-commutative70.7%
Applied egg-rr70.7%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.8e-20) (not (<= x 1.8e-43))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.8e-20) || !(x <= 1.8e-43)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-9.8d-20)) .or. (.not. (x <= 1.8d-43))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.8e-20) || !(x <= 1.8e-43)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.8e-20) or not (x <= 1.8e-43): tmp = x * (1.0 - (y / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.8e-20) || !(x <= 1.8e-43)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.8e-20) || ~((x <= 1.8e-43))) tmp = x * (1.0 - (y / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.8e-20], N[Not[LessEqual[x, 1.8e-43]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{-20} \lor \neg \left(x \leq 1.8 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -9.8000000000000003e-20 or 1.7999999999999999e-43 < x Initial program 89.0%
+-commutative89.0%
associate-/l*96.6%
fma-define96.5%
Simplified96.5%
Taylor expanded in z around 0 83.4%
*-rgt-identity83.4%
mul-1-neg83.4%
associate-/l*91.6%
distribute-rgt-neg-in91.6%
mul-1-neg91.6%
distribute-lft-in91.6%
mul-1-neg91.6%
unsub-neg91.6%
Simplified91.6%
if -9.8000000000000003e-20 < x < 1.7999999999999999e-43Initial program 96.5%
Taylor expanded in z around inf 82.4%
associate-/l*54.9%
Simplified82.4%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.8e+23) (not (<= x 6e-41))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.8e+23) || !(x <= 6e-41)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (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 <= (-1.8d+23)) .or. (.not. (x <= 6d-41))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (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 <= -1.8e+23) || !(x <= 6e-41)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.8e+23) or not (x <= 6e-41): tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.8e+23) || !(x <= 6e-41)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.8e+23) || ~((x <= 6e-41))) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.8e+23], N[Not[LessEqual[x, 6e-41]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+23} \lor \neg \left(x \leq 6 \cdot 10^{-41}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.7999999999999999e23 or 5.99999999999999978e-41 < x Initial program 88.5%
+-commutative88.5%
associate-/l*97.1%
fma-define97.1%
Simplified97.1%
Taylor expanded in z around 0 84.1%
*-rgt-identity84.1%
mul-1-neg84.1%
associate-/l*92.6%
distribute-rgt-neg-in92.6%
mul-1-neg92.6%
distribute-lft-in92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
if -1.7999999999999999e23 < x < 5.99999999999999978e-41Initial program 96.7%
Taylor expanded in z around inf 81.9%
associate-/l*52.9%
Simplified81.1%
clear-num52.8%
un-div-inv53.1%
Applied egg-rr80.9%
associate-/r/83.5%
Applied egg-rr83.5%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.05e-33) (not (<= z 2.65e+54))) (/ (* z y) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.05e-33) || !(z <= 2.65e+54)) {
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 <= (-2.05d-33)) .or. (.not. (z <= 2.65d+54))) 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 <= -2.05e-33) || !(z <= 2.65e+54)) {
tmp = (z * y) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.05e-33) or not (z <= 2.65e+54): tmp = (z * y) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.05e-33) || !(z <= 2.65e+54)) tmp = Float64(Float64(z * y) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.05e-33) || ~((z <= 2.65e+54))) tmp = (z * y) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.05e-33], N[Not[LessEqual[z, 2.65e+54]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-33} \lor \neg \left(z \leq 2.65 \cdot 10^{+54}\right):\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.05e-33 or 2.65000000000000009e54 < z Initial program 93.0%
+-commutative93.0%
associate-/l*95.6%
fma-define95.6%
Simplified95.6%
Taylor expanded in y around -inf 71.5%
Taylor expanded in z around inf 65.3%
if -2.05e-33 < z < 2.65000000000000009e54Initial program 92.0%
+-commutative92.0%
associate-/l*96.8%
fma-define96.8%
Simplified96.8%
Taylor expanded in y around 0 45.7%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
return x + (y * ((z - 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 + (y * ((z - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * ((z - x) / t));
}
def code(x, y, z, t): return x + (y * ((z - x) / t))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(Float64(z - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (y * ((z - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - x}{t}
\end{array}
Initial program 92.4%
associate-/l*61.5%
*-commutative61.5%
Applied egg-rr96.3%
Final simplification96.3%
(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.4%
+-commutative92.4%
associate-/l*96.3%
fma-define96.3%
Simplified96.3%
Taylor expanded in y around 0 37.5%
Final simplification37.5%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / 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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024053
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))