
(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(x + Float64(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[(x + N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(y - z\right)}{t \cdot 2}
\end{array}
Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* z -0.5) t)) (t_2 (/ x (* t 2.0))))
(if (<= y -6.2e-288)
t_2
(if (<= y 4.8e-107)
t_1
(if (<= y 1.7e-91) t_2 (if (<= y 7.8e+59) t_1 (/ y (* t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * -0.5) / t;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= -6.2e-288) {
tmp = t_2;
} else if (y <= 4.8e-107) {
tmp = t_1;
} else if (y <= 1.7e-91) {
tmp = t_2;
} else if (y <= 7.8e+59) {
tmp = t_1;
} 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) :: t_2
real(8) :: tmp
t_1 = (z * (-0.5d0)) / t
t_2 = x / (t * 2.0d0)
if (y <= (-6.2d-288)) then
tmp = t_2
else if (y <= 4.8d-107) then
tmp = t_1
else if (y <= 1.7d-91) then
tmp = t_2
else if (y <= 7.8d+59) then
tmp = t_1
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 = (z * -0.5) / t;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= -6.2e-288) {
tmp = t_2;
} else if (y <= 4.8e-107) {
tmp = t_1;
} else if (y <= 1.7e-91) {
tmp = t_2;
} else if (y <= 7.8e+59) {
tmp = t_1;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * -0.5) / t t_2 = x / (t * 2.0) tmp = 0 if y <= -6.2e-288: tmp = t_2 elif y <= 4.8e-107: tmp = t_1 elif y <= 1.7e-91: tmp = t_2 elif y <= 7.8e+59: tmp = t_1 else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * -0.5) / t) t_2 = Float64(x / Float64(t * 2.0)) tmp = 0.0 if (y <= -6.2e-288) tmp = t_2; elseif (y <= 4.8e-107) tmp = t_1; elseif (y <= 1.7e-91) tmp = t_2; elseif (y <= 7.8e+59) tmp = t_1; else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * -0.5) / t; t_2 = x / (t * 2.0); tmp = 0.0; if (y <= -6.2e-288) tmp = t_2; elseif (y <= 4.8e-107) tmp = t_1; elseif (y <= 1.7e-91) tmp = t_2; elseif (y <= 7.8e+59) tmp = t_1; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.2e-288], t$95$2, If[LessEqual[y, 4.8e-107], t$95$1, If[LessEqual[y, 1.7e-91], t$95$2, If[LessEqual[y, 7.8e+59], t$95$1, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot -0.5}{t}\\
t_2 := \frac{x}{t \cdot 2}\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{-288}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-91}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -6.19999999999999967e-288 or 4.79999999999999989e-107 < y < 1.70000000000000013e-91Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 43.1%
if -6.19999999999999967e-288 < y < 4.79999999999999989e-107 or 1.70000000000000013e-91 < y < 7.80000000000000043e59Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 50.8%
associate-*r/50.8%
Simplified50.8%
if 7.80000000000000043e59 < y Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 78.1%
Final simplification51.8%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0028) (/ x (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0028) {
tmp = x / (t * 2.0);
} 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 (x <= (-0.0028d0)) then
tmp = x / (t * 2.0d0)
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 (x <= -0.0028) {
tmp = x / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0028: tmp = x / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0028) tmp = Float64(x / Float64(t * 2.0)); 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 (x <= -0.0028) tmp = x / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0028], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0028:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -0.00279999999999999997Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 72.7%
if -0.00279999999999999997 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 75.4%
*-commutative75.4%
associate-*l/75.4%
associate-*r/75.2%
Simplified75.2%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0021) (* (/ 0.5 t) (+ x y)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0021) {
tmp = (0.5 / t) * (x + y);
} 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 (x <= (-0.0021d0)) then
tmp = (0.5d0 / t) * (x + y)
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 (x <= -0.0021) {
tmp = (0.5 / t) * (x + y);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0021: tmp = (0.5 / t) * (x + y) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0021) tmp = Float64(Float64(0.5 / t) * Float64(x + y)); 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 (x <= -0.0021) tmp = (0.5 / t) * (x + y); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0021], N[(N[(0.5 / t), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0021:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -0.00209999999999999987Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 89.8%
+-commutative89.8%
Simplified89.8%
clear-num89.6%
associate-/r/89.6%
*-commutative89.6%
associate-/r*89.6%
metadata-eval89.6%
Applied egg-rr89.6%
if -0.00209999999999999987 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 75.4%
*-commutative75.4%
associate-*l/75.4%
associate-*r/75.2%
Simplified75.2%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (<= x -0.00175) (/ (+ x y) (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.00175) {
tmp = (x + y) / (t * 2.0);
} 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 (x <= (-0.00175d0)) then
tmp = (x + y) / (t * 2.0d0)
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 (x <= -0.00175) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.00175: tmp = (x + y) / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.00175) tmp = Float64(Float64(x + y) / Float64(t * 2.0)); 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 (x <= -0.00175) tmp = (x + y) / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.00175], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00175:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -0.00175000000000000004Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 89.8%
+-commutative89.8%
Simplified89.8%
if -0.00175000000000000004 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 75.4%
*-commutative75.4%
associate-*l/75.4%
associate-*r/75.2%
Simplified75.2%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (<= x -6.4e-17) (/ (- x z) (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.4e-17) {
tmp = (x - z) / (t * 2.0);
} 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 (x <= (-6.4d-17)) then
tmp = (x - z) / (t * 2.0d0)
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 (x <= -6.4e-17) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.4e-17: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.4e-17) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); 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 (x <= -6.4e-17) tmp = (x - z) / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.4e-17], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -6.4000000000000005e-17Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 83.8%
if -6.4000000000000005e-17 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 75.8%
*-commutative75.8%
associate-*l/75.8%
associate-*r/75.6%
Simplified75.6%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (<= x -1.36e-17) (* x (/ 0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.36e-17) {
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 (x <= (-1.36d-17)) 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 (x <= -1.36e-17) {
tmp = x * (0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.36e-17: tmp = x * (0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.36e-17) 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 (x <= -1.36e-17) tmp = x * (0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.36e-17], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.36 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -1.36e-17Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.5%
associate-*r/95.5%
associate-*l/95.3%
associate-*r/95.3%
associate-*l/95.2%
distribute-lft-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 66.4%
if -1.36e-17 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 98.4%
associate-*r/98.4%
associate-*l/98.3%
associate-*r/98.3%
associate-*l/98.1%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 41.7%
Final simplification48.1%
(FPCore (x y z t) :precision binary64 (if (<= x -9.2e-18) (/ x (* t 2.0)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.2e-18) {
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 (x <= (-9.2d-18)) 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 (x <= -9.2e-18) {
tmp = x / (t * 2.0);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.2e-18: tmp = x / (t * 2.0) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.2e-18) 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 (x <= -9.2e-18) tmp = x / (t * 2.0); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.2e-18], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -9.2000000000000004e-18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 66.5%
if -9.2000000000000004e-18 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 98.4%
associate-*r/98.4%
associate-*l/98.3%
associate-*r/98.3%
associate-*l/98.1%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 41.7%
Final simplification48.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.05e-19) (/ x (* t 2.0)) (/ y (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e-19) {
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 (x <= (-2.05d-19)) 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 (x <= -2.05e-19) {
tmp = x / (t * 2.0);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.05e-19: tmp = x / (t * 2.0) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.05e-19) 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 (x <= -2.05e-19) tmp = x / (t * 2.0); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.05e-19], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-19}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if x < -2.04999999999999993e-19Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 66.5%
if -2.04999999999999993e-19 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 41.8%
Final simplification48.2%
(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%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 97.7%
associate-*r/97.7%
associate-*l/97.5%
associate-*r/97.5%
associate-*l/97.4%
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%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 97.7%
associate-*r/97.7%
associate-*l/97.5%
associate-*r/97.5%
associate-*l/97.4%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 38.6%
Final simplification38.6%
herbie shell --seed 2024130
(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)))