
(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 11 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 (if (<= y -1.15e-300) (/ x (* t 2.0)) (if (<= y 2.7e+69) (/ (* z -0.5) t) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e-300) {
tmp = x / (t * 2.0);
} else if (y <= 2.7e+69) {
tmp = (z * -0.5) / t;
} 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) :: tmp
if (y <= (-1.15d-300)) then
tmp = x / (t * 2.0d0)
else if (y <= 2.7d+69) then
tmp = (z * (-0.5d0)) / t
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 tmp;
if (y <= -1.15e-300) {
tmp = x / (t * 2.0);
} else if (y <= 2.7e+69) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.15e-300: tmp = x / (t * 2.0) elif y <= 2.7e+69: tmp = (z * -0.5) / t else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.15e-300) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 2.7e+69) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.15e-300) tmp = x / (t * 2.0); elseif (y <= 2.7e+69) tmp = (z * -0.5) / t; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.15e-300], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+69], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-300}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+69}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -1.15e-300Initial program 100.0%
Taylor expanded in x around inf 35.8%
if -1.15e-300 < y < 2.6999999999999998e69Initial program 100.0%
Taylor expanded in z around inf 51.4%
*-commutative51.4%
associate-*l/51.4%
Simplified51.4%
if 2.6999999999999998e69 < y Initial program 100.0%
Taylor expanded in y around inf 77.3%
(FPCore (x y z t) :precision binary64 (if (<= y 7.2e-58) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-58) {
tmp = (x - z) / (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 (y <= 7.2d-58) then
tmp = (x - z) / (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 (y <= 7.2e-58) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.2e-58: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e-58) tmp = Float64(Float64(x - z) / 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 (y <= 7.2e-58) tmp = (x - z) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-58], N[(N[(x - z), $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}\;y \leq 7.2 \cdot 10^{-58}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if y < 7.20000000000000019e-58Initial program 100.0%
Taylor expanded in y around 0 76.3%
if 7.20000000000000019e-58 < y Initial program 99.9%
Taylor expanded in x around 0 82.3%
(FPCore (x y z t) :precision binary64 (if (<= y 4.8e-51) (/ (- x z) (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e-51) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (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 <= 4.8d-51) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e-51) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.8e-51: tmp = (x - z) / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.8e-51) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.8e-51) tmp = (x - z) / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.8e-51], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if y < 4.8e-51Initial program 100.0%
Taylor expanded in y around 0 76.8%
if 4.8e-51 < y Initial program 100.0%
Taylor expanded in x around 0 85.5%
*-commutative85.5%
associate-*l/85.5%
associate-*r/85.3%
Simplified85.3%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (<= y 4.6e-51) (* (/ 0.5 t) (- x z)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-51) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (0.5 / t) * (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 <= 4.6d-51) then
tmp = (0.5d0 / t) * (x - z)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-51) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.6e-51: tmp = (0.5 / t) * (x - z) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.6e-51) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.6e-51) tmp = (0.5 / t) * (x - z); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.6e-51], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if y < 4.60000000000000004e-51Initial program 100.0%
Taylor expanded in x around 0 97.8%
associate-*r/97.8%
associate-*l/97.7%
associate-*r/97.7%
associate-*l/97.6%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 76.6%
if 4.60000000000000004e-51 < y Initial program 100.0%
Taylor expanded in x around 0 85.5%
*-commutative85.5%
associate-*l/85.5%
associate-*r/85.3%
Simplified85.3%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (<= x -7e+73) (/ x (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+73) {
tmp = x / (t * 2.0);
} else {
tmp = (0.5 / t) * (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 (x <= (-7d+73)) then
tmp = x / (t * 2.0d0)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+73) {
tmp = x / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e+73: tmp = x / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e+73) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7e+73) tmp = x / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e+73], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+73}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -7.00000000000000004e73Initial program 100.0%
Taylor expanded in x around inf 64.6%
if -7.00000000000000004e73 < x Initial program 100.0%
Taylor expanded in x around 0 76.8%
*-commutative76.8%
associate-*l/76.8%
associate-*r/76.6%
Simplified76.6%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (<= y 7.2e-58) (/ x (* t 2.0)) (/ y (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-58) {
tmp = x / (t * 2.0);
} 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) :: tmp
if (y <= 7.2d-58) then
tmp = x / (t * 2.0d0)
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 tmp;
if (y <= 7.2e-58) {
tmp = x / (t * 2.0);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.2e-58: tmp = x / (t * 2.0) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e-58) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.2e-58) tmp = x / (t * 2.0); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-58], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-58}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < 7.20000000000000019e-58Initial program 100.0%
Taylor expanded in x around inf 41.2%
if 7.20000000000000019e-58 < y Initial program 99.9%
Taylor expanded in y around inf 60.2%
(FPCore (x y z t) :precision binary64 (if (<= y 7.2e-58) (/ x (* t 2.0)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-58) {
tmp = x / (t * 2.0);
} 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 <= 7.2d-58) then
tmp = x / (t * 2.0d0)
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 <= 7.2e-58) {
tmp = x / (t * 2.0);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.2e-58: tmp = x / (t * 2.0) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e-58) tmp = Float64(x / Float64(t * 2.0)); 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 <= 7.2e-58) tmp = x / (t * 2.0); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-58], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-58}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 7.20000000000000019e-58Initial program 100.0%
Taylor expanded in x around inf 41.2%
if 7.20000000000000019e-58 < y Initial program 99.9%
Taylor expanded in x around 0 95.8%
associate-*r/95.8%
associate-*l/95.7%
associate-*r/95.7%
associate-*l/95.6%
distribute-lft-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 60.1%
Final simplification46.5%
(FPCore (x y z t) :precision binary64 (if (<= y 5.5e-58) (* x (/ 0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e-58) {
tmp = x * (0.5 / 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 <= 5.5d-58) then
tmp = x * (0.5d0 / 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 <= 5.5e-58) {
tmp = x * (0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.5e-58: tmp = x * (0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 5.5e-58) tmp = Float64(x * Float64(0.5 / 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 <= 5.5e-58) tmp = x * (0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.5e-58], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-58}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 5.49999999999999996e-58Initial program 100.0%
Taylor expanded in x around 0 97.8%
associate-*r/97.8%
associate-*l/97.7%
associate-*r/97.7%
associate-*l/97.5%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 41.1%
if 5.49999999999999996e-58 < y Initial program 99.9%
Taylor expanded in x around 0 95.8%
associate-*r/95.8%
associate-*l/95.7%
associate-*r/95.7%
associate-*l/95.6%
distribute-lft-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 60.1%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (+ x (- y z))))
double code(double x, double y, double z, double t) {
return (0.5 / t) * (x + (y - z));
}
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 / t) * (x + (y - z))
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * (x + (y - z));
}
def code(x, y, z, t): return (0.5 / t) * (x + (y - z))
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(x + Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * (x + (y - z)); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(x + \left(y - z\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 97.2%
associate-*r/97.2%
associate-*l/97.1%
associate-*r/97.1%
associate-*l/97.0%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(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.2%
associate-*r/97.2%
associate-*l/97.1%
associate-*r/97.1%
associate-*l/97.0%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 36.8%
Final simplification36.8%
herbie shell --seed 2024152
(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)))