
(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 9 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) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
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) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 93.6%
*-commutative93.6%
associate-/l*98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.5e+197)
(/ y (/ a (- t)))
(if (<= t 1.56e+128)
(+ x (/ y (/ a z)))
(if (<= t 1.1e+287) (* t (/ y (- a))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.5e+197) {
tmp = y / (a / -t);
} else if (t <= 1.56e+128) {
tmp = x + (y / (a / z));
} else if (t <= 1.1e+287) {
tmp = t * (y / -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 (t <= (-4.5d+197)) then
tmp = y / (a / -t)
else if (t <= 1.56d+128) then
tmp = x + (y / (a / z))
else if (t <= 1.1d+287) then
tmp = t * (y / -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 (t <= -4.5e+197) {
tmp = y / (a / -t);
} else if (t <= 1.56e+128) {
tmp = x + (y / (a / z));
} else if (t <= 1.1e+287) {
tmp = t * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.5e+197: tmp = y / (a / -t) elif t <= 1.56e+128: tmp = x + (y / (a / z)) elif t <= 1.1e+287: tmp = t * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.5e+197) tmp = Float64(y / Float64(a / Float64(-t))); elseif (t <= 1.56e+128) tmp = Float64(x + Float64(y / Float64(a / z))); elseif (t <= 1.1e+287) tmp = Float64(t * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.5e+197) tmp = y / (a / -t); elseif (t <= 1.56e+128) tmp = x + (y / (a / z)); elseif (t <= 1.1e+287) tmp = t * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.5e+197], N[(y / N[(a / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.56e+128], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.1e+287], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+197}:\\
\;\;\;\;\frac{y}{\frac{a}{-t}}\\
\mathbf{elif}\;t \leq 1.56 \cdot 10^{+128}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+287}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.5000000000000003e197Initial program 89.3%
Taylor expanded in z around 0 89.3%
mul-1-neg89.3%
distribute-lft-neg-out89.3%
*-commutative89.3%
Simplified89.3%
div-inv89.2%
add-sqr-sqrt89.0%
sqrt-unprod39.6%
sqr-neg39.6%
sqrt-unprod0.0%
add-sqr-sqrt15.9%
remove-double-neg15.9%
distribute-rgt-neg-out15.9%
cancel-sign-sub-inv15.9%
div-inv15.9%
*-un-lft-identity15.9%
times-frac12.0%
/-rgt-identity12.0%
add-sqr-sqrt12.0%
sqrt-unprod0.4%
sqr-neg0.4%
sqrt-unprod0.0%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 72.6%
associate-*r/72.6%
*-commutative72.6%
neg-mul-172.6%
distribute-rgt-neg-in72.6%
associate-/l*82.9%
Simplified82.9%
if -4.5000000000000003e197 < t < 1.55999999999999992e128Initial program 94.2%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around inf 81.5%
if 1.55999999999999992e128 < t < 1.10000000000000002e287Initial program 91.2%
Taylor expanded in z around 0 82.6%
mul-1-neg82.6%
distribute-lft-neg-out82.6%
*-commutative82.6%
Simplified82.6%
div-inv82.6%
add-sqr-sqrt0.0%
sqrt-unprod6.7%
sqr-neg6.7%
sqrt-unprod24.8%
add-sqr-sqrt24.8%
remove-double-neg24.8%
distribute-rgt-neg-out24.8%
cancel-sign-sub-inv24.8%
div-inv24.8%
*-un-lft-identity24.8%
times-frac27.6%
/-rgt-identity27.6%
add-sqr-sqrt0.0%
sqrt-unprod59.5%
sqr-neg59.5%
sqrt-unprod88.4%
add-sqr-sqrt88.4%
Applied egg-rr88.4%
Taylor expanded in x around 0 62.0%
associate-*r/62.0%
*-commutative62.0%
neg-mul-162.0%
distribute-rgt-neg-in62.0%
associate-/l*64.8%
Simplified64.8%
frac-2neg64.8%
remove-double-neg64.8%
associate-/r/67.5%
Applied egg-rr67.5%
if 1.10000000000000002e287 < t Initial program 100.0%
+-commutative100.0%
associate-*r/100.0%
fma-udef100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification80.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -5.9e+197)
(/ y (/ a (- t)))
(if (<= t 1.75e+133)
(+ x (/ z (/ a y)))
(if (<= t 1.1e+287) (* t (/ y (- a))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.9e+197) {
tmp = y / (a / -t);
} else if (t <= 1.75e+133) {
tmp = x + (z / (a / y));
} else if (t <= 1.1e+287) {
tmp = t * (y / -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 (t <= (-5.9d+197)) then
tmp = y / (a / -t)
else if (t <= 1.75d+133) then
tmp = x + (z / (a / y))
else if (t <= 1.1d+287) then
tmp = t * (y / -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 (t <= -5.9e+197) {
tmp = y / (a / -t);
} else if (t <= 1.75e+133) {
tmp = x + (z / (a / y));
} else if (t <= 1.1e+287) {
tmp = t * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.9e+197: tmp = y / (a / -t) elif t <= 1.75e+133: tmp = x + (z / (a / y)) elif t <= 1.1e+287: tmp = t * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.9e+197) tmp = Float64(y / Float64(a / Float64(-t))); elseif (t <= 1.75e+133) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (t <= 1.1e+287) tmp = Float64(t * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.9e+197) tmp = y / (a / -t); elseif (t <= 1.75e+133) tmp = x + (z / (a / y)); elseif (t <= 1.1e+287) tmp = t * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.9e+197], N[(y / N[(a / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.75e+133], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.1e+287], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.9 \cdot 10^{+197}:\\
\;\;\;\;\frac{y}{\frac{a}{-t}}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{+133}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+287}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.89999999999999988e197Initial program 89.3%
Taylor expanded in z around 0 89.3%
mul-1-neg89.3%
distribute-lft-neg-out89.3%
*-commutative89.3%
Simplified89.3%
div-inv89.2%
add-sqr-sqrt89.0%
sqrt-unprod39.6%
sqr-neg39.6%
sqrt-unprod0.0%
add-sqr-sqrt15.9%
remove-double-neg15.9%
distribute-rgt-neg-out15.9%
cancel-sign-sub-inv15.9%
div-inv15.9%
*-un-lft-identity15.9%
times-frac12.0%
/-rgt-identity12.0%
add-sqr-sqrt12.0%
sqrt-unprod0.4%
sqr-neg0.4%
sqrt-unprod0.0%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 72.6%
associate-*r/72.6%
*-commutative72.6%
neg-mul-172.6%
distribute-rgt-neg-in72.6%
associate-/l*82.9%
Simplified82.9%
if -5.89999999999999988e197 < t < 1.7499999999999999e133Initial program 94.2%
+-commutative94.2%
associate-*r/96.1%
fma-udef96.1%
Simplified96.1%
Taylor expanded in t around 0 79.6%
+-commutative79.6%
associate-*r/81.5%
Simplified81.5%
associate-*r/79.6%
associate-*l/84.3%
clear-num84.3%
associate-*l/84.3%
*-un-lft-identity84.3%
Applied egg-rr84.3%
if 1.7499999999999999e133 < t < 1.10000000000000002e287Initial program 91.2%
Taylor expanded in z around 0 82.6%
mul-1-neg82.6%
distribute-lft-neg-out82.6%
*-commutative82.6%
Simplified82.6%
div-inv82.6%
add-sqr-sqrt0.0%
sqrt-unprod6.7%
sqr-neg6.7%
sqrt-unprod24.8%
add-sqr-sqrt24.8%
remove-double-neg24.8%
distribute-rgt-neg-out24.8%
cancel-sign-sub-inv24.8%
div-inv24.8%
*-un-lft-identity24.8%
times-frac27.6%
/-rgt-identity27.6%
add-sqr-sqrt0.0%
sqrt-unprod59.5%
sqr-neg59.5%
sqrt-unprod88.4%
add-sqr-sqrt88.4%
Applied egg-rr88.4%
Taylor expanded in x around 0 62.0%
associate-*r/62.0%
*-commutative62.0%
neg-mul-162.0%
distribute-rgt-neg-in62.0%
associate-/l*64.8%
Simplified64.8%
frac-2neg64.8%
remove-double-neg64.8%
associate-/r/67.5%
Applied egg-rr67.5%
if 1.10000000000000002e287 < t Initial program 100.0%
+-commutative100.0%
associate-*r/100.0%
fma-udef100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification82.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e+37) (not (<= z 1.08e-73))) (+ x (/ z (/ a y))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e+37) || !(z <= 1.08e-73)) {
tmp = x + (z / (a / y));
} 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 <= (-1.65d+37)) .or. (.not. (z <= 1.08d-73))) then
tmp = x + (z / (a / y))
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 <= -1.65e+37) || !(z <= 1.08e-73)) {
tmp = x + (z / (a / y));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e+37) or not (z <= 1.08e-73): tmp = x + (z / (a / y)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e+37) || !(z <= 1.08e-73)) tmp = Float64(x + Float64(z / Float64(a / y))); 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 <= -1.65e+37) || ~((z <= 1.08e-73))) tmp = x + (z / (a / y)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e+37], N[Not[LessEqual[z, 1.08e-73]], $MachinePrecision]], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+37} \lor \neg \left(z \leq 1.08 \cdot 10^{-73}\right):\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.65e37 or 1.08000000000000007e-73 < z Initial program 90.6%
+-commutative90.6%
associate-*r/95.6%
fma-udef95.6%
Simplified95.6%
Taylor expanded in t around 0 82.5%
+-commutative82.5%
associate-*r/85.3%
Simplified85.3%
associate-*r/82.5%
associate-*l/88.1%
clear-num88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
Applied egg-rr88.2%
if -1.65e37 < z < 1.08000000000000007e-73Initial program 96.8%
Taylor expanded in z around 0 89.4%
mul-1-neg89.4%
distribute-lft-neg-out89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in x around 0 89.4%
mul-1-neg89.4%
associate-*r/91.6%
distribute-lft-neg-in91.6%
cancel-sign-sub-inv91.6%
Simplified91.6%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+37) (not (<= z 3.15e-71))) (+ x (/ z (/ a y))) (- x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+37) || !(z <= 3.15e-71)) {
tmp = x + (z / (a / y));
} 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 <= (-9d+37)) .or. (.not. (z <= 3.15d-71))) then
tmp = x + (z / (a / y))
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 <= -9e+37) || !(z <= 3.15e-71)) {
tmp = x + (z / (a / y));
} else {
tmp = x - (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+37) or not (z <= 3.15e-71): tmp = x + (z / (a / y)) else: tmp = x - (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e+37) || !(z <= 3.15e-71)) tmp = Float64(x + Float64(z / Float64(a / y))); 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 <= -9e+37) || ~((z <= 3.15e-71))) tmp = x + (z / (a / y)); else tmp = x - (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e+37], N[Not[LessEqual[z, 3.15e-71]], $MachinePrecision]], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+37} \lor \neg \left(z \leq 3.15 \cdot 10^{-71}\right):\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -8.99999999999999923e37 or 3.1500000000000002e-71 < z Initial program 90.6%
+-commutative90.6%
associate-*r/95.6%
fma-udef95.6%
Simplified95.6%
Taylor expanded in t around 0 82.5%
+-commutative82.5%
associate-*r/85.3%
Simplified85.3%
associate-*r/82.5%
associate-*l/88.1%
clear-num88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
Applied egg-rr88.2%
if -8.99999999999999923e37 < z < 3.1500000000000002e-71Initial program 96.8%
Taylor expanded in z around 0 89.4%
mul-1-neg89.4%
distribute-lft-neg-out89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in x around 0 89.4%
mul-1-neg89.4%
associate-*r/91.6%
distribute-lft-neg-in91.6%
cancel-sign-sub-inv91.6%
Simplified91.6%
clear-num91.6%
un-div-inv91.7%
Applied egg-rr91.7%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.8e-93) x (if (<= a 2.8e-32) (* y (/ (- t) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.8e-93) {
tmp = x;
} else if (a <= 2.8e-32) {
tmp = y * (-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 (a <= (-2.8d-93)) then
tmp = x
else if (a <= 2.8d-32) then
tmp = y * (-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 (a <= -2.8e-93) {
tmp = x;
} else if (a <= 2.8e-32) {
tmp = y * (-t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.8e-93: tmp = x elif a <= 2.8e-32: tmp = y * (-t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.8e-93) tmp = x; elseif (a <= 2.8e-32) tmp = Float64(y * Float64(Float64(-t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.8e-93) tmp = x; elseif (a <= 2.8e-32) tmp = y * (-t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.8e-93], x, If[LessEqual[a, 2.8e-32], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{-32}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.79999999999999998e-93 or 2.7999999999999999e-32 < a Initial program 90.8%
+-commutative90.8%
associate-*r/98.7%
fma-udef98.7%
Simplified98.7%
Taylor expanded in y around 0 59.2%
if -2.79999999999999998e-93 < a < 2.7999999999999999e-32Initial program 98.8%
Taylor expanded in z around 0 61.4%
mul-1-neg61.4%
distribute-lft-neg-out61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
add-sqr-sqrt27.0%
sqrt-unprod34.5%
sqr-neg34.5%
sqrt-unprod12.7%
add-sqr-sqrt16.6%
remove-double-neg16.6%
distribute-rgt-neg-out16.6%
cancel-sign-sub-inv16.6%
div-inv16.6%
*-un-lft-identity16.6%
times-frac16.5%
/-rgt-identity16.5%
add-sqr-sqrt3.8%
sqrt-unprod36.2%
sqr-neg36.2%
sqrt-unprod33.3%
add-sqr-sqrt60.5%
Applied egg-rr60.5%
Taylor expanded in x around 0 50.5%
associate-*r/50.5%
*-commutative50.5%
neg-mul-150.5%
distribute-rgt-neg-in50.5%
associate-*r/49.4%
Simplified49.4%
Final simplification55.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.55e-93) x (if (<= a 4.8e-67) (* t (/ y (- a))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.55e-93) {
tmp = x;
} else if (a <= 4.8e-67) {
tmp = t * (y / -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 (a <= (-3.55d-93)) then
tmp = x
else if (a <= 4.8d-67) then
tmp = t * (y / -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 (a <= -3.55e-93) {
tmp = x;
} else if (a <= 4.8e-67) {
tmp = t * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.55e-93: tmp = x elif a <= 4.8e-67: tmp = t * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.55e-93) tmp = x; elseif (a <= 4.8e-67) tmp = Float64(t * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.55e-93) tmp = x; elseif (a <= 4.8e-67) tmp = t * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.55e-93], x, If[LessEqual[a, 4.8e-67], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.55 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-67}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.55e-93 or 4.8e-67 < a Initial program 91.2%
+-commutative91.2%
associate-*r/98.7%
fma-udef98.7%
Simplified98.7%
Taylor expanded in y around 0 57.7%
if -3.55e-93 < a < 4.8e-67Initial program 98.7%
Taylor expanded in z around 0 62.4%
mul-1-neg62.4%
distribute-lft-neg-out62.4%
*-commutative62.4%
Simplified62.4%
div-inv62.4%
add-sqr-sqrt29.7%
sqrt-unprod35.3%
sqr-neg35.3%
sqrt-unprod11.4%
add-sqr-sqrt15.6%
remove-double-neg15.6%
distribute-rgt-neg-out15.6%
cancel-sign-sub-inv15.6%
div-inv15.6%
*-un-lft-identity15.6%
times-frac15.6%
/-rgt-identity15.6%
add-sqr-sqrt4.2%
sqrt-unprod34.8%
sqr-neg34.8%
sqrt-unprod31.5%
add-sqr-sqrt61.4%
Applied egg-rr61.4%
Taylor expanded in x around 0 52.8%
associate-*r/52.8%
*-commutative52.8%
neg-mul-152.8%
distribute-rgt-neg-in52.8%
associate-/l*51.6%
Simplified51.6%
frac-2neg51.6%
remove-double-neg51.6%
associate-/r/58.6%
Applied egg-rr58.6%
Final simplification58.0%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ a (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
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 / (a / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
def code(x, y, z, t, a): return x + (y / (a / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(a / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / (a / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 93.6%
associate-/l*96.5%
Simplified96.5%
Final simplification96.5%
(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.6%
+-commutative93.6%
associate-*r/96.1%
fma-udef96.1%
Simplified96.1%
Taylor expanded in y around 0 43.3%
Final simplification43.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 2024020
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))