
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 93.2%
*-commutative93.2%
associate-/l*98.0%
Applied egg-rr98.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) y)) (t_2 (/ y (/ a z))))
(if (<= z -8.8e+32)
t_2
(if (<= z 8.5e-267)
(/ (* t y) (- a))
(if (<= z 1.4e-132)
t_1
(if (<= z 5e-43) (* t (/ y (- a))) (if (<= z 2e+94) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / y;
double t_2 = y / (a / z);
double tmp;
if (z <= -8.8e+32) {
tmp = t_2;
} else if (z <= 8.5e-267) {
tmp = (t * y) / -a;
} else if (z <= 1.4e-132) {
tmp = t_1;
} else if (z <= 5e-43) {
tmp = t * (y / -a);
} else if (z <= 2e+94) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) / y
t_2 = y / (a / z)
if (z <= (-8.8d+32)) then
tmp = t_2
else if (z <= 8.5d-267) then
tmp = (t * y) / -a
else if (z <= 1.4d-132) then
tmp = t_1
else if (z <= 5d-43) then
tmp = t * (y / -a)
else if (z <= 2d+94) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / y;
double t_2 = y / (a / z);
double tmp;
if (z <= -8.8e+32) {
tmp = t_2;
} else if (z <= 8.5e-267) {
tmp = (t * y) / -a;
} else if (z <= 1.4e-132) {
tmp = t_1;
} else if (z <= 5e-43) {
tmp = t * (y / -a);
} else if (z <= 2e+94) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) / y t_2 = y / (a / z) tmp = 0 if z <= -8.8e+32: tmp = t_2 elif z <= 8.5e-267: tmp = (t * y) / -a elif z <= 1.4e-132: tmp = t_1 elif z <= 5e-43: tmp = t * (y / -a) elif z <= 2e+94: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / y) t_2 = Float64(y / Float64(a / z)) tmp = 0.0 if (z <= -8.8e+32) tmp = t_2; elseif (z <= 8.5e-267) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (z <= 1.4e-132) tmp = t_1; elseif (z <= 5e-43) tmp = Float64(t * Float64(y / Float64(-a))); elseif (z <= 2e+94) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) / y; t_2 = y / (a / z); tmp = 0.0; if (z <= -8.8e+32) tmp = t_2; elseif (z <= 8.5e-267) tmp = (t * y) / -a; elseif (z <= 1.4e-132) tmp = t_1; elseif (z <= 5e-43) tmp = t * (y / -a); elseif (z <= 2e+94) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.8e+32], t$95$2, If[LessEqual[z, 8.5e-267], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, 1.4e-132], t$95$1, If[LessEqual[z, 5e-43], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+94], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{y}\\
t_2 := \frac{y}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-267}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-43}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -8.80000000000000004e32 or 2e94 < z Initial program 89.6%
associate-/l*93.9%
Simplified93.9%
Taylor expanded in y around inf 81.8%
associate--l+81.8%
div-sub85.4%
Simplified85.4%
Taylor expanded in z around inf 61.7%
clear-num61.7%
un-div-inv61.7%
Applied egg-rr61.7%
if -8.80000000000000004e32 < z < 8.49999999999999987e-267Initial program 97.0%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in y around inf 89.3%
associate--l+89.3%
div-sub89.3%
Simplified89.3%
Taylor expanded in t around inf 60.1%
associate-*r/60.1%
mul-1-neg60.1%
Simplified60.1%
*-commutative60.1%
distribute-frac-neg60.1%
distribute-frac-neg260.1%
associate-*l/62.9%
Applied egg-rr62.9%
if 8.49999999999999987e-267 < z < 1.40000000000000001e-132 or 5.00000000000000019e-43 < z < 2e94Initial program 94.6%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in y around inf 75.5%
associate--l+75.5%
div-sub75.5%
Simplified75.5%
Taylor expanded in x around inf 34.3%
associate-*r/56.5%
Applied egg-rr56.5%
if 1.40000000000000001e-132 < z < 5.00000000000000019e-43Initial program 95.1%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in y around inf 80.5%
associate--l+80.5%
div-sub80.5%
Simplified80.5%
Taylor expanded in t around inf 56.6%
associate-*r/56.6%
mul-1-neg56.6%
Simplified56.6%
*-commutative56.6%
distribute-frac-neg56.6%
distribute-lft-neg-out56.6%
div-inv56.7%
add-sqr-sqrt15.9%
sqrt-unprod16.6%
sqr-neg16.6%
sqrt-unprod0.9%
add-sqr-sqrt1.6%
associate-*l*1.6%
associate-/r/1.6%
clear-num1.6%
add-sqr-sqrt0.8%
sqrt-unprod21.3%
sqr-neg21.3%
sqrt-unprod25.1%
add-sqr-sqrt70.7%
Applied egg-rr70.7%
Final simplification61.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ y (- a)))) (t_2 (/ (* x y) y)) (t_3 (/ y (/ a z))))
(if (<= z -5.9e+31)
t_3
(if (<= z 3.3e-267)
t_1
(if (<= z 7.5e-133)
t_2
(if (<= z 6.4e-44) t_1 (if (<= z 3.15e+93) t_2 t_3)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / -a);
double t_2 = (x * y) / y;
double t_3 = y / (a / z);
double tmp;
if (z <= -5.9e+31) {
tmp = t_3;
} else if (z <= 3.3e-267) {
tmp = t_1;
} else if (z <= 7.5e-133) {
tmp = t_2;
} else if (z <= 6.4e-44) {
tmp = t_1;
} else if (z <= 3.15e+93) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = t * (y / -a)
t_2 = (x * y) / y
t_3 = y / (a / z)
if (z <= (-5.9d+31)) then
tmp = t_3
else if (z <= 3.3d-267) then
tmp = t_1
else if (z <= 7.5d-133) then
tmp = t_2
else if (z <= 6.4d-44) then
tmp = t_1
else if (z <= 3.15d+93) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / -a);
double t_2 = (x * y) / y;
double t_3 = y / (a / z);
double tmp;
if (z <= -5.9e+31) {
tmp = t_3;
} else if (z <= 3.3e-267) {
tmp = t_1;
} else if (z <= 7.5e-133) {
tmp = t_2;
} else if (z <= 6.4e-44) {
tmp = t_1;
} else if (z <= 3.15e+93) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (y / -a) t_2 = (x * y) / y t_3 = y / (a / z) tmp = 0 if z <= -5.9e+31: tmp = t_3 elif z <= 3.3e-267: tmp = t_1 elif z <= 7.5e-133: tmp = t_2 elif z <= 6.4e-44: tmp = t_1 elif z <= 3.15e+93: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(y / Float64(-a))) t_2 = Float64(Float64(x * y) / y) t_3 = Float64(y / Float64(a / z)) tmp = 0.0 if (z <= -5.9e+31) tmp = t_3; elseif (z <= 3.3e-267) tmp = t_1; elseif (z <= 7.5e-133) tmp = t_2; elseif (z <= 6.4e-44) tmp = t_1; elseif (z <= 3.15e+93) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (y / -a); t_2 = (x * y) / y; t_3 = y / (a / z); tmp = 0.0; if (z <= -5.9e+31) tmp = t_3; elseif (z <= 3.3e-267) tmp = t_1; elseif (z <= 7.5e-133) tmp = t_2; elseif (z <= 6.4e-44) tmp = t_1; elseif (z <= 3.15e+93) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$3 = N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.9e+31], t$95$3, If[LessEqual[z, 3.3e-267], t$95$1, If[LessEqual[z, 7.5e-133], t$95$2, If[LessEqual[z, 6.4e-44], t$95$1, If[LessEqual[z, 3.15e+93], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{-a}\\
t_2 := \frac{x \cdot y}{y}\\
t_3 := \frac{y}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -5.9 \cdot 10^{+31}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-267}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-133}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.15 \cdot 10^{+93}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if z < -5.9000000000000004e31 or 3.14999999999999993e93 < z Initial program 89.6%
associate-/l*93.9%
Simplified93.9%
Taylor expanded in y around inf 81.8%
associate--l+81.8%
div-sub85.4%
Simplified85.4%
Taylor expanded in z around inf 61.7%
clear-num61.7%
un-div-inv61.7%
Applied egg-rr61.7%
if -5.9000000000000004e31 < z < 3.30000000000000004e-267 or 7.4999999999999999e-133 < z < 6.3999999999999999e-44Initial program 96.6%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in y around inf 87.4%
associate--l+87.4%
div-sub87.4%
Simplified87.4%
Taylor expanded in t around inf 59.3%
associate-*r/59.3%
mul-1-neg59.3%
Simplified59.3%
*-commutative59.3%
distribute-frac-neg59.3%
distribute-lft-neg-out59.3%
div-inv59.2%
add-sqr-sqrt24.0%
sqrt-unprod23.5%
sqr-neg23.5%
sqrt-unprod0.9%
add-sqr-sqrt1.6%
associate-*l*2.7%
associate-/r/2.7%
clear-num2.7%
add-sqr-sqrt2.0%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod28.0%
add-sqr-sqrt64.5%
Applied egg-rr64.5%
if 3.30000000000000004e-267 < z < 7.4999999999999999e-133 or 6.3999999999999999e-44 < z < 3.14999999999999993e93Initial program 94.6%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in y around inf 75.5%
associate--l+75.5%
div-sub75.5%
Simplified75.5%
Taylor expanded in x around inf 34.3%
associate-*r/56.5%
Applied egg-rr56.5%
Final simplification61.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.1e+31) (not (<= z 1.25e+26))) (+ x (* z (/ y a))) (- x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.1e+31) || !(z <= 1.25e+26)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7.1d+31)) .or. (.not. (z <= 1.25d+26))) then
tmp = x + (z * (y / a))
else
tmp = x - (t / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.1e+31) || !(z <= 1.25e+26)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.1e+31) or not (z <= 1.25e+26): tmp = x + (z * (y / a)) else: tmp = x - (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.1e+31) || !(z <= 1.25e+26)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.1e+31) || ~((z <= 1.25e+26))) tmp = x + (z * (y / a)); else tmp = x - (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.1e+31], N[Not[LessEqual[z, 1.25e+26]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+31} \lor \neg \left(z \leq 1.25 \cdot 10^{+26}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -7.09999999999999961e31 or 1.25e26 < z Initial program 90.2%
*-commutative90.2%
associate-/l*99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 79.3%
associate-*l/85.3%
*-commutative85.3%
Simplified85.3%
if -7.09999999999999961e31 < z < 1.25e26Initial program 96.1%
*-commutative96.1%
associate-/l*96.9%
Applied egg-rr96.9%
Taylor expanded in z around 0 90.7%
associate-*l/87.0%
*-commutative87.0%
neg-mul-187.0%
sub-neg87.0%
associate-*r/90.7%
associate-*l/90.5%
*-commutative90.5%
Simplified90.5%
clear-num90.4%
un-div-inv91.2%
Applied egg-rr91.2%
Final simplification88.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.1e+31) (not (<= z 9e+25))) (+ x (* z (/ y a))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.1e+31) || !(z <= 9e+25)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.1d+31)) .or. (.not. (z <= 9d+25))) then
tmp = x + (z * (y / a))
else
tmp = x - (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.1e+31) || !(z <= 9e+25)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.1e+31) or not (z <= 9e+25): tmp = x + (z * (y / a)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.1e+31) || !(z <= 9e+25)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.1e+31) || ~((z <= 9e+25))) tmp = x + (z * (y / a)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.1e+31], N[Not[LessEqual[z, 9e+25]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31} \lor \neg \left(z \leq 9 \cdot 10^{+25}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 9.0000000000000006e25 < z Initial program 90.2%
*-commutative90.2%
associate-/l*99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 79.3%
associate-*l/85.3%
*-commutative85.3%
Simplified85.3%
if -3.1000000000000002e31 < z < 9.0000000000000006e25Initial program 96.1%
*-commutative96.1%
associate-/l*96.9%
Applied egg-rr96.9%
Taylor expanded in z around 0 90.7%
associate-*l/87.0%
*-commutative87.0%
neg-mul-187.0%
sub-neg87.0%
associate-*r/90.7%
associate-*l/90.5%
*-commutative90.5%
Simplified90.5%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.5e+73) (not (<= t 8.2e+51))) (* y (/ (- z t) a)) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+73) || !(t <= 8.2e+51)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-7.5d+73)) .or. (.not. (t <= 8.2d+51))) then
tmp = y * ((z - t) / a)
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+73) || !(t <= 8.2e+51)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -7.5e+73) or not (t <= 8.2e+51): tmp = y * ((z - t) / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.5e+73) || !(t <= 8.2e+51)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -7.5e+73) || ~((t <= 8.2e+51))) tmp = y * ((z - t) / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.5e+73], N[Not[LessEqual[t, 8.2e+51]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+73} \lor \neg \left(t \leq 8.2 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -7.5e73 or 8.20000000000000021e51 < t Initial program 92.1%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in y around inf 82.9%
associate--l+82.9%
div-sub86.6%
Simplified86.6%
Taylor expanded in x around 0 69.6%
div-sub73.4%
Simplified73.4%
if -7.5e73 < t < 8.20000000000000021e51Initial program 93.9%
*-commutative93.9%
associate-/l*97.9%
Applied egg-rr97.9%
Taylor expanded in z around inf 81.8%
associate-*l/87.2%
*-commutative87.2%
Simplified87.2%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.8e-187) (not (<= y 9e-104))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.8e-187) || !(y <= 9e-104)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-7.8d-187)) .or. (.not. (y <= 9d-104))) then
tmp = y * ((z - t) / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.8e-187) || !(y <= 9e-104)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -7.8e-187) or not (y <= 9e-104): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.8e-187) || !(y <= 9e-104)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -7.8e-187) || ~((y <= 9e-104))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.8e-187], N[Not[LessEqual[y, 9e-104]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-187} \lor \neg \left(y \leq 9 \cdot 10^{-104}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.7999999999999998e-187 or 8.9999999999999995e-104 < y Initial program 91.5%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in y around inf 92.8%
associate--l+92.8%
div-sub94.9%
Simplified94.9%
Taylor expanded in x around 0 74.9%
div-sub77.0%
Simplified77.0%
if -7.7999999999999998e-187 < y < 8.9999999999999995e-104Initial program 98.0%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in x around inf 68.2%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.55e-46) (not (<= y 2.1e-102))) (* y (/ z a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.55e-46) || !(y <= 2.1e-102)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.55d-46)) .or. (.not. (y <= 2.1d-102))) then
tmp = y * (z / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.55e-46) || !(y <= 2.1e-102)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.55e-46) or not (y <= 2.1e-102): tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.55e-46) || !(y <= 2.1e-102)) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.55e-46) || ~((y <= 2.1e-102))) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.55e-46], N[Not[LessEqual[y, 2.1e-102]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{-46} \lor \neg \left(y \leq 2.1 \cdot 10^{-102}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.55e-46 or 2.1e-102 < y Initial program 89.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 97.2%
associate--l+97.2%
div-sub99.9%
Simplified99.9%
Taylor expanded in z around inf 48.5%
if -1.55e-46 < y < 2.1e-102Initial program 98.7%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in x around inf 54.9%
Final simplification51.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -4.5e-46) (* y (/ z a)) (if (<= y 9.2e-103) x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e-46) {
tmp = y * (z / a);
} else if (y <= 9.2e-103) {
tmp = x;
} else {
tmp = y / (a / z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-4.5d-46)) then
tmp = y * (z / a)
else if (y <= 9.2d-103) then
tmp = x
else
tmp = y / (a / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e-46) {
tmp = y * (z / a);
} else if (y <= 9.2e-103) {
tmp = x;
} else {
tmp = y / (a / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.5e-46: tmp = y * (z / a) elif y <= 9.2e-103: tmp = x else: tmp = y / (a / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.5e-46) tmp = Float64(y * Float64(z / a)); elseif (y <= 9.2e-103) tmp = x; else tmp = Float64(y / Float64(a / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -4.5e-46) tmp = y * (z / a); elseif (y <= 9.2e-103) tmp = x; else tmp = y / (a / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.5e-46], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e-103], x, N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-46}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if y < -4.50000000000000001e-46Initial program 93.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 95.5%
associate--l+95.5%
div-sub99.9%
Simplified99.9%
Taylor expanded in z around inf 43.9%
if -4.50000000000000001e-46 < y < 9.2000000000000003e-103Initial program 98.7%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in x around inf 54.9%
if 9.2000000000000003e-103 < y Initial program 86.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 98.6%
associate--l+98.6%
div-sub99.8%
Simplified99.8%
Taylor expanded in z around inf 52.3%
clear-num52.3%
un-div-inv52.4%
Applied egg-rr52.4%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / a));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 93.2%
associate-/l*92.2%
Simplified92.2%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.2%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in x around inf 32.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024146
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t)))))))
(+ x (/ (* y (- z t)) a)))