
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ x t))))
(if (<= y -2.5e-223)
t_1
(if (<= y 1.3e-202)
(/ (* z -0.5) t)
(if (<= y 8.5e-38) t_1 (/ (* y 0.5) t))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (x / t);
double tmp;
if (y <= -2.5e-223) {
tmp = t_1;
} else if (y <= 1.3e-202) {
tmp = (z * -0.5) / t;
} else if (y <= 8.5e-38) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * (x / t)
if (y <= (-2.5d-223)) then
tmp = t_1
else if (y <= 1.3d-202) then
tmp = (z * (-0.5d0)) / t
else if (y <= 8.5d-38) then
tmp = t_1
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (x / t);
double tmp;
if (y <= -2.5e-223) {
tmp = t_1;
} else if (y <= 1.3e-202) {
tmp = (z * -0.5) / t;
} else if (y <= 8.5e-38) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (x / t) tmp = 0 if y <= -2.5e-223: tmp = t_1 elif y <= 1.3e-202: tmp = (z * -0.5) / t elif y <= 8.5e-38: tmp = t_1 else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(x / t)) tmp = 0.0 if (y <= -2.5e-223) tmp = t_1; elseif (y <= 1.3e-202) tmp = Float64(Float64(z * -0.5) / t); elseif (y <= 8.5e-38) tmp = t_1; else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (x / t); tmp = 0.0; if (y <= -2.5e-223) tmp = t_1; elseif (y <= 1.3e-202) tmp = (z * -0.5) / t; elseif (y <= 8.5e-38) tmp = t_1; else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.5e-223], t$95$1, If[LessEqual[y, 1.3e-202], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 8.5e-38], t$95$1, N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x}{t}\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-202}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if y < -2.50000000000000012e-223 or 1.30000000000000005e-202 < y < 8.50000000000000046e-38Initial program 100.0%
Taylor expanded in x around inf 38.2%
if -2.50000000000000012e-223 < y < 1.30000000000000005e-202Initial program 100.0%
Taylor expanded in z around inf 58.1%
*-commutative58.1%
associate-*l/58.1%
Simplified58.1%
if 8.50000000000000046e-38 < y Initial program 99.9%
Taylor expanded in y around inf 72.9%
associate-*r/72.9%
Simplified72.9%
Final simplification51.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3e+129) (not (<= z 4.6e+132))) (/ (* z -0.5) t) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3e+129) || !(z <= 4.6e+132)) {
tmp = (z * -0.5) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3d+129)) .or. (.not. (z <= 4.6d+132))) then
tmp = (z * (-0.5d0)) / t
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3e+129) || !(z <= 4.6e+132)) {
tmp = (z * -0.5) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3e+129) or not (z <= 4.6e+132): tmp = (z * -0.5) / t else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3e+129) || !(z <= 4.6e+132)) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3e+129) || ~((z <= 4.6e+132))) tmp = (z * -0.5) / t; else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3e+129], N[Not[LessEqual[z, 4.6e+132]], $MachinePrecision]], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+129} \lor \neg \left(z \leq 4.6 \cdot 10^{+132}\right):\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -3.0000000000000003e129 or 4.6000000000000003e132 < z Initial program 99.9%
Taylor expanded in z around inf 85.2%
*-commutative85.2%
associate-*l/85.2%
Simplified85.2%
if -3.0000000000000003e129 < z < 4.6000000000000003e132Initial program 100.0%
Taylor expanded in z around 0 87.6%
+-commutative87.6%
Simplified87.6%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (<= y 9e-38) (/ (* 0.5 (- x z)) t) (/ 1.0 (/ t (* 0.5 (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = (0.5 * (x - z)) / t;
} else {
tmp = 1.0 / (t / (0.5 * (y - z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 9d-38) then
tmp = (0.5d0 * (x - z)) / t
else
tmp = 1.0d0 / (t / (0.5d0 * (y - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = (0.5 * (x - z)) / t;
} else {
tmp = 1.0 / (t / (0.5 * (y - z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9e-38: tmp = (0.5 * (x - z)) / t else: tmp = 1.0 / (t / (0.5 * (y - z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9e-38) tmp = Float64(Float64(0.5 * Float64(x - z)) / t); else tmp = Float64(1.0 / Float64(t / Float64(0.5 * Float64(y - z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9e-38) tmp = (0.5 * (x - z)) / t; else tmp = 1.0 / (t / (0.5 * (y - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9e-38], N[(N[(0.5 * N[(x - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(1.0 / N[(t / N[(0.5 * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-38}:\\
\;\;\;\;\frac{0.5 \cdot \left(x - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t}{0.5 \cdot \left(y - z\right)}}\\
\end{array}
\end{array}
if y < 9.00000000000000018e-38Initial program 100.0%
Taylor expanded in y around 0 97.2%
Taylor expanded in y around 0 76.7%
associate-*r/76.7%
Simplified76.7%
if 9.00000000000000018e-38 < y Initial program 99.9%
Taylor expanded in x around 0 84.0%
*-commutative84.0%
associate-*l/84.0%
associate-*r/83.7%
Simplified83.7%
associate-*r/84.0%
clear-num83.8%
Applied egg-rr83.8%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (<= y 7e+16) (* (- x z) (/ 0.5 t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7e+16) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7d+16) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7e+16) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7e+16: tmp = (x - z) * (0.5 / t) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7e+16) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7e+16) tmp = (x - z) * (0.5 / t); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7e+16], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{+16}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if y < 7e16Initial program 100.0%
Taylor expanded in y around 0 76.7%
*-commutative76.7%
associate-*l/76.7%
associate-/l*76.5%
Simplified76.5%
if 7e16 < y Initial program 99.9%
Taylor expanded in z around 0 94.3%
+-commutative94.3%
Simplified94.3%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= y 9e-38) (* (- x z) (/ 0.5 t)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 9d-38) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = (y - z) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9e-38: tmp = (x - z) * (0.5 / t) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9e-38) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9e-38) tmp = (x - z) * (0.5 / t); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9e-38], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-38}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 9.00000000000000018e-38Initial program 100.0%
Taylor expanded in y around 0 76.7%
*-commutative76.7%
associate-*l/76.7%
associate-/l*76.5%
Simplified76.5%
if 9.00000000000000018e-38 < y Initial program 99.9%
Taylor expanded in x around 0 84.0%
*-commutative84.0%
associate-*l/84.0%
associate-*r/83.7%
Simplified83.7%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (<= y 4.6e-38) (/ (* 0.5 (- x z)) t) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-38) {
tmp = (0.5 * (x - z)) / t;
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.6d-38) then
tmp = (0.5d0 * (x - z)) / t
else
tmp = (y - z) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-38) {
tmp = (0.5 * (x - z)) / t;
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.6e-38: tmp = (0.5 * (x - z)) / t else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.6e-38) tmp = Float64(Float64(0.5 * Float64(x - z)) / t); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.6e-38) tmp = (0.5 * (x - z)) / t; else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.6e-38], N[(N[(0.5 * N[(x - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{-38}:\\
\;\;\;\;\frac{0.5 \cdot \left(x - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 4.60000000000000003e-38Initial program 100.0%
Taylor expanded in y around 0 97.2%
Taylor expanded in y around 0 76.7%
associate-*r/76.7%
Simplified76.7%
if 4.60000000000000003e-38 < y Initial program 99.9%
Taylor expanded in x around 0 84.0%
*-commutative84.0%
associate-*l/84.0%
associate-*r/83.7%
Simplified83.7%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (<= y 8e-38) (* 0.5 (/ x t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e-38) {
tmp = 0.5 * (x / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 8d-38) then
tmp = 0.5d0 * (x / t)
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e-38) {
tmp = 0.5 * (x / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 8e-38: tmp = 0.5 * (x / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 8e-38) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 8e-38) tmp = 0.5 * (x / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 8e-38], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-38}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 7.9999999999999997e-38Initial program 100.0%
Taylor expanded in x around inf 39.3%
if 7.9999999999999997e-38 < y Initial program 99.9%
Taylor expanded in x around 0 84.0%
*-commutative84.0%
associate-*l/84.0%
associate-*r/83.7%
Simplified83.7%
Taylor expanded in y around inf 72.9%
associate-*r/72.9%
associate-*l/72.6%
*-commutative72.6%
Simplified72.6%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (if (<= y 9e-38) (* 0.5 (/ x t)) (/ (* y 0.5) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = 0.5 * (x / t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 9d-38) then
tmp = 0.5d0 * (x / t)
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-38) {
tmp = 0.5 * (x / t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9e-38: tmp = 0.5 * (x / t) else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9e-38) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9e-38) tmp = 0.5 * (x / t); else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9e-38], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-38}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if y < 9.00000000000000018e-38Initial program 100.0%
Taylor expanded in x around inf 39.3%
if 9.00000000000000018e-38 < y Initial program 99.9%
Taylor expanded in y around inf 72.9%
associate-*r/72.9%
Simplified72.9%
Final simplification49.0%
(FPCore (x y z t) :precision binary64 (* 0.5 (/ x t)))
double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * (x / t)
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
def code(x, y, z, t): return 0.5 * (x / t)
function code(x, y, z, t) return Float64(0.5 * Float64(x / t)) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x / t); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{x}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 33.4%
Final simplification33.4%
herbie shell --seed 2024067
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
:precision binary64
(/ (- (+ x y) z) (* t 2.0)))