
(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 12 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
(let* ((t_1 (* y (- z t))))
(if (or (<= t_1 -1e+287) (not (<= t_1 2e+243)))
(+ x (/ y (/ a (- z t))))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -1e+287) || !(t_1 <= 2e+243)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / 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) :: t_1
real(8) :: tmp
t_1 = y * (z - t)
if ((t_1 <= (-1d+287)) .or. (.not. (t_1 <= 2d+243))) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -1e+287) || !(t_1 <= 2e+243)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if (t_1 <= -1e+287) or not (t_1 <= 2e+243): tmp = x + (y / (a / (z - t))) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if ((t_1 <= -1e+287) || !(t_1 <= 2e+243)) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if ((t_1 <= -1e+287) || ~((t_1 <= 2e+243))) tmp = x + (y / (a / (z - t))); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+287], N[Not[LessEqual[t$95$1, 2e+243]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+287} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+243}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -1.0000000000000001e287 or 2.0000000000000001e243 < (*.f64 y (-.f64 z t)) Initial program 66.6%
associate-/l*99.8%
Simplified99.8%
if -1.0000000000000001e287 < (*.f64 y (-.f64 z t)) < 2.0000000000000001e243Initial program 99.6%
Final simplification99.7%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)
\end{array}
Initial program 90.6%
+-commutative90.6%
associate-*l/97.7%
fma-def97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t))) (t_2 (* (/ y a) z)))
(if (<= x -4.9e+79)
x
(if (<= x -7.8e-202)
t_2
(if (<= x 5.5e-195)
t_1
(if (<= x 2.6e-111) t_2 (if (<= x 3.7e+46) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -t;
double t_2 = (y / a) * z;
double tmp;
if (x <= -4.9e+79) {
tmp = x;
} else if (x <= -7.8e-202) {
tmp = t_2;
} else if (x <= 5.5e-195) {
tmp = t_1;
} else if (x <= 2.6e-111) {
tmp = t_2;
} else if (x <= 3.7e+46) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / a) * -t
t_2 = (y / a) * z
if (x <= (-4.9d+79)) then
tmp = x
else if (x <= (-7.8d-202)) then
tmp = t_2
else if (x <= 5.5d-195) then
tmp = t_1
else if (x <= 2.6d-111) then
tmp = t_2
else if (x <= 3.7d+46) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -t;
double t_2 = (y / a) * z;
double tmp;
if (x <= -4.9e+79) {
tmp = x;
} else if (x <= -7.8e-202) {
tmp = t_2;
} else if (x <= 5.5e-195) {
tmp = t_1;
} else if (x <= 2.6e-111) {
tmp = t_2;
} else if (x <= 3.7e+46) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * -t t_2 = (y / a) * z tmp = 0 if x <= -4.9e+79: tmp = x elif x <= -7.8e-202: tmp = t_2 elif x <= 5.5e-195: tmp = t_1 elif x <= 2.6e-111: tmp = t_2 elif x <= 3.7e+46: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(-t)) t_2 = Float64(Float64(y / a) * z) tmp = 0.0 if (x <= -4.9e+79) tmp = x; elseif (x <= -7.8e-202) tmp = t_2; elseif (x <= 5.5e-195) tmp = t_1; elseif (x <= 2.6e-111) tmp = t_2; elseif (x <= 3.7e+46) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * -t; t_2 = (y / a) * z; tmp = 0.0; if (x <= -4.9e+79) tmp = x; elseif (x <= -7.8e-202) tmp = t_2; elseif (x <= 5.5e-195) tmp = t_1; elseif (x <= 2.6e-111) tmp = t_2; elseif (x <= 3.7e+46) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -4.9e+79], x, If[LessEqual[x, -7.8e-202], t$95$2, If[LessEqual[x, 5.5e-195], t$95$1, If[LessEqual[x, 2.6e-111], t$95$2, If[LessEqual[x, 3.7e+46], t$95$1, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-t\right)\\
t_2 := \frac{y}{a} \cdot z\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+79}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -7.8 \cdot 10^{-202}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-195}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-111}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.8999999999999999e79 or 3.6999999999999999e46 < x Initial program 90.8%
+-commutative90.8%
associate-*l/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 61.8%
if -4.8999999999999999e79 < x < -7.7999999999999998e-202 or 5.5000000000000003e-195 < x < 2.59999999999999982e-111Initial program 90.0%
+-commutative90.0%
associate-*l/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around inf 47.2%
associate-/l*51.4%
Simplified51.4%
associate-/r/59.7%
Applied egg-rr59.7%
if -7.7999999999999998e-202 < x < 5.5000000000000003e-195 or 2.59999999999999982e-111 < x < 3.6999999999999999e46Initial program 90.7%
+-commutative90.7%
associate-*l/95.2%
fma-def95.2%
Simplified95.2%
Taylor expanded in t around inf 48.3%
associate-*r/53.7%
neg-mul-153.7%
distribute-rgt-neg-in53.7%
distribute-neg-frac53.7%
Simplified53.7%
Final simplification58.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ y a) z))))
(if (<= z -3.4e+32)
t_1
(if (<= z -1.15e-33)
(* y (/ (- z t) a))
(if (<= z 5e+138) (- x (* (/ y a) t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y / a) * z);
double tmp;
if (z <= -3.4e+32) {
tmp = t_1;
} else if (z <= -1.15e-33) {
tmp = y * ((z - t) / a);
} else if (z <= 5e+138) {
tmp = x - ((y / a) * t);
} else {
tmp = 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 = x + ((y / a) * z)
if (z <= (-3.4d+32)) then
tmp = t_1
else if (z <= (-1.15d-33)) then
tmp = y * ((z - t) / a)
else if (z <= 5d+138) then
tmp = x - ((y / a) * t)
else
tmp = 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 = x + ((y / a) * z);
double tmp;
if (z <= -3.4e+32) {
tmp = t_1;
} else if (z <= -1.15e-33) {
tmp = y * ((z - t) / a);
} else if (z <= 5e+138) {
tmp = x - ((y / a) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y / a) * z) tmp = 0 if z <= -3.4e+32: tmp = t_1 elif z <= -1.15e-33: tmp = y * ((z - t) / a) elif z <= 5e+138: tmp = x - ((y / a) * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y / a) * z)) tmp = 0.0 if (z <= -3.4e+32) tmp = t_1; elseif (z <= -1.15e-33) tmp = Float64(y * Float64(Float64(z - t) / a)); elseif (z <= 5e+138) tmp = Float64(x - Float64(Float64(y / a) * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y / a) * z); tmp = 0.0; if (z <= -3.4e+32) tmp = t_1; elseif (z <= -1.15e-33) tmp = y * ((z - t) / a); elseif (z <= 5e+138) tmp = x - ((y / a) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+32], t$95$1, If[LessEqual[z, -1.15e-33], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+138], N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{a} \cdot z\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-33}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+138}:\\
\;\;\;\;x - \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.39999999999999979e32 or 5.00000000000000016e138 < z Initial program 83.9%
+-commutative83.9%
associate-*l/97.9%
fma-def97.9%
Simplified97.9%
Taylor expanded in t around 0 82.1%
associate-/l*87.3%
associate-/r/93.4%
Applied egg-rr93.4%
if -3.39999999999999979e32 < z < -1.14999999999999993e-33Initial program 88.9%
+-commutative88.9%
associate-*l/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around inf 90.5%
div-sub96.4%
Simplified96.4%
if -1.14999999999999993e-33 < z < 5.00000000000000016e138Initial program 94.6%
associate-/l*94.2%
Simplified94.2%
clear-num94.2%
associate-/r/94.2%
Applied egg-rr94.2%
Taylor expanded in z around 0 85.5%
mul-1-neg85.5%
associate-*l/86.1%
distribute-lft-neg-in86.1%
cancel-sign-sub-inv86.1%
Simplified86.1%
Taylor expanded in t around 0 85.5%
associate-*r/89.0%
Simplified89.0%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (<= x -8.8e+132) x (if (<= x 8.4e+55) (* y (/ (- z t) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.8e+132) {
tmp = x;
} else if (x <= 8.4e+55) {
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 (x <= (-8.8d+132)) then
tmp = x
else if (x <= 8.4d+55) 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 (x <= -8.8e+132) {
tmp = x;
} else if (x <= 8.4e+55) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.8e+132: tmp = x elif x <= 8.4e+55: tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.8e+132) tmp = x; elseif (x <= 8.4e+55) 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 (x <= -8.8e+132) tmp = x; elseif (x <= 8.4e+55) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.8e+132], x, If[LessEqual[x, 8.4e+55], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+132}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+55}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.79999999999999954e132 or 8.4000000000000002e55 < x Initial program 91.5%
+-commutative91.5%
associate-*l/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 65.7%
if -8.79999999999999954e132 < x < 8.4000000000000002e55Initial program 90.0%
+-commutative90.0%
associate-*l/96.3%
fma-def96.3%
Simplified96.3%
Taylor expanded in y around inf 67.3%
div-sub70.1%
Simplified70.1%
Final simplification68.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.5e+147) (* (/ y a) (- t)) (if (<= t 2.6e+162) (+ x (* (/ y a) z)) (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.5e+147) {
tmp = (y / a) * -t;
} else if (t <= 2.6e+162) {
tmp = x + ((y / a) * z);
} else {
tmp = y * ((z - 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.5d+147)) then
tmp = (y / a) * -t
else if (t <= 2.6d+162) then
tmp = x + ((y / a) * z)
else
tmp = y * ((z - 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.5e+147) {
tmp = (y / a) * -t;
} else if (t <= 2.6e+162) {
tmp = x + ((y / a) * z);
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.5e+147: tmp = (y / a) * -t elif t <= 2.6e+162: tmp = x + ((y / a) * z) else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.5e+147) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (t <= 2.6e+162) tmp = Float64(x + Float64(Float64(y / a) * z)); else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.5e+147) tmp = (y / a) * -t; elseif (t <= 2.6e+162) tmp = x + ((y / a) * z); else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.5e+147], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[t, 2.6e+162], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+147}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+162}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if t < -2.5000000000000001e147Initial program 79.7%
+-commutative79.7%
associate-*l/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 62.3%
associate-*r/75.9%
neg-mul-175.9%
distribute-rgt-neg-in75.9%
distribute-neg-frac75.9%
Simplified75.9%
if -2.5000000000000001e147 < t < 2.6e162Initial program 93.1%
+-commutative93.1%
associate-*l/97.2%
fma-def97.2%
Simplified97.2%
Taylor expanded in t around 0 77.7%
associate-/l*78.3%
associate-/r/83.0%
Applied egg-rr83.0%
if 2.6e162 < t Initial program 82.9%
+-commutative82.9%
associate-*l/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around inf 77.7%
div-sub88.8%
Simplified88.8%
Final simplification82.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e-33) (not (<= z 1.2e+147))) (* y (/ z a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e-33) || !(z <= 1.2e+147)) {
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 ((z <= (-1.15d-33)) .or. (.not. (z <= 1.2d+147))) 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 ((z <= -1.15e-33) || !(z <= 1.2e+147)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e-33) or not (z <= 1.2e+147): tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e-33) || !(z <= 1.2e+147)) 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 ((z <= -1.15e-33) || ~((z <= 1.2e+147))) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e-33], N[Not[LessEqual[z, 1.2e+147]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-33} \lor \neg \left(z \leq 1.2 \cdot 10^{+147}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.14999999999999993e-33 or 1.20000000000000001e147 < z Initial program 84.6%
+-commutative84.6%
associate-*l/98.2%
fma-def98.2%
Simplified98.2%
Taylor expanded in z around inf 55.3%
associate-*r/59.5%
Simplified59.5%
if -1.14999999999999993e-33 < z < 1.20000000000000001e147Initial program 94.7%
+-commutative94.7%
associate-*l/97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in y around 0 50.9%
Final simplification54.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.02e-36) (not (<= z 2.7e+146))) (* (/ y a) z) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e-36) || !(z <= 2.7e+146)) {
tmp = (y / a) * z;
} 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 ((z <= (-1.02d-36)) .or. (.not. (z <= 2.7d+146))) then
tmp = (y / a) * z
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 ((z <= -1.02e-36) || !(z <= 2.7e+146)) {
tmp = (y / a) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.02e-36) or not (z <= 2.7e+146): tmp = (y / a) * z else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.02e-36) || !(z <= 2.7e+146)) tmp = Float64(Float64(y / a) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.02e-36) || ~((z <= 2.7e+146))) tmp = (y / a) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e-36], N[Not[LessEqual[z, 2.7e+146]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-36} \lor \neg \left(z \leq 2.7 \cdot 10^{+146}\right):\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.02e-36 or 2.69999999999999989e146 < z Initial program 84.6%
+-commutative84.6%
associate-*l/98.2%
fma-def98.2%
Simplified98.2%
Taylor expanded in z around inf 55.3%
associate-/l*59.8%
Simplified59.8%
associate-/r/64.1%
Applied egg-rr64.1%
if -1.02e-36 < z < 2.69999999999999989e146Initial program 94.7%
+-commutative94.7%
associate-*l/97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in y around 0 50.9%
Final simplification56.3%
(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 90.6%
associate-/l*93.4%
Simplified93.4%
Final simplification93.4%
(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.6%
*-commutative90.6%
associate-/l*97.7%
Simplified97.7%
Final simplification97.7%
(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(Float64(y / 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[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(z - t\right)
\end{array}
Initial program 90.6%
+-commutative90.6%
associate-*l/97.7%
fma-def97.7%
Simplified97.7%
fma-udef97.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.6%
+-commutative90.6%
associate-*l/97.7%
fma-def97.7%
Simplified97.7%
Taylor expanded in y around 0 39.3%
Final simplification39.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 2024036
(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)))