
(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 (fma (/ y t) (- z x) x))
double code(double x, double y, double z, double t) {
return fma((y / t), (z - x), x);
}
function code(x, y, z, t) return fma(Float64(y / t), Float64(z - x), x) end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)
\end{array}
Initial program 91.6%
+-commutative91.6%
associate-*l/96.9%
fma-def96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y z) t)) (t_2 (* (/ y t) (- x))))
(if (<= t -4.6e+179)
x
(if (<= t -1.1e+53)
(/ y (/ t z))
(if (<= t -3.4e-33)
x
(if (<= t -1.15e-176)
t_1
(if (<= t -5e-308)
t_2
(if (<= t 3.2e-141) t_1 (if (<= t 3.5e+18) t_2 x)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double t_2 = (y / t) * -x;
double tmp;
if (t <= -4.6e+179) {
tmp = x;
} else if (t <= -1.1e+53) {
tmp = y / (t / z);
} else if (t <= -3.4e-33) {
tmp = x;
} else if (t <= -1.15e-176) {
tmp = t_1;
} else if (t <= -5e-308) {
tmp = t_2;
} else if (t <= 3.2e-141) {
tmp = t_1;
} else if (t <= 3.5e+18) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * z) / t
t_2 = (y / t) * -x
if (t <= (-4.6d+179)) then
tmp = x
else if (t <= (-1.1d+53)) then
tmp = y / (t / z)
else if (t <= (-3.4d-33)) then
tmp = x
else if (t <= (-1.15d-176)) then
tmp = t_1
else if (t <= (-5d-308)) then
tmp = t_2
else if (t <= 3.2d-141) then
tmp = t_1
else if (t <= 3.5d+18) then
tmp = t_2
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double t_2 = (y / t) * -x;
double tmp;
if (t <= -4.6e+179) {
tmp = x;
} else if (t <= -1.1e+53) {
tmp = y / (t / z);
} else if (t <= -3.4e-33) {
tmp = x;
} else if (t <= -1.15e-176) {
tmp = t_1;
} else if (t <= -5e-308) {
tmp = t_2;
} else if (t <= 3.2e-141) {
tmp = t_1;
} else if (t <= 3.5e+18) {
tmp = t_2;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) / t t_2 = (y / t) * -x tmp = 0 if t <= -4.6e+179: tmp = x elif t <= -1.1e+53: tmp = y / (t / z) elif t <= -3.4e-33: tmp = x elif t <= -1.15e-176: tmp = t_1 elif t <= -5e-308: tmp = t_2 elif t <= 3.2e-141: tmp = t_1 elif t <= 3.5e+18: tmp = t_2 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) / t) t_2 = Float64(Float64(y / t) * Float64(-x)) tmp = 0.0 if (t <= -4.6e+179) tmp = x; elseif (t <= -1.1e+53) tmp = Float64(y / Float64(t / z)); elseif (t <= -3.4e-33) tmp = x; elseif (t <= -1.15e-176) tmp = t_1; elseif (t <= -5e-308) tmp = t_2; elseif (t <= 3.2e-141) tmp = t_1; elseif (t <= 3.5e+18) tmp = t_2; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) / t; t_2 = (y / t) * -x; tmp = 0.0; if (t <= -4.6e+179) tmp = x; elseif (t <= -1.1e+53) tmp = y / (t / z); elseif (t <= -3.4e-33) tmp = x; elseif (t <= -1.15e-176) tmp = t_1; elseif (t <= -5e-308) tmp = t_2; elseif (t <= 3.2e-141) tmp = t_1; elseif (t <= 3.5e+18) tmp = t_2; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision]}, If[LessEqual[t, -4.6e+179], x, If[LessEqual[t, -1.1e+53], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.4e-33], x, If[LessEqual[t, -1.15e-176], t$95$1, If[LessEqual[t, -5e-308], t$95$2, If[LessEqual[t, 3.2e-141], t$95$1, If[LessEqual[t, 3.5e+18], t$95$2, x]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
t_2 := \frac{y}{t} \cdot \left(-x\right)\\
\mathbf{if}\;t \leq -4.6 \cdot 10^{+179}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{-176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-308}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.59999999999999988e179 or -1.09999999999999999e53 < t < -3.4000000000000001e-33 or 3.5e18 < t Initial program 90.1%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 69.6%
if -4.59999999999999988e179 < t < -1.09999999999999999e53Initial program 65.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 64.1%
Taylor expanded in z around inf 53.2%
clear-num53.2%
un-div-inv53.4%
Applied egg-rr53.4%
if -3.4000000000000001e-33 < t < -1.1500000000000001e-176 or -4.99999999999999955e-308 < t < 3.2000000000000001e-141Initial program 99.7%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in y around inf 75.0%
Taylor expanded in z around inf 61.8%
Taylor expanded in y around 0 72.0%
if -1.1500000000000001e-176 < t < -4.99999999999999955e-308 or 3.2000000000000001e-141 < t < 3.5e18Initial program 97.4%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around inf 73.3%
Taylor expanded in z around 0 54.5%
associate-*r/54.5%
neg-mul-154.5%
Simplified54.5%
distribute-frac-neg54.5%
distribute-rgt-neg-in54.5%
*-commutative54.5%
div-inv54.5%
associate-*l*60.1%
associate-/r/60.1%
clear-num60.2%
Applied egg-rr60.2%
Final simplification66.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -1.04e-25)
t_1
(if (<= x -2.7e-142)
(/ z (/ t y))
(if (<= x -7.5e-204)
t_1
(if (<= x 1.8e-151)
(/ y (/ t z))
(if (or (<= x 1.2e-97) (not (<= x 2.1e-5))) t_1 (/ (* y z) t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1.04e-25) {
tmp = t_1;
} else if (x <= -2.7e-142) {
tmp = z / (t / y);
} else if (x <= -7.5e-204) {
tmp = t_1;
} else if (x <= 1.8e-151) {
tmp = y / (t / z);
} else if ((x <= 1.2e-97) || !(x <= 2.1e-5)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-1.04d-25)) then
tmp = t_1
else if (x <= (-2.7d-142)) then
tmp = z / (t / y)
else if (x <= (-7.5d-204)) then
tmp = t_1
else if (x <= 1.8d-151) then
tmp = y / (t / z)
else if ((x <= 1.2d-97) .or. (.not. (x <= 2.1d-5))) then
tmp = t_1
else
tmp = (y * z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1.04e-25) {
tmp = t_1;
} else if (x <= -2.7e-142) {
tmp = z / (t / y);
} else if (x <= -7.5e-204) {
tmp = t_1;
} else if (x <= 1.8e-151) {
tmp = y / (t / z);
} else if ((x <= 1.2e-97) || !(x <= 2.1e-5)) {
tmp = t_1;
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -1.04e-25: tmp = t_1 elif x <= -2.7e-142: tmp = z / (t / y) elif x <= -7.5e-204: tmp = t_1 elif x <= 1.8e-151: tmp = y / (t / z) elif (x <= 1.2e-97) or not (x <= 2.1e-5): tmp = t_1 else: tmp = (y * z) / t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -1.04e-25) tmp = t_1; elseif (x <= -2.7e-142) tmp = Float64(z / Float64(t / y)); elseif (x <= -7.5e-204) tmp = t_1; elseif (x <= 1.8e-151) tmp = Float64(y / Float64(t / z)); elseif ((x <= 1.2e-97) || !(x <= 2.1e-5)) tmp = t_1; else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -1.04e-25) tmp = t_1; elseif (x <= -2.7e-142) tmp = z / (t / y); elseif (x <= -7.5e-204) tmp = t_1; elseif (x <= 1.8e-151) tmp = y / (t / z); elseif ((x <= 1.2e-97) || ~((x <= 2.1e-5))) tmp = t_1; else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.04e-25], t$95$1, If[LessEqual[x, -2.7e-142], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.5e-204], t$95$1, If[LessEqual[x, 1.8e-151], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.2e-97], N[Not[LessEqual[x, 2.1e-5]], $MachinePrecision]], t$95$1, N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -1.04 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-142}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-151}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-97} \lor \neg \left(x \leq 2.1 \cdot 10^{-5}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -1.04000000000000004e-25 or -2.6999999999999998e-142 < x < -7.5000000000000003e-204 or 1.80000000000000016e-151 < x < 1.2e-97 or 2.09999999999999988e-5 < x Initial program 87.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 88.5%
mul-1-neg88.5%
unsub-neg88.5%
Simplified88.5%
if -1.04000000000000004e-25 < x < -2.6999999999999998e-142Initial program 99.8%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 55.5%
Taylor expanded in z around inf 39.7%
Taylor expanded in y around 0 61.7%
associate-*l/61.6%
*-commutative61.6%
Simplified61.6%
clear-num61.6%
un-div-inv61.7%
Applied egg-rr61.7%
if -7.5000000000000003e-204 < x < 1.80000000000000016e-151Initial program 98.0%
associate-*l/87.3%
Simplified87.3%
Taylor expanded in y around inf 87.1%
Taylor expanded in z around inf 80.1%
clear-num80.0%
un-div-inv80.3%
Applied egg-rr80.3%
if 1.2e-97 < x < 2.09999999999999988e-5Initial program 99.9%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in y around inf 75.5%
Taylor expanded in z around inf 62.2%
Taylor expanded in y around 0 73.8%
Final simplification82.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -1.8e-23)
t_1
(if (<= x -2.25e-139)
(/ z (/ t y))
(if (or (<= x -6e-203) (not (<= x 2600.0))) t_1 (* y (/ (- z x) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1.8e-23) {
tmp = t_1;
} else if (x <= -2.25e-139) {
tmp = z / (t / y);
} else if ((x <= -6e-203) || !(x <= 2600.0)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-1.8d-23)) then
tmp = t_1
else if (x <= (-2.25d-139)) then
tmp = z / (t / y)
else if ((x <= (-6d-203)) .or. (.not. (x <= 2600.0d0))) then
tmp = t_1
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 t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1.8e-23) {
tmp = t_1;
} else if (x <= -2.25e-139) {
tmp = z / (t / y);
} else if ((x <= -6e-203) || !(x <= 2600.0)) {
tmp = t_1;
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -1.8e-23: tmp = t_1 elif x <= -2.25e-139: tmp = z / (t / y) elif (x <= -6e-203) or not (x <= 2600.0): tmp = t_1 else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -1.8e-23) tmp = t_1; elseif (x <= -2.25e-139) tmp = Float64(z / Float64(t / y)); elseif ((x <= -6e-203) || !(x <= 2600.0)) tmp = t_1; else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -1.8e-23) tmp = t_1; elseif (x <= -2.25e-139) tmp = z / (t / y); elseif ((x <= -6e-203) || ~((x <= 2600.0))) tmp = t_1; else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e-23], t$95$1, If[LessEqual[x, -2.25e-139], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -6e-203], N[Not[LessEqual[x, 2600.0]], $MachinePrecision]], t$95$1, N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-139}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-203} \lor \neg \left(x \leq 2600\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -1.7999999999999999e-23 or -2.25000000000000011e-139 < x < -6.0000000000000002e-203 or 2600 < x Initial program 86.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 88.5%
mul-1-neg88.5%
unsub-neg88.5%
Simplified88.5%
if -1.7999999999999999e-23 < x < -2.25000000000000011e-139Initial program 99.8%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 55.5%
Taylor expanded in z around inf 39.7%
Taylor expanded in y around 0 61.7%
associate-*l/61.6%
*-commutative61.6%
Simplified61.6%
clear-num61.6%
un-div-inv61.7%
Applied egg-rr61.7%
if -6.0000000000000002e-203 < x < 2600Initial program 98.6%
associate-*l/91.2%
Simplified91.2%
Taylor expanded in y around inf 80.0%
Taylor expanded in z around 0 79.8%
associate-*l/78.5%
associate-*r*78.5%
*-commutative78.5%
associate-*r/77.4%
distribute-lft-out80.0%
+-commutative80.0%
mul-1-neg80.0%
sub-neg80.0%
div-sub80.0%
Simplified80.0%
Final simplification82.9%
(FPCore (x y z t)
:precision binary64
(if (<= t -5e+179)
x
(if (<= t -1.15e+53)
(* y (/ z t))
(if (<= t -2.6e-33) x (if (<= t 3.9e+18) (* (/ y t) z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e+179) {
tmp = x;
} else if (t <= -1.15e+53) {
tmp = y * (z / t);
} else if (t <= -2.6e-33) {
tmp = x;
} else if (t <= 3.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 <= (-5d+179)) then
tmp = x
else if (t <= (-1.15d+53)) then
tmp = y * (z / t)
else if (t <= (-2.6d-33)) then
tmp = x
else if (t <= 3.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 <= -5e+179) {
tmp = x;
} else if (t <= -1.15e+53) {
tmp = y * (z / t);
} else if (t <= -2.6e-33) {
tmp = x;
} else if (t <= 3.9e+18) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5e+179: tmp = x elif t <= -1.15e+53: tmp = y * (z / t) elif t <= -2.6e-33: tmp = x elif t <= 3.9e+18: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5e+179) tmp = x; elseif (t <= -1.15e+53) tmp = Float64(y * Float64(z / t)); elseif (t <= -2.6e-33) tmp = x; elseif (t <= 3.9e+18) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5e+179) tmp = x; elseif (t <= -1.15e+53) tmp = y * (z / t); elseif (t <= -2.6e-33) tmp = x; elseif (t <= 3.9e+18) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5e+179], x, If[LessEqual[t, -1.15e+53], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.6e-33], x, If[LessEqual[t, 3.9e+18], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+179}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{+53}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5e179 or -1.1500000000000001e53 < t < -2.59999999999999994e-33 or 3.9e18 < t Initial program 90.1%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 69.6%
if -5e179 < t < -1.1500000000000001e53Initial program 65.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 64.1%
Taylor expanded in z around inf 53.2%
if -2.59999999999999994e-33 < t < 3.9e18Initial program 98.8%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in y around inf 74.3%
Taylor expanded in z around inf 48.4%
Taylor expanded in y around 0 56.6%
associate-*l/55.9%
*-commutative55.9%
Simplified55.9%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.8e+179)
x
(if (<= t -1.02e+53)
(/ y (/ t z))
(if (<= t -3e-33) x (if (<= t 3.4e+19) (* (/ y t) z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.8e+179) {
tmp = x;
} else if (t <= -1.02e+53) {
tmp = y / (t / z);
} else if (t <= -3e-33) {
tmp = x;
} else if (t <= 3.4e+19) {
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 <= (-4.8d+179)) then
tmp = x
else if (t <= (-1.02d+53)) then
tmp = y / (t / z)
else if (t <= (-3d-33)) then
tmp = x
else if (t <= 3.4d+19) 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 <= -4.8e+179) {
tmp = x;
} else if (t <= -1.02e+53) {
tmp = y / (t / z);
} else if (t <= -3e-33) {
tmp = x;
} else if (t <= 3.4e+19) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.8e+179: tmp = x elif t <= -1.02e+53: tmp = y / (t / z) elif t <= -3e-33: tmp = x elif t <= 3.4e+19: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.8e+179) tmp = x; elseif (t <= -1.02e+53) tmp = Float64(y / Float64(t / z)); elseif (t <= -3e-33) tmp = x; elseif (t <= 3.4e+19) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.8e+179) tmp = x; elseif (t <= -1.02e+53) tmp = y / (t / z); elseif (t <= -3e-33) tmp = x; elseif (t <= 3.4e+19) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.8e+179], x, If[LessEqual[t, -1.02e+53], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3e-33], x, If[LessEqual[t, 3.4e+19], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+179}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.02 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+19}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.80000000000000025e179 or -1.01999999999999999e53 < t < -3.0000000000000002e-33 or 3.4e19 < t Initial program 90.1%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 69.6%
if -4.80000000000000025e179 < t < -1.01999999999999999e53Initial program 65.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 64.1%
Taylor expanded in z around inf 53.2%
clear-num53.2%
un-div-inv53.4%
Applied egg-rr53.4%
if -3.0000000000000002e-33 < t < 3.4e19Initial program 98.8%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in y around inf 74.3%
Taylor expanded in z around inf 48.4%
Taylor expanded in y around 0 56.6%
associate-*l/55.9%
*-commutative55.9%
Simplified55.9%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.6e+179)
x
(if (<= t -1.15e+53)
(/ y (/ t z))
(if (<= t -2.5e-33) x (if (<= t 2.7e+17) (/ (* y z) t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.6e+179) {
tmp = x;
} else if (t <= -1.15e+53) {
tmp = y / (t / z);
} else if (t <= -2.5e-33) {
tmp = x;
} else if (t <= 2.7e+17) {
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.6d+179)) then
tmp = x
else if (t <= (-1.15d+53)) then
tmp = y / (t / z)
else if (t <= (-2.5d-33)) then
tmp = x
else if (t <= 2.7d+17) 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.6e+179) {
tmp = x;
} else if (t <= -1.15e+53) {
tmp = y / (t / z);
} else if (t <= -2.5e-33) {
tmp = x;
} else if (t <= 2.7e+17) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.6e+179: tmp = x elif t <= -1.15e+53: tmp = y / (t / z) elif t <= -2.5e-33: tmp = x elif t <= 2.7e+17: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.6e+179) tmp = x; elseif (t <= -1.15e+53) tmp = Float64(y / Float64(t / z)); elseif (t <= -2.5e-33) tmp = x; elseif (t <= 2.7e+17) tmp = Float64(Float64(y * z) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.6e+179) tmp = x; elseif (t <= -1.15e+53) tmp = y / (t / z); elseif (t <= -2.5e-33) tmp = x; elseif (t <= 2.7e+17) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.6e+179], x, If[LessEqual[t, -1.15e+53], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.5e-33], x, If[LessEqual[t, 2.7e+17], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+179}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.59999999999999988e179 or -1.1500000000000001e53 < t < -2.50000000000000014e-33 or 2.7e17 < t Initial program 90.1%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 69.6%
if -4.59999999999999988e179 < t < -1.1500000000000001e53Initial program 65.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 64.1%
Taylor expanded in z around inf 53.2%
clear-num53.2%
un-div-inv53.4%
Applied egg-rr53.4%
if -2.50000000000000014e-33 < t < 2.7e17Initial program 98.8%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in y around inf 74.3%
Taylor expanded in z around inf 48.4%
Taylor expanded in y around 0 56.6%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e-20) (not (<= z 1.06e-92))) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-20) || !(z <= 1.06e-92)) {
tmp = x + ((y / t) * z);
} 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 <= (-7.8d-20)) .or. (.not. (z <= 1.06d-92))) then
tmp = x + ((y / t) * z)
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 <= -7.8e-20) || !(z <= 1.06e-92)) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e-20) or not (z <= 1.06e-92): tmp = x + ((y / t) * z) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e-20) || !(z <= 1.06e-92)) tmp = Float64(x + Float64(Float64(y / t) * z)); 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 <= -7.8e-20) || ~((z <= 1.06e-92))) tmp = x + ((y / t) * z); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e-20], N[Not[LessEqual[z, 1.06e-92]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-20} \lor \neg \left(z \leq 1.06 \cdot 10^{-92}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.80000000000000014e-20 or 1.06e-92 < z Initial program 93.1%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around inf 85.5%
associate-*l/88.4%
*-commutative88.4%
Simplified88.4%
if -7.80000000000000014e-20 < z < 1.06e-92Initial program 89.5%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in x around inf 88.1%
mul-1-neg88.1%
unsub-neg88.1%
Simplified88.1%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.06e-20) (not (<= z 2.5e-92))) (+ x (* (/ y t) z)) (- x (/ x (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.06e-20) || !(z <= 2.5e-92)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.06d-20)) .or. (.not. (z <= 2.5d-92))) then
tmp = x + ((y / t) * z)
else
tmp = x - (x / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.06e-20) || !(z <= 2.5e-92)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.06e-20) or not (z <= 2.5e-92): tmp = x + ((y / t) * z) else: tmp = x - (x / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.06e-20) || !(z <= 2.5e-92)) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x - Float64(x / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.06e-20) || ~((z <= 2.5e-92))) tmp = x + ((y / t) * z); else tmp = x - (x / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.06e-20], N[Not[LessEqual[z, 2.5e-92]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.06 \cdot 10^{-20} \lor \neg \left(z \leq 2.5 \cdot 10^{-92}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -2.06000000000000008e-20 or 2.50000000000000006e-92 < z Initial program 93.1%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around inf 85.5%
associate-*l/88.4%
*-commutative88.4%
Simplified88.4%
if -2.06000000000000008e-20 < z < 2.50000000000000006e-92Initial program 89.5%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in z around 0 87.0%
associate-*r/87.0%
neg-mul-187.0%
Simplified87.0%
frac-2neg87.0%
div-inv86.6%
distribute-frac-neg86.6%
remove-double-neg86.6%
clear-num86.6%
add-sqr-sqrt41.9%
sqrt-unprod63.8%
sqr-neg63.8%
sqrt-unprod25.9%
add-sqr-sqrt49.2%
cancel-sign-sub-inv49.2%
clear-num49.2%
clear-num49.2%
add-sqr-sqrt25.9%
sqrt-unprod63.8%
sqr-neg63.8%
sqrt-unprod41.9%
add-sqr-sqrt86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 79.9%
associate-/l*89.0%
Simplified89.0%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.95e+81) (not (<= z 4.5e-31))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.95e+81) || !(z <= 4.5e-31)) {
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 ((z <= (-2.95d+81)) .or. (.not. (z <= 4.5d-31))) 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 ((z <= -2.95e+81) || !(z <= 4.5e-31)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.95e+81) or not (z <= 4.5e-31): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.95e+81) || !(z <= 4.5e-31)) 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 ((z <= -2.95e+81) || ~((z <= 4.5e-31))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.95e+81], N[Not[LessEqual[z, 4.5e-31]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.95 \cdot 10^{+81} \lor \neg \left(z \leq 4.5 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.9500000000000002e81 or 4.5000000000000004e-31 < z Initial program 92.0%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in y around inf 66.7%
Taylor expanded in z around inf 58.9%
if -2.9500000000000002e81 < z < 4.5000000000000004e-31Initial program 91.3%
associate-*l/95.9%
Simplified95.9%
Taylor expanded in y around 0 52.9%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (+ x (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - 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 + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 91.6%
associate-*l/96.9%
Simplified96.9%
Final simplification96.9%
(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 91.6%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in y around 0 39.1%
Final simplification39.1%
(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 2024041
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))