
(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 90.3%
associate-*l/97.7%
Simplified97.7%
*-commutative97.7%
clear-num96.8%
un-div-inv97.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -100.0) (not (<= t 3.5e+32))) (- x (* t (/ y a))) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -100.0) || !(t <= 3.5e+32)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (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 ((t <= (-100.0d0)) .or. (.not. (t <= 3.5d+32))) then
tmp = x - (t * (y / a))
else
tmp = x + (z / (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 ((t <= -100.0) || !(t <= 3.5e+32)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -100.0) or not (t <= 3.5e+32): tmp = x - (t * (y / a)) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -100.0) || !(t <= 3.5e+32)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -100.0) || ~((t <= 3.5e+32))) tmp = x - (t * (y / a)); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -100.0], N[Not[LessEqual[t, 3.5e+32]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -100 \lor \neg \left(t \leq 3.5 \cdot 10^{+32}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -100 or 3.5000000000000001e32 < t Initial program 88.1%
+-commutative88.1%
associate-*r/89.7%
fma-def89.7%
Simplified89.7%
Taylor expanded in z around 0 78.8%
+-commutative78.8%
mul-1-neg78.8%
unsub-neg78.8%
*-commutative78.8%
associate-*r/86.7%
Simplified86.7%
if -100 < t < 3.5000000000000001e32Initial program 92.3%
+-commutative92.3%
associate-*r/94.4%
fma-def94.4%
Simplified94.4%
Taylor expanded in t around 0 88.9%
associate-*l/94.4%
*-commutative94.4%
Simplified94.4%
clear-num93.6%
un-div-inv95.2%
Applied egg-rr95.2%
Final simplification91.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -4e+162) (* t (/ (- y) a)) (if (<= t 3.5e+114) (+ x (* y (/ z a))) (* y (/ t (- a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e+162) {
tmp = t * (-y / a);
} else if (t <= 3.5e+114) {
tmp = x + (y * (z / a));
} else {
tmp = y * (t / -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 <= (-4d+162)) then
tmp = t * (-y / a)
else if (t <= 3.5d+114) then
tmp = x + (y * (z / a))
else
tmp = y * (t / -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 <= -4e+162) {
tmp = t * (-y / a);
} else if (t <= 3.5e+114) {
tmp = x + (y * (z / a));
} else {
tmp = y * (t / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4e+162: tmp = t * (-y / a) elif t <= 3.5e+114: tmp = x + (y * (z / a)) else: tmp = y * (t / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4e+162) tmp = Float64(t * Float64(Float64(-y) / a)); elseif (t <= 3.5e+114) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(y * Float64(t / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4e+162) tmp = t * (-y / a); elseif (t <= 3.5e+114) tmp = x + (y * (z / a)); else tmp = y * (t / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4e+162], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+114], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+162}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+114}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{-a}\\
\end{array}
\end{array}
if t < -3.9999999999999998e162Initial program 84.7%
+-commutative84.7%
associate-*r/84.9%
fma-def84.9%
Simplified84.9%
Taylor expanded in z around 0 81.8%
+-commutative81.8%
mul-1-neg81.8%
unsub-neg81.8%
*-commutative81.8%
associate-*r/96.0%
Simplified96.0%
clear-num93.8%
div-inv93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 60.3%
associate-/l*57.3%
associate-*r/57.3%
neg-mul-157.3%
associate-/r/71.2%
*-commutative71.2%
distribute-frac-neg71.2%
Simplified71.2%
if -3.9999999999999998e162 < t < 3.5000000000000001e114Initial program 91.5%
associate-*l/98.0%
Simplified98.0%
*-commutative98.0%
clear-num97.5%
un-div-inv98.5%
Applied egg-rr98.5%
Taylor expanded in z around inf 80.0%
associate-*r/82.6%
Simplified82.6%
if 3.5000000000000001e114 < t Initial program 87.6%
+-commutative87.6%
associate-*r/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-commutative83.8%
associate-*r/85.4%
Simplified85.4%
clear-num83.6%
div-inv83.6%
Applied egg-rr83.6%
Taylor expanded in x around 0 66.3%
associate-*r/66.3%
associate-*l/66.2%
metadata-eval66.2%
distribute-neg-frac66.2%
associate-*r*67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
metadata-eval67.9%
associate-/r*67.9%
neg-mul-167.9%
associate-/r/66.2%
*-commutative66.2%
associate-*r/66.2%
*-rgt-identity66.2%
associate-/r/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.9e+161) (* t (/ (- y) a)) (if (<= t 1.25e+116) (+ x (/ y (/ a z))) (* y (/ t (- a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.9e+161) {
tmp = t * (-y / a);
} else if (t <= 1.25e+116) {
tmp = x + (y / (a / z));
} else {
tmp = y * (t / -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 <= (-2.9d+161)) then
tmp = t * (-y / a)
else if (t <= 1.25d+116) then
tmp = x + (y / (a / z))
else
tmp = y * (t / -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 <= -2.9e+161) {
tmp = t * (-y / a);
} else if (t <= 1.25e+116) {
tmp = x + (y / (a / z));
} else {
tmp = y * (t / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.9e+161: tmp = t * (-y / a) elif t <= 1.25e+116: tmp = x + (y / (a / z)) else: tmp = y * (t / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.9e+161) tmp = Float64(t * Float64(Float64(-y) / a)); elseif (t <= 1.25e+116) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(y * Float64(t / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.9e+161) tmp = t * (-y / a); elseif (t <= 1.25e+116) tmp = x + (y / (a / z)); else tmp = y * (t / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.9e+161], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.25e+116], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+161}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+116}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{-a}\\
\end{array}
\end{array}
if t < -2.90000000000000016e161Initial program 84.7%
+-commutative84.7%
associate-*r/84.9%
fma-def84.9%
Simplified84.9%
Taylor expanded in z around 0 81.8%
+-commutative81.8%
mul-1-neg81.8%
unsub-neg81.8%
*-commutative81.8%
associate-*r/96.0%
Simplified96.0%
clear-num93.8%
div-inv93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 60.3%
associate-/l*57.3%
associate-*r/57.3%
neg-mul-157.3%
associate-/r/71.2%
*-commutative71.2%
distribute-frac-neg71.2%
Simplified71.2%
if -2.90000000000000016e161 < t < 1.25000000000000006e116Initial program 91.5%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in z around inf 83.0%
if 1.25000000000000006e116 < t Initial program 87.6%
+-commutative87.6%
associate-*r/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-commutative83.8%
associate-*r/85.4%
Simplified85.4%
clear-num83.6%
div-inv83.6%
Applied egg-rr83.6%
Taylor expanded in x around 0 66.3%
associate-*r/66.3%
associate-*l/66.2%
metadata-eval66.2%
distribute-neg-frac66.2%
associate-*r*67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
metadata-eval67.9%
associate-/r*67.9%
neg-mul-167.9%
associate-/r/66.2%
*-commutative66.2%
associate-*r/66.2%
*-rgt-identity66.2%
associate-/r/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.6e+162) (* t (/ (- y) a)) (if (<= t 1.65e+115) (+ x (* z (/ y a))) (* y (/ t (- a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.6e+162) {
tmp = t * (-y / a);
} else if (t <= 1.65e+115) {
tmp = x + (z * (y / a));
} else {
tmp = y * (t / -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 <= (-3.6d+162)) then
tmp = t * (-y / a)
else if (t <= 1.65d+115) then
tmp = x + (z * (y / a))
else
tmp = y * (t / -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 <= -3.6e+162) {
tmp = t * (-y / a);
} else if (t <= 1.65e+115) {
tmp = x + (z * (y / a));
} else {
tmp = y * (t / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.6e+162: tmp = t * (-y / a) elif t <= 1.65e+115: tmp = x + (z * (y / a)) else: tmp = y * (t / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.6e+162) tmp = Float64(t * Float64(Float64(-y) / a)); elseif (t <= 1.65e+115) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(y * Float64(t / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.6e+162) tmp = t * (-y / a); elseif (t <= 1.65e+115) tmp = x + (z * (y / a)); else tmp = y * (t / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.6e+162], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e+115], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+162}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+115}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{-a}\\
\end{array}
\end{array}
if t < -3.59999999999999994e162Initial program 84.7%
+-commutative84.7%
associate-*r/84.9%
fma-def84.9%
Simplified84.9%
Taylor expanded in z around 0 81.8%
+-commutative81.8%
mul-1-neg81.8%
unsub-neg81.8%
*-commutative81.8%
associate-*r/96.0%
Simplified96.0%
clear-num93.8%
div-inv93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 60.3%
associate-/l*57.3%
associate-*r/57.3%
neg-mul-157.3%
associate-/r/71.2%
*-commutative71.2%
distribute-frac-neg71.2%
Simplified71.2%
if -3.59999999999999994e162 < t < 1.65000000000000003e115Initial program 91.5%
+-commutative91.5%
associate-*r/92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in t around 0 80.0%
associate-*l/85.3%
*-commutative85.3%
Simplified85.3%
if 1.65000000000000003e115 < t Initial program 87.6%
+-commutative87.6%
associate-*r/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-commutative83.8%
associate-*r/85.4%
Simplified85.4%
clear-num83.6%
div-inv83.6%
Applied egg-rr83.6%
Taylor expanded in x around 0 66.3%
associate-*r/66.3%
associate-*l/66.2%
metadata-eval66.2%
distribute-neg-frac66.2%
associate-*r*67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
metadata-eval67.9%
associate-/r*67.9%
neg-mul-167.9%
associate-/r/66.2%
*-commutative66.2%
associate-*r/66.2%
*-rgt-identity66.2%
associate-/r/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification82.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -3e+162) (* t (/ (- y) a)) (if (<= t 3.5e+114) (+ x (/ z (/ a y))) (* y (/ t (- a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3e+162) {
tmp = t * (-y / a);
} else if (t <= 3.5e+114) {
tmp = x + (z / (a / y));
} else {
tmp = y * (t / -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 <= (-3d+162)) then
tmp = t * (-y / a)
else if (t <= 3.5d+114) then
tmp = x + (z / (a / y))
else
tmp = y * (t / -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 <= -3e+162) {
tmp = t * (-y / a);
} else if (t <= 3.5e+114) {
tmp = x + (z / (a / y));
} else {
tmp = y * (t / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3e+162: tmp = t * (-y / a) elif t <= 3.5e+114: tmp = x + (z / (a / y)) else: tmp = y * (t / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3e+162) tmp = Float64(t * Float64(Float64(-y) / a)); elseif (t <= 3.5e+114) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(y * Float64(t / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3e+162) tmp = t * (-y / a); elseif (t <= 3.5e+114) tmp = x + (z / (a / y)); else tmp = y * (t / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3e+162], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+114], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+162}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+114}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{-a}\\
\end{array}
\end{array}
if t < -2.9999999999999998e162Initial program 84.7%
+-commutative84.7%
associate-*r/84.9%
fma-def84.9%
Simplified84.9%
Taylor expanded in z around 0 81.8%
+-commutative81.8%
mul-1-neg81.8%
unsub-neg81.8%
*-commutative81.8%
associate-*r/96.0%
Simplified96.0%
clear-num93.8%
div-inv93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 60.3%
associate-/l*57.3%
associate-*r/57.3%
neg-mul-157.3%
associate-/r/71.2%
*-commutative71.2%
distribute-frac-neg71.2%
Simplified71.2%
if -2.9999999999999998e162 < t < 3.5000000000000001e114Initial program 91.5%
+-commutative91.5%
associate-*r/92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in t around 0 80.0%
associate-*l/85.3%
*-commutative85.3%
Simplified85.3%
clear-num84.9%
un-div-inv85.9%
Applied egg-rr85.9%
if 3.5000000000000001e114 < t Initial program 87.6%
+-commutative87.6%
associate-*r/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-commutative83.8%
associate-*r/85.4%
Simplified85.4%
clear-num83.6%
div-inv83.6%
Applied egg-rr83.6%
Taylor expanded in x around 0 66.3%
associate-*r/66.3%
associate-*l/66.2%
metadata-eval66.2%
distribute-neg-frac66.2%
associate-*r*67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
metadata-eval67.9%
associate-/r*67.9%
neg-mul-167.9%
associate-/r/66.2%
*-commutative66.2%
associate-*r/66.2%
*-rgt-identity66.2%
associate-/r/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification83.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.1e-94) x (if (<= a 2.2e-32) (* t (/ (- y) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.1e-94) {
tmp = x;
} else if (a <= 2.2e-32) {
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 <= (-4.1d-94)) then
tmp = x
else if (a <= 2.2d-32) 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 <= -4.1e-94) {
tmp = x;
} else if (a <= 2.2e-32) {
tmp = t * (-y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.1e-94: tmp = x elif a <= 2.2e-32: tmp = t * (-y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.1e-94) tmp = x; elseif (a <= 2.2e-32) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.1e-94) tmp = x; elseif (a <= 2.2e-32) tmp = t * (-y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.1e-94], x, If[LessEqual[a, 2.2e-32], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.1 \cdot 10^{-94}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{-32}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.10000000000000001e-94 or 2.2e-32 < a Initial program 84.5%
+-commutative84.5%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 59.4%
if -4.10000000000000001e-94 < a < 2.2e-32Initial program 99.8%
+-commutative99.8%
associate-*r/79.5%
fma-def79.5%
Simplified79.5%
Taylor expanded in z around 0 64.1%
+-commutative64.1%
mul-1-neg64.1%
unsub-neg64.1%
*-commutative64.1%
associate-*r/67.0%
Simplified67.0%
clear-num67.0%
div-inv67.0%
Applied egg-rr67.0%
Taylor expanded in x around 0 47.7%
associate-/l*38.3%
associate-*r/38.3%
neg-mul-138.3%
associate-/r/50.7%
*-commutative50.7%
distribute-frac-neg50.7%
Simplified50.7%
Final simplification56.1%
(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 90.3%
associate-*l/97.7%
Simplified97.7%
*-commutative97.7%
clear-num96.8%
un-div-inv97.7%
Applied egg-rr97.7%
div-inv96.8%
clear-num97.7%
Applied egg-rr97.7%
Final simplification97.7%
(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 90.3%
+-commutative90.3%
associate-*r/92.1%
fma-def92.1%
Simplified92.1%
Taylor expanded in y around 0 43.8%
Final simplification43.8%
(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 2023257
(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)))