
(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 11 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 (* (/ 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 92.5%
Taylor expanded in z around 0 87.1%
+-commutative87.1%
mul-1-neg87.1%
*-commutative87.1%
associate-*r/85.7%
associate-/l*90.0%
distribute-lft-neg-in90.0%
distribute-rgt-in97.9%
sub-neg97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) z)))
(if (<= t -1.7e-91)
x
(if (<= t 1.95e-227)
t_1
(if (<= t 1.95e-204) (/ y (/ (- t) x)) (if (<= t 4.5e+97) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double tmp;
if (t <= -1.7e-91) {
tmp = x;
} else if (t <= 1.95e-227) {
tmp = t_1;
} else if (t <= 1.95e-204) {
tmp = y / (-t / x);
} else if (t <= 4.5e+97) {
tmp = t_1;
} 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) :: tmp
t_1 = (y / t) * z
if (t <= (-1.7d-91)) then
tmp = x
else if (t <= 1.95d-227) then
tmp = t_1
else if (t <= 1.95d-204) then
tmp = y / (-t / x)
else if (t <= 4.5d+97) then
tmp = t_1
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 / t) * z;
double tmp;
if (t <= -1.7e-91) {
tmp = x;
} else if (t <= 1.95e-227) {
tmp = t_1;
} else if (t <= 1.95e-204) {
tmp = y / (-t / x);
} else if (t <= 4.5e+97) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * z tmp = 0 if t <= -1.7e-91: tmp = x elif t <= 1.95e-227: tmp = t_1 elif t <= 1.95e-204: tmp = y / (-t / x) elif t <= 4.5e+97: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * z) tmp = 0.0 if (t <= -1.7e-91) tmp = x; elseif (t <= 1.95e-227) tmp = t_1; elseif (t <= 1.95e-204) tmp = Float64(y / Float64(Float64(-t) / x)); elseif (t <= 4.5e+97) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * z; tmp = 0.0; if (t <= -1.7e-91) tmp = x; elseif (t <= 1.95e-227) tmp = t_1; elseif (t <= 1.95e-204) tmp = y / (-t / x); elseif (t <= 4.5e+97) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t, -1.7e-91], x, If[LessEqual[t, 1.95e-227], t$95$1, If[LessEqual[t, 1.95e-204], N[(y / N[((-t) / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+97], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot z\\
\mathbf{if}\;t \leq -1.7 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-227}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-204}:\\
\;\;\;\;\frac{y}{\frac{-t}{x}}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.70000000000000013e-91 or 4.49999999999999976e97 < t Initial program 85.8%
Taylor expanded in y around 0 62.0%
if -1.70000000000000013e-91 < t < 1.95e-227 or 1.95e-204 < t < 4.49999999999999976e97Initial program 98.4%
Taylor expanded in y around inf 76.6%
Taylor expanded in z around inf 55.4%
clear-num55.4%
un-div-inv55.4%
Applied egg-rr55.4%
associate-/r/66.3%
Applied egg-rr66.3%
if 1.95e-227 < t < 1.95e-204Initial program 100.0%
Taylor expanded in y around inf 71.5%
Taylor expanded in z around 0 81.5%
associate-*r/81.5%
neg-mul-181.5%
Simplified81.5%
distribute-frac-neg81.5%
distribute-rgt-neg-out81.5%
add-sqr-sqrt59.6%
sqrt-unprod60.4%
sqr-neg60.4%
sqrt-unprod0.5%
add-sqr-sqrt0.7%
clear-num0.7%
un-div-inv0.7%
add-sqr-sqrt0.5%
sqrt-unprod60.5%
sqr-neg60.5%
sqrt-unprod59.8%
add-sqr-sqrt81.6%
Applied egg-rr81.6%
Final simplification64.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) z)))
(if (<= t -3.7e-92)
x
(if (<= t 1.65e-227)
t_1
(if (<= t 1.9e-162) (/ (* x (- y)) t) (if (<= t 2.45e+86) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double tmp;
if (t <= -3.7e-92) {
tmp = x;
} else if (t <= 1.65e-227) {
tmp = t_1;
} else if (t <= 1.9e-162) {
tmp = (x * -y) / t;
} else if (t <= 2.45e+86) {
tmp = t_1;
} 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) :: tmp
t_1 = (y / t) * z
if (t <= (-3.7d-92)) then
tmp = x
else if (t <= 1.65d-227) then
tmp = t_1
else if (t <= 1.9d-162) then
tmp = (x * -y) / t
else if (t <= 2.45d+86) then
tmp = t_1
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 / t) * z;
double tmp;
if (t <= -3.7e-92) {
tmp = x;
} else if (t <= 1.65e-227) {
tmp = t_1;
} else if (t <= 1.9e-162) {
tmp = (x * -y) / t;
} else if (t <= 2.45e+86) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * z tmp = 0 if t <= -3.7e-92: tmp = x elif t <= 1.65e-227: tmp = t_1 elif t <= 1.9e-162: tmp = (x * -y) / t elif t <= 2.45e+86: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * z) tmp = 0.0 if (t <= -3.7e-92) tmp = x; elseif (t <= 1.65e-227) tmp = t_1; elseif (t <= 1.9e-162) tmp = Float64(Float64(x * Float64(-y)) / t); elseif (t <= 2.45e+86) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * z; tmp = 0.0; if (t <= -3.7e-92) tmp = x; elseif (t <= 1.65e-227) tmp = t_1; elseif (t <= 1.9e-162) tmp = (x * -y) / t; elseif (t <= 2.45e+86) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t, -3.7e-92], x, If[LessEqual[t, 1.65e-227], t$95$1, If[LessEqual[t, 1.9e-162], N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.45e+86], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot z\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-92}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-227}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-162}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.69999999999999977e-92 or 2.45e86 < t Initial program 85.8%
Taylor expanded in y around 0 62.0%
if -3.69999999999999977e-92 < t < 1.65e-227 or 1.90000000000000002e-162 < t < 2.45e86Initial program 98.3%
Taylor expanded in y around inf 76.9%
Taylor expanded in z around inf 56.1%
clear-num56.1%
un-div-inv56.1%
Applied egg-rr56.1%
associate-/r/67.7%
Applied egg-rr67.7%
if 1.65e-227 < t < 1.90000000000000002e-162Initial program 99.9%
Taylor expanded in y around -inf 83.1%
Taylor expanded in z around 0 66.3%
mul-1-neg66.3%
distribute-lft-neg-out66.3%
*-commutative66.3%
Simplified66.3%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.6e-46) (not (<= x 5e-44))) (* x (- 1.0 (/ y t))) (* (/ y t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.6e-46) || !(x <= 5e-44)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / 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 <= (-7.6d-46)) .or. (.not. (x <= 5d-44))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.6e-46) || !(x <= 5e-44)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.6e-46) or not (x <= 5e-44): tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.6e-46) || !(x <= 5e-44)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.6e-46) || ~((x <= 5e-44))) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.6e-46], N[Not[LessEqual[x, 5e-44]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-46} \lor \neg \left(x \leq 5 \cdot 10^{-44}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -7.5999999999999993e-46 or 5.00000000000000039e-44 < x Initial program 89.4%
Taylor expanded in x around inf 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
if -7.5999999999999993e-46 < x < 5.00000000000000039e-44Initial program 97.1%
Taylor expanded in y around inf 76.5%
Taylor expanded in z around inf 67.1%
clear-num67.0%
un-div-inv67.0%
Applied egg-rr67.0%
associate-/r/69.1%
Applied egg-rr69.1%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e-102) (not (<= t 1.6e+84))) (* x (- 1.0 (/ y t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-102) || !(t <= 1.6e+84)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.45d-102)) .or. (.not. (t <= 1.6d+84))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * (z - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-102) || !(t <= 1.6e+84)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.45e-102) or not (t <= 1.6e+84): tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.45e-102) || !(t <= 1.6e+84)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * Float64(z - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.45e-102) || ~((t <= 1.6e+84))) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.45e-102], N[Not[LessEqual[t, 1.6e+84]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-102} \lor \neg \left(t \leq 1.6 \cdot 10^{+84}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if t < -1.44999999999999993e-102 or 1.60000000000000005e84 < t Initial program 86.1%
Taylor expanded in x around inf 77.6%
mul-1-neg77.6%
unsub-neg77.6%
Simplified77.6%
if -1.44999999999999993e-102 < t < 1.60000000000000005e84Initial program 98.5%
Taylor expanded in y around -inf 88.3%
Taylor expanded in z around 0 78.5%
+-commutative88.7%
mul-1-neg88.7%
*-commutative88.7%
associate-*r/84.3%
associate-/l*81.9%
distribute-lft-neg-in81.9%
distribute-rgt-in97.1%
sub-neg97.1%
Simplified86.9%
Final simplification82.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.65e-91) (not (<= t 6.2e-21))) (+ x (* y (/ z t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.65e-91) || !(t <= 6.2e-21)) {
tmp = x + (y * (z / t));
} else {
tmp = (y / t) * (z - 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 <= (-3.65d-91)) .or. (.not. (t <= 6.2d-21))) then
tmp = x + (y * (z / t))
else
tmp = (y / t) * (z - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.65e-91) || !(t <= 6.2e-21)) {
tmp = x + (y * (z / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.65e-91) or not (t <= 6.2e-21): tmp = x + (y * (z / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.65e-91) || !(t <= 6.2e-21)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(y / t) * Float64(z - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.65e-91) || ~((t <= 6.2e-21))) tmp = x + (y * (z / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.65e-91], N[Not[LessEqual[t, 6.2e-21]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.65 \cdot 10^{-91} \lor \neg \left(t \leq 6.2 \cdot 10^{-21}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if t < -3.6500000000000001e-91 or 6.1999999999999997e-21 < t Initial program 86.6%
Taylor expanded in z around inf 83.7%
associate-/l*85.6%
Simplified85.6%
if -3.6500000000000001e-91 < t < 6.1999999999999997e-21Initial program 99.9%
Taylor expanded in y around -inf 91.3%
Taylor expanded in z around 0 80.0%
+-commutative88.5%
mul-1-neg88.5%
*-commutative88.5%
associate-*r/82.6%
associate-/l*79.1%
distribute-lft-neg-in79.1%
distribute-rgt-in96.6%
sub-neg96.6%
Simplified88.2%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9e-46) (not (<= x 3.5e+154))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e-46) || !(x <= 3.5e+154)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / 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 <= (-9d-46)) .or. (.not. (x <= 3.5d+154))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e-46) || !(x <= 3.5e+154)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9e-46) or not (x <= 3.5e+154): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9e-46) || !(x <= 3.5e+154)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9e-46) || ~((x <= 3.5e+154))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9e-46], N[Not[LessEqual[x, 3.5e+154]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-46} \lor \neg \left(x \leq 3.5 \cdot 10^{+154}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -9.00000000000000001e-46 or 3.5000000000000002e154 < x Initial program 88.6%
Taylor expanded in x around inf 88.6%
mul-1-neg88.6%
unsub-neg88.6%
Simplified88.6%
if -9.00000000000000001e-46 < x < 3.5000000000000002e154Initial program 95.8%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
mul-1-neg93.7%
*-commutative93.7%
associate-*r/91.3%
associate-/l*90.4%
distribute-lft-neg-in90.4%
distribute-rgt-in96.2%
sub-neg96.2%
Simplified96.2%
*-commutative96.2%
clear-num95.7%
un-div-inv96.1%
Applied egg-rr96.1%
Taylor expanded in z around inf 82.1%
*-commutative82.1%
associate-*r/86.2%
Simplified86.2%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (<= t -3.65e-91) (+ x (* y (/ z t))) (if (<= t 2.9e-21) (/ (* y (- z x)) t) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.65e-91) {
tmp = x + (y * (z / t));
} else if (t <= 2.9e-21) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + ((y / 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 (t <= (-3.65d-91)) then
tmp = x + (y * (z / t))
else if (t <= 2.9d-21) then
tmp = (y * (z - x)) / t
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.65e-91) {
tmp = x + (y * (z / t));
} else if (t <= 2.9e-21) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.65e-91: tmp = x + (y * (z / t)) elif t <= 2.9e-21: tmp = (y * (z - x)) / t else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.65e-91) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 2.9e-21) tmp = Float64(Float64(y * Float64(z - x)) / t); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.65e-91) tmp = x + (y * (z / t)); elseif (t <= 2.9e-21) tmp = (y * (z - x)) / t; else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.65e-91], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.9e-21], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.65 \cdot 10^{-91}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-21}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if t < -3.6500000000000001e-91Initial program 87.3%
Taylor expanded in z around inf 79.1%
associate-/l*80.3%
Simplified80.3%
if -3.6500000000000001e-91 < t < 2.9e-21Initial program 99.9%
Taylor expanded in y around -inf 91.3%
if 2.9e-21 < t Initial program 85.8%
Taylor expanded in z around 0 85.8%
+-commutative85.8%
mul-1-neg85.8%
*-commutative85.8%
associate-*r/87.2%
associate-/l*98.5%
distribute-lft-neg-in98.5%
distribute-rgt-in98.5%
sub-neg98.5%
Simplified98.5%
*-commutative98.5%
clear-num98.5%
un-div-inv98.5%
Applied egg-rr98.5%
Taylor expanded in z around inf 88.8%
*-commutative88.8%
associate-*r/91.6%
Simplified91.6%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1e-91) x (if (<= t 1.45e+84) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1e-91) {
tmp = x;
} else if (t <= 1.45e+84) {
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 <= (-1d-91)) then
tmp = x
else if (t <= 1.45d+84) 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 <= -1e-91) {
tmp = x;
} else if (t <= 1.45e+84) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1e-91: tmp = x elif t <= 1.45e+84: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1e-91) tmp = x; elseif (t <= 1.45e+84) 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 <= -1e-91) tmp = x; elseif (t <= 1.45e+84) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1e-91], x, If[LessEqual[t, 1.45e+84], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+84}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.00000000000000002e-91 or 1.44999999999999994e84 < t Initial program 85.8%
Taylor expanded in y around 0 62.0%
if -1.00000000000000002e-91 < t < 1.44999999999999994e84Initial program 98.5%
Taylor expanded in y around inf 76.2%
Taylor expanded in z around inf 52.3%
Final simplification56.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.75e-91) x (if (<= t 2.4e+86) (* (/ y t) z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.75e-91) {
tmp = x;
} else if (t <= 2.4e+86) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.75d-91)) then
tmp = x
else if (t <= 2.4d+86) then
tmp = (y / t) * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.75e-91) {
tmp = x;
} else if (t <= 2.4e+86) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.75e-91: tmp = x elif t <= 2.4e+86: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.75e-91) tmp = x; elseif (t <= 2.4e+86) 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 <= -1.75e-91) tmp = x; elseif (t <= 2.4e+86) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.75e-91], x, If[LessEqual[t, 2.4e+86], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+86}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.7499999999999999e-91 or 2.4e86 < t Initial program 85.8%
Taylor expanded in y around 0 62.0%
if -1.7499999999999999e-91 < t < 2.4e86Initial program 98.5%
Taylor expanded in y around inf 76.2%
Taylor expanded in z around inf 52.3%
clear-num52.2%
un-div-inv52.2%
Applied egg-rr52.2%
associate-/r/62.3%
Applied egg-rr62.3%
Final simplification62.2%
(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.5%
Taylor expanded in y around 0 35.6%
Final simplification35.6%
(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 2024115
(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)))