
(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 8 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%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* t 2.0))))
(if (<= x -1.05e+59)
t_1
(if (<= x -2.6e+26)
(* z (/ -0.5 t))
(if (<= x -6e-75)
t_1
(if (<= x -6.3e-173) (* (/ z t) -0.5) (/ y (* t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (t * 2.0);
double tmp;
if (x <= -1.05e+59) {
tmp = t_1;
} else if (x <= -2.6e+26) {
tmp = z * (-0.5 / t);
} else if (x <= -6e-75) {
tmp = t_1;
} else if (x <= -6.3e-173) {
tmp = (z / t) * -0.5;
} else {
tmp = y / (t * 2.0);
}
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 = x / (t * 2.0d0)
if (x <= (-1.05d+59)) then
tmp = t_1
else if (x <= (-2.6d+26)) then
tmp = z * ((-0.5d0) / t)
else if (x <= (-6d-75)) then
tmp = t_1
else if (x <= (-6.3d-173)) then
tmp = (z / t) * (-0.5d0)
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (t * 2.0);
double tmp;
if (x <= -1.05e+59) {
tmp = t_1;
} else if (x <= -2.6e+26) {
tmp = z * (-0.5 / t);
} else if (x <= -6e-75) {
tmp = t_1;
} else if (x <= -6.3e-173) {
tmp = (z / t) * -0.5;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (t * 2.0) tmp = 0 if x <= -1.05e+59: tmp = t_1 elif x <= -2.6e+26: tmp = z * (-0.5 / t) elif x <= -6e-75: tmp = t_1 elif x <= -6.3e-173: tmp = (z / t) * -0.5 else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(t * 2.0)) tmp = 0.0 if (x <= -1.05e+59) tmp = t_1; elseif (x <= -2.6e+26) tmp = Float64(z * Float64(-0.5 / t)); elseif (x <= -6e-75) tmp = t_1; elseif (x <= -6.3e-173) tmp = Float64(Float64(z / t) * -0.5); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (t * 2.0); tmp = 0.0; if (x <= -1.05e+59) tmp = t_1; elseif (x <= -2.6e+26) tmp = z * (-0.5 / t); elseif (x <= -6e-75) tmp = t_1; elseif (x <= -6.3e-173) tmp = (z / t) * -0.5; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e+59], t$95$1, If[LessEqual[x, -2.6e+26], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e-75], t$95$1, If[LessEqual[x, -6.3e-173], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t \cdot 2}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{+26}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -6.3 \cdot 10^{-173}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if x < -1.04999999999999992e59 or -2.60000000000000002e26 < x < -5.9999999999999997e-75Initial program 100.0%
Taylor expanded in x around inf 65.5%
if -1.04999999999999992e59 < x < -2.60000000000000002e26Initial program 100.0%
Taylor expanded in z around inf 61.4%
associate-*r/61.4%
metadata-eval61.4%
distribute-lft-neg-in61.4%
*-commutative61.4%
distribute-neg-frac61.4%
associate-*r/61.4%
distribute-rgt-neg-in61.4%
distribute-neg-frac61.4%
metadata-eval61.4%
Simplified61.4%
if -5.9999999999999997e-75 < x < -6.29999999999999968e-173Initial program 99.9%
Taylor expanded in z around inf 50.2%
*-commutative50.2%
Simplified50.2%
if -6.29999999999999968e-173 < x Initial program 100.0%
Taylor expanded in y around inf 46.3%
(FPCore (x y z t) :precision binary64 (if (<= z -3.8e+109) (* (/ z t) -0.5) (if (<= z 7e+184) (/ (+ x y) (* t 2.0)) (/ (* z -0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+109) {
tmp = (z / t) * -0.5;
} else if (z <= 7e+184) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = (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 (z <= (-3.8d+109)) then
tmp = (z / t) * (-0.5d0)
else if (z <= 7d+184) then
tmp = (x + y) / (t * 2.0d0)
else
tmp = (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 (z <= -3.8e+109) {
tmp = (z / t) * -0.5;
} else if (z <= 7e+184) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = (z * -0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.8e+109: tmp = (z / t) * -0.5 elif z <= 7e+184: tmp = (x + y) / (t * 2.0) else: tmp = (z * -0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e+109) tmp = Float64(Float64(z / t) * -0.5); elseif (z <= 7e+184) tmp = Float64(Float64(x + y) / Float64(t * 2.0)); else tmp = Float64(Float64(z * -0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.8e+109) tmp = (z / t) * -0.5; elseif (z <= 7e+184) tmp = (x + y) / (t * 2.0); else tmp = (z * -0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e+109], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[z, 7e+184], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+109}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+184}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\end{array}
\end{array}
if z < -3.80000000000000039e109Initial program 100.0%
Taylor expanded in z around inf 76.4%
*-commutative76.4%
Simplified76.4%
if -3.80000000000000039e109 < z < 6.99999999999999956e184Initial program 100.0%
Taylor expanded in z around 0 84.9%
+-commutative84.9%
Simplified84.9%
if 6.99999999999999956e184 < z Initial program 100.0%
Taylor expanded in x around 0 89.1%
distribute-lft-out89.1%
Simplified89.1%
Taylor expanded in z around inf 77.1%
associate-*r/81.8%
*-commutative81.8%
Simplified81.8%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e-11) (not (<= z 1.6e+31))) (* z (/ -0.5 t)) (* x (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-11) || !(z <= 1.6e+31)) {
tmp = z * (-0.5 / t);
} else {
tmp = x * (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 ((z <= (-4.8d-11)) .or. (.not. (z <= 1.6d+31))) then
tmp = z * ((-0.5d0) / t)
else
tmp = x * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-11) || !(z <= 1.6e+31)) {
tmp = z * (-0.5 / t);
} else {
tmp = x * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e-11) or not (z <= 1.6e+31): tmp = z * (-0.5 / t) else: tmp = x * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e-11) || !(z <= 1.6e+31)) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(x * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e-11) || ~((z <= 1.6e+31))) tmp = z * (-0.5 / t); else tmp = x * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e-11], N[Not[LessEqual[z, 1.6e+31]], $MachinePrecision]], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-11} \lor \neg \left(z \leq 1.6 \cdot 10^{+31}\right):\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if z < -4.8000000000000002e-11 or 1.6e31 < z Initial program 100.0%
Taylor expanded in z around inf 63.3%
associate-*r/64.1%
metadata-eval64.1%
distribute-lft-neg-in64.1%
*-commutative64.1%
distribute-neg-frac64.1%
associate-*r/63.9%
distribute-rgt-neg-in63.9%
distribute-neg-frac63.9%
metadata-eval63.9%
Simplified63.9%
if -4.8000000000000002e-11 < z < 1.6e31Initial program 100.0%
Taylor expanded in x around 0 97.4%
distribute-lft-out97.4%
Simplified97.4%
Taylor expanded in x around inf 52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.4%
Simplified52.4%
Final simplification56.9%
(FPCore (x y z t) :precision binary64 (if (<= z -3.3e-11) (* (/ z t) -0.5) (if (<= z 1.2e+35) (/ x (* t 2.0)) (* z (/ -0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e-11) {
tmp = (z / t) * -0.5;
} else if (z <= 1.2e+35) {
tmp = x / (t * 2.0);
} else {
tmp = 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 (z <= (-3.3d-11)) then
tmp = (z / t) * (-0.5d0)
else if (z <= 1.2d+35) then
tmp = x / (t * 2.0d0)
else
tmp = 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 (z <= -3.3e-11) {
tmp = (z / t) * -0.5;
} else if (z <= 1.2e+35) {
tmp = x / (t * 2.0);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.3e-11: tmp = (z / t) * -0.5 elif z <= 1.2e+35: tmp = x / (t * 2.0) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.3e-11) tmp = Float64(Float64(z / t) * -0.5); elseif (z <= 1.2e+35) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(z * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.3e-11) tmp = (z / t) * -0.5; elseif (z <= 1.2e+35) tmp = x / (t * 2.0); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.3e-11], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[z, 1.2e+35], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if z < -3.3000000000000002e-11Initial program 100.0%
Taylor expanded in z around inf 67.3%
*-commutative67.3%
Simplified67.3%
if -3.3000000000000002e-11 < z < 1.20000000000000007e35Initial program 100.0%
Taylor expanded in x around inf 52.5%
if 1.20000000000000007e35 < z Initial program 100.0%
Taylor expanded in z around inf 59.1%
associate-*r/60.6%
metadata-eval60.6%
distribute-lft-neg-in60.6%
*-commutative60.6%
distribute-neg-frac60.6%
associate-*r/60.5%
distribute-rgt-neg-in60.5%
distribute-neg-frac60.5%
metadata-eval60.5%
Simplified60.5%
(FPCore (x y z t) :precision binary64 (if (<= z -8.2e-11) (* (/ z t) -0.5) (if (<= z 7.5e+33) (* x (/ 0.5 t)) (* z (/ -0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.2e-11) {
tmp = (z / t) * -0.5;
} else if (z <= 7.5e+33) {
tmp = x * (0.5 / t);
} else {
tmp = 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 (z <= (-8.2d-11)) then
tmp = (z / t) * (-0.5d0)
else if (z <= 7.5d+33) then
tmp = x * (0.5d0 / t)
else
tmp = 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 (z <= -8.2e-11) {
tmp = (z / t) * -0.5;
} else if (z <= 7.5e+33) {
tmp = x * (0.5 / t);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.2e-11: tmp = (z / t) * -0.5 elif z <= 7.5e+33: tmp = x * (0.5 / t) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.2e-11) tmp = Float64(Float64(z / t) * -0.5); elseif (z <= 7.5e+33) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(z * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.2e-11) tmp = (z / t) * -0.5; elseif (z <= 7.5e+33) tmp = x * (0.5 / t); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.2e-11], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[z, 7.5e+33], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-11}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if z < -8.2000000000000001e-11Initial program 100.0%
Taylor expanded in z around inf 67.3%
*-commutative67.3%
Simplified67.3%
if -8.2000000000000001e-11 < z < 7.50000000000000046e33Initial program 100.0%
Taylor expanded in x around 0 97.4%
distribute-lft-out97.4%
Simplified97.4%
Taylor expanded in x around inf 52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.4%
Simplified52.4%
if 7.50000000000000046e33 < z Initial program 100.0%
Taylor expanded in z around inf 59.1%
associate-*r/60.6%
metadata-eval60.6%
distribute-lft-neg-in60.6%
*-commutative60.6%
distribute-neg-frac60.6%
associate-*r/60.5%
distribute-rgt-neg-in60.5%
distribute-neg-frac60.5%
metadata-eval60.5%
Simplified60.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.9e-75) (/ (+ x y) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.9e-75) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
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 (x <= (-1.9d-75)) then
tmp = (x + y) / (t * 2.0d0)
else
tmp = (y - z) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.9e-75) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.9e-75: tmp = (x + y) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.9e-75) tmp = Float64(Float64(x + y) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.9e-75) tmp = (x + y) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.9e-75], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-75}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if x < -1.89999999999999997e-75Initial program 100.0%
Taylor expanded in z around 0 85.7%
+-commutative85.7%
Simplified85.7%
if -1.89999999999999997e-75 < x Initial program 100.0%
Taylor expanded in x around 0 78.1%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (* x (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return x * (0.5 / 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 = x * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return x * (0.5 / t);
}
def code(x, y, z, t): return x * (0.5 / t)
function code(x, y, z, t) return Float64(x * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = x * (0.5 / t); end
code[x_, y_, z_, t_] := N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 97.0%
distribute-lft-out97.0%
Simplified97.0%
Taylor expanded in x around inf 43.0%
associate-*r/43.0%
*-commutative43.0%
associate-*r/42.9%
Simplified42.9%
herbie shell --seed 2024084
(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)))