
(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 14 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 (let* ((t_1 (+ x (/ (* (- z x) y) t)))) (if (<= t_1 (- INFINITY)) (+ x (* y (/ (- z x) t))) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if t_1 <= -math.inf: tmp = x + (y * ((z - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + (y * ((z - x) / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 84.8%
associate-/l*99.9%
*-commutative99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 97.6%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y (- t)))))
(if (<= y -1.65e-25)
t_1
(if (<= y 8.8e-75) x (if (<= y 7.5e+213) (* y (/ z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / -t);
double tmp;
if (y <= -1.65e-25) {
tmp = t_1;
} else if (y <= 8.8e-75) {
tmp = x;
} else if (y <= 7.5e+213) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / -t)
if (y <= (-1.65d-25)) then
tmp = t_1
else if (y <= 8.8d-75) then
tmp = x
else if (y <= 7.5d+213) then
tmp = y * (z / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / -t);
double tmp;
if (y <= -1.65e-25) {
tmp = t_1;
} else if (y <= 8.8e-75) {
tmp = x;
} else if (y <= 7.5e+213) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / -t) tmp = 0 if y <= -1.65e-25: tmp = t_1 elif y <= 8.8e-75: tmp = x elif y <= 7.5e+213: tmp = y * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / Float64(-t))) tmp = 0.0 if (y <= -1.65e-25) tmp = t_1; elseif (y <= 8.8e-75) tmp = x; elseif (y <= 7.5e+213) tmp = Float64(y * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / -t); tmp = 0.0; if (y <= -1.65e-25) tmp = t_1; elseif (y <= 8.8e-75) tmp = x; elseif (y <= 7.5e+213) tmp = y * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.65e-25], t$95$1, If[LessEqual[y, 8.8e-75], x, If[LessEqual[y, 7.5e+213], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{-t}\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-75}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+213}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.6499999999999999e-25 or 7.5000000000000003e213 < y Initial program 90.1%
+-commutative90.1%
associate-/l*96.4%
fma-define96.4%
Simplified96.4%
Taylor expanded in y around -inf 79.3%
Taylor expanded in z around 0 50.8%
mul-1-neg50.8%
associate-/l*54.4%
distribute-rgt-neg-in54.4%
mul-1-neg54.4%
associate-*r/54.4%
mul-1-neg54.4%
Simplified54.4%
if -1.6499999999999999e-25 < y < 8.80000000000000022e-75Initial program 99.1%
+-commutative99.1%
associate-/l*88.1%
fma-define88.1%
Simplified88.1%
Taylor expanded in y around 0 66.7%
if 8.80000000000000022e-75 < y < 7.5000000000000003e213Initial program 95.0%
+-commutative95.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around -inf 72.7%
Taylor expanded in z around inf 53.3%
associate-/l*59.6%
Simplified59.6%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.6e-25)
(/ x (/ t (- y)))
(if (<= y 1.55e-73)
x
(if (<= y 5.6e+213) (* y (/ z t)) (* x (/ y (- t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.6e-25) {
tmp = x / (t / -y);
} else if (y <= 1.55e-73) {
tmp = x;
} else if (y <= 5.6e+213) {
tmp = y * (z / t);
} else {
tmp = x * (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 (y <= (-1.6d-25)) then
tmp = x / (t / -y)
else if (y <= 1.55d-73) then
tmp = x
else if (y <= 5.6d+213) then
tmp = y * (z / t)
else
tmp = x * (y / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.6e-25) {
tmp = x / (t / -y);
} else if (y <= 1.55e-73) {
tmp = x;
} else if (y <= 5.6e+213) {
tmp = y * (z / t);
} else {
tmp = x * (y / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.6e-25: tmp = x / (t / -y) elif y <= 1.55e-73: tmp = x elif y <= 5.6e+213: tmp = y * (z / t) else: tmp = x * (y / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.6e-25) tmp = Float64(x / Float64(t / Float64(-y))); elseif (y <= 1.55e-73) tmp = x; elseif (y <= 5.6e+213) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x * Float64(y / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.6e-25) tmp = x / (t / -y); elseif (y <= 1.55e-73) tmp = x; elseif (y <= 5.6e+213) tmp = y * (z / t); else tmp = x * (y / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.6e-25], N[(x / N[(t / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e-73], x, If[LessEqual[y, 5.6e+213], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{\frac{t}{-y}}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+213}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\end{array}
\end{array}
if y < -1.6000000000000001e-25Initial program 90.2%
+-commutative90.2%
associate-/l*96.8%
fma-define96.8%
Simplified96.8%
Taylor expanded in y around -inf 75.8%
Taylor expanded in z around 0 45.6%
mul-1-neg45.6%
associate-/l*50.4%
distribute-rgt-neg-in50.4%
mul-1-neg50.4%
associate-*r/50.4%
mul-1-neg50.4%
Simplified50.4%
add-sqr-sqrt50.4%
sqrt-unprod48.7%
sqr-neg48.7%
sqrt-unprod0.0%
add-sqr-sqrt5.1%
clear-num5.1%
div-inv5.1%
frac-2neg5.1%
distribute-frac-neg25.1%
add-sqr-sqrt5.1%
sqrt-unprod6.4%
sqr-neg6.4%
sqrt-unprod0.0%
add-sqr-sqrt50.5%
Applied egg-rr50.5%
if -1.6000000000000001e-25 < y < 1.54999999999999985e-73Initial program 99.1%
+-commutative99.1%
associate-/l*88.1%
fma-define88.1%
Simplified88.1%
Taylor expanded in y around 0 66.7%
if 1.54999999999999985e-73 < y < 5.59999999999999979e213Initial program 95.0%
+-commutative95.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around -inf 72.7%
Taylor expanded in z around inf 53.3%
associate-/l*59.6%
Simplified59.6%
if 5.59999999999999979e213 < y Initial program 90.0%
+-commutative90.0%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in y around -inf 90.0%
Taylor expanded in z around 0 66.9%
mul-1-neg66.9%
associate-/l*66.6%
distribute-rgt-neg-in66.6%
mul-1-neg66.6%
associate-*r/66.6%
mul-1-neg66.6%
Simplified66.6%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.65e-25)
(/ x (/ t (- y)))
(if (<= y 4.3e-75)
x
(if (<= y 1.35e+214) (* y (/ z t)) (/ (* x y) (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e-25) {
tmp = x / (t / -y);
} else if (y <= 4.3e-75) {
tmp = x;
} else if (y <= 1.35e+214) {
tmp = y * (z / t);
} else {
tmp = (x * 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 (y <= (-1.65d-25)) then
tmp = x / (t / -y)
else if (y <= 4.3d-75) then
tmp = x
else if (y <= 1.35d+214) then
tmp = y * (z / t)
else
tmp = (x * y) / -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e-25) {
tmp = x / (t / -y);
} else if (y <= 4.3e-75) {
tmp = x;
} else if (y <= 1.35e+214) {
tmp = y * (z / t);
} else {
tmp = (x * y) / -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.65e-25: tmp = x / (t / -y) elif y <= 4.3e-75: tmp = x elif y <= 1.35e+214: tmp = y * (z / t) else: tmp = (x * y) / -t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e-25) tmp = Float64(x / Float64(t / Float64(-y))); elseif (y <= 4.3e-75) tmp = x; elseif (y <= 1.35e+214) tmp = Float64(y * Float64(z / t)); else tmp = Float64(Float64(x * y) / Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.65e-25) tmp = x / (t / -y); elseif (y <= 4.3e-75) tmp = x; elseif (y <= 1.35e+214) tmp = y * (z / t); else tmp = (x * y) / -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e-25], N[(x / N[(t / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e-75], x, If[LessEqual[y, 1.35e+214], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{\frac{t}{-y}}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-75}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+214}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{-t}\\
\end{array}
\end{array}
if y < -1.6499999999999999e-25Initial program 90.2%
+-commutative90.2%
associate-/l*96.8%
fma-define96.8%
Simplified96.8%
Taylor expanded in y around -inf 75.8%
Taylor expanded in z around 0 45.6%
mul-1-neg45.6%
associate-/l*50.4%
distribute-rgt-neg-in50.4%
mul-1-neg50.4%
associate-*r/50.4%
mul-1-neg50.4%
Simplified50.4%
add-sqr-sqrt50.4%
sqrt-unprod48.7%
sqr-neg48.7%
sqrt-unprod0.0%
add-sqr-sqrt5.1%
clear-num5.1%
div-inv5.1%
frac-2neg5.1%
distribute-frac-neg25.1%
add-sqr-sqrt5.1%
sqrt-unprod6.4%
sqr-neg6.4%
sqrt-unprod0.0%
add-sqr-sqrt50.5%
Applied egg-rr50.5%
if -1.6499999999999999e-25 < y < 4.2999999999999999e-75Initial program 99.1%
+-commutative99.1%
associate-/l*88.1%
fma-define88.1%
Simplified88.1%
Taylor expanded in y around 0 66.7%
if 4.2999999999999999e-75 < y < 1.35000000000000005e214Initial program 95.0%
+-commutative95.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around -inf 72.7%
Taylor expanded in z around inf 53.3%
associate-/l*59.6%
Simplified59.6%
if 1.35000000000000005e214 < y Initial program 90.0%
+-commutative90.0%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in y around -inf 90.0%
Taylor expanded in z around 0 66.9%
associate-*r/66.9%
mul-1-neg66.9%
distribute-lft-neg-out66.9%
*-commutative66.9%
Simplified66.9%
Final simplification61.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.1e-114) (not (<= x 9.5e-180))) (* x (- 1.0 (/ y t))) (/ y (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.1e-114) || !(x <= 9.5e-180)) {
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 <= (-4.1d-114)) .or. (.not. (x <= 9.5d-180))) 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 <= -4.1e-114) || !(x <= 9.5e-180)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.1e-114) or not (x <= 9.5e-180): tmp = x * (1.0 - (y / t)) else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.1e-114) || !(x <= 9.5e-180)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.1e-114) || ~((x <= 9.5e-180))) 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, -4.1e-114], N[Not[LessEqual[x, 9.5e-180]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-114} \lor \neg \left(x \leq 9.5 \cdot 10^{-180}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -4.0999999999999997e-114 or 9.49999999999999934e-180 < x Initial program 95.8%
+-commutative95.8%
associate-/l*93.4%
fma-define93.4%
Simplified93.4%
Taylor expanded in z around 0 78.8%
*-rgt-identity78.8%
mul-1-neg78.8%
associate-/l*79.9%
distribute-rgt-neg-in79.9%
mul-1-neg79.9%
distribute-lft-in79.8%
mul-1-neg79.8%
unsub-neg79.8%
Simplified79.8%
if -4.0999999999999997e-114 < x < 9.49999999999999934e-180Initial program 94.4%
+-commutative94.4%
associate-/l*93.3%
fma-define93.3%
Simplified93.3%
Taylor expanded in y around -inf 70.2%
Taylor expanded in z around inf 66.2%
associate-/l*66.3%
Simplified66.3%
clear-num66.3%
un-div-inv66.4%
Applied egg-rr66.4%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-42) (not (<= z 2.32e-125))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-42) || !(z <= 2.32e-125)) {
tmp = x + (y * (z / 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 <= (-9d-42)) .or. (.not. (z <= 2.32d-125))) then
tmp = x + (y * (z / 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 <= -9e-42) || !(z <= 2.32e-125)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-42) or not (z <= 2.32e-125): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-42) || !(z <= 2.32e-125)) tmp = Float64(x + Float64(y * Float64(z / 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 <= -9e-42) || ~((z <= 2.32e-125))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-42], N[Not[LessEqual[z, 2.32e-125]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-42} \lor \neg \left(z \leq 2.32 \cdot 10^{-125}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -9e-42 or 2.3199999999999999e-125 < z Initial program 94.5%
Taylor expanded in z around inf 86.3%
associate-/l*55.7%
Simplified86.3%
if -9e-42 < z < 2.3199999999999999e-125Initial program 97.0%
+-commutative97.0%
associate-/l*93.4%
fma-define93.4%
Simplified93.4%
Taylor expanded in z around 0 90.0%
*-rgt-identity90.0%
mul-1-neg90.0%
associate-/l*89.0%
distribute-rgt-neg-in89.0%
mul-1-neg89.0%
distribute-lft-in89.0%
mul-1-neg89.0%
unsub-neg89.0%
Simplified89.0%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e+55) (not (<= x 6.5e+86))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e+55) || !(x <= 6.5e+86)) {
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 <= (-5d+55)) .or. (.not. (x <= 6.5d+86))) 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 <= -5e+55) || !(x <= 6.5e+86)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e+55) or not (x <= 6.5e+86): 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 <= -5e+55) || !(x <= 6.5e+86)) 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 <= -5e+55) || ~((x <= 6.5e+86))) 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, -5e+55], N[Not[LessEqual[x, 6.5e+86]], $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 -5 \cdot 10^{+55} \lor \neg \left(x \leq 6.5 \cdot 10^{+86}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -5.00000000000000046e55 or 6.49999999999999996e86 < x Initial program 94.6%
+-commutative94.6%
associate-/l*90.5%
fma-define90.5%
Simplified90.5%
Taylor expanded in z around 0 91.3%
*-rgt-identity91.3%
mul-1-neg91.3%
associate-/l*93.4%
distribute-rgt-neg-in93.4%
mul-1-neg93.4%
distribute-lft-in93.4%
mul-1-neg93.4%
unsub-neg93.4%
Simplified93.4%
if -5.00000000000000046e55 < x < 6.49999999999999996e86Initial program 95.9%
Taylor expanded in z around inf 84.4%
associate-/l*48.0%
Simplified83.4%
clear-num47.9%
un-div-inv48.0%
Applied egg-rr83.4%
associate-/r/87.7%
Applied egg-rr87.7%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3.2e+56) (- x (/ (* x y) t)) (if (<= x 1e+86) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.2e+56) {
tmp = x - ((x * y) / t);
} else if (x <= 1e+86) {
tmp = x + (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 (x <= (-3.2d+56)) then
tmp = x - ((x * y) / t)
else if (x <= 1d+86) then
tmp = x + (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 (x <= -3.2e+56) {
tmp = x - ((x * y) / t);
} else if (x <= 1e+86) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.2e+56: tmp = x - ((x * y) / t) elif x <= 1e+86: tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.2e+56) tmp = Float64(x - Float64(Float64(x * y) / t)); elseif (x <= 1e+86) tmp = Float64(x + Float64(z * Float64(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 (x <= -3.2e+56) tmp = x - ((x * y) / t); elseif (x <= 1e+86) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.2e+56], N[(x - N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e+86], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+56}:\\
\;\;\;\;x - \frac{x \cdot y}{t}\\
\mathbf{elif}\;x \leq 10^{+86}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if x < -3.20000000000000003e56Initial program 98.0%
Taylor expanded in z around 0 90.6%
associate-*r/43.5%
mul-1-neg43.5%
distribute-lft-neg-out43.5%
*-commutative43.5%
Simplified90.6%
div-inv90.6%
add-sqr-sqrt90.5%
sqrt-unprod65.8%
sqr-neg65.8%
sqrt-unprod0.0%
add-sqr-sqrt51.9%
remove-double-neg51.9%
distribute-rgt-neg-out51.9%
cancel-sign-sub-inv51.9%
div-inv51.9%
associate-/l*49.2%
add-sqr-sqrt49.2%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod0.0%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
Taylor expanded in y around 0 90.6%
if -3.20000000000000003e56 < x < 1e86Initial program 95.9%
Taylor expanded in z around inf 84.4%
associate-/l*48.0%
Simplified83.4%
clear-num47.9%
un-div-inv48.0%
Applied egg-rr83.4%
associate-/r/87.7%
Applied egg-rr87.7%
if 1e86 < x Initial program 91.0%
+-commutative91.0%
associate-/l*91.4%
fma-define91.4%
Simplified91.4%
Taylor expanded in z around 0 92.0%
*-rgt-identity92.0%
mul-1-neg92.0%
associate-/l*96.6%
distribute-rgt-neg-in96.6%
mul-1-neg96.6%
distribute-lft-in96.5%
mul-1-neg96.5%
unsub-neg96.5%
Simplified96.5%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.2e-32) (not (<= y 5.1e-76))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.2e-32) || !(y <= 5.1e-76)) {
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 ((y <= (-8.2d-32)) .or. (.not. (y <= 5.1d-76))) 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 ((y <= -8.2e-32) || !(y <= 5.1e-76)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.2e-32) or not (y <= 5.1e-76): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.2e-32) || !(y <= 5.1e-76)) 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 ((y <= -8.2e-32) || ~((y <= 5.1e-76))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.2e-32], N[Not[LessEqual[y, 5.1e-76]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-32} \lor \neg \left(y \leq 5.1 \cdot 10^{-76}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.1999999999999995e-32 or 5.09999999999999986e-76 < y Initial program 92.4%
+-commutative92.4%
associate-/l*97.9%
fma-define97.9%
Simplified97.9%
Taylor expanded in y around -inf 76.8%
Taylor expanded in z around inf 47.9%
associate-/l*50.6%
Simplified50.6%
if -8.1999999999999995e-32 < y < 5.09999999999999986e-76Initial program 99.1%
+-commutative99.1%
associate-/l*87.9%
fma-define87.9%
Simplified87.9%
Taylor expanded in y around 0 67.8%
Final simplification58.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e-31) (/ y (/ t z)) (if (<= y 1.1e-73) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-31) {
tmp = y / (t / z);
} else if (y <= 1.1e-73) {
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 (y <= (-1.4d-31)) then
tmp = y / (t / z)
else if (y <= 1.1d-73) 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 (y <= -1.4e-31) {
tmp = y / (t / z);
} else if (y <= 1.1e-73) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e-31: tmp = y / (t / z) elif y <= 1.1e-73: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e-31) tmp = Float64(y / Float64(t / z)); elseif (y <= 1.1e-73) 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 (y <= -1.4e-31) tmp = y / (t / z); elseif (y <= 1.1e-73) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e-31], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-73], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-31}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -1.3999999999999999e-31Initial program 90.5%
+-commutative90.5%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around -inf 76.6%
Taylor expanded in z around inf 42.7%
associate-/l*44.2%
Simplified44.2%
clear-num44.2%
un-div-inv44.2%
Applied egg-rr44.2%
if -1.3999999999999999e-31 < y < 1.1e-73Initial program 99.1%
+-commutative99.1%
associate-/l*87.9%
fma-define87.9%
Simplified87.9%
Taylor expanded in y around 0 67.8%
if 1.1e-73 < y Initial program 93.8%
+-commutative93.8%
associate-/l*98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in y around -inf 76.9%
Taylor expanded in z around inf 52.0%
associate-/l*55.6%
Simplified55.6%
Final simplification58.4%
(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 95.4%
associate-/l*93.4%
*-commutative93.4%
Applied egg-rr93.4%
Final simplification93.4%
(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 95.4%
+-commutative95.4%
associate-/l*93.4%
fma-define93.4%
Simplified93.4%
fma-undefine93.4%
associate-/l*95.4%
*-commutative95.4%
associate-/l*97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
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) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 95.4%
div-inv95.4%
*-commutative95.4%
associate-*l*97.6%
Applied egg-rr97.6%
div-inv97.6%
clear-num97.2%
Applied egg-rr97.2%
un-div-inv97.3%
Applied egg-rr97.3%
Final simplification97.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 95.4%
+-commutative95.4%
associate-/l*93.4%
fma-define93.4%
Simplified93.4%
Taylor expanded in y around 0 41.3%
Final simplification41.3%
(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 2024059
(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)))