
(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 (/ (* z -0.5) t)) (t_2 (/ (* x 0.5) t)))
(if (<= y 5.5e-293)
t_2
(if (<= y 5.6e-132)
t_1
(if (<= y 5.8e-86)
t_2
(if (<= y 4.4e-13)
(* z (/ -0.5 t))
(if (or (<= y 6.5e+33)
(and (not (<= y 4.4e+47))
(or (<= y 4.9e+151) (not (<= y 1.02e+192)))))
(/ (* y 0.5) t)
t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * -0.5) / t;
double t_2 = (x * 0.5) / t;
double tmp;
if (y <= 5.5e-293) {
tmp = t_2;
} else if (y <= 5.6e-132) {
tmp = t_1;
} else if (y <= 5.8e-86) {
tmp = t_2;
} else if (y <= 4.4e-13) {
tmp = z * (-0.5 / t);
} else if ((y <= 6.5e+33) || (!(y <= 4.4e+47) && ((y <= 4.9e+151) || !(y <= 1.02e+192)))) {
tmp = (y * 0.5) / t;
} else {
tmp = t_1;
}
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 * 0.5d0) / t
if (y <= 5.5d-293) then
tmp = t_2
else if (y <= 5.6d-132) then
tmp = t_1
else if (y <= 5.8d-86) then
tmp = t_2
else if (y <= 4.4d-13) then
tmp = z * ((-0.5d0) / t)
else if ((y <= 6.5d+33) .or. (.not. (y <= 4.4d+47)) .and. (y <= 4.9d+151) .or. (.not. (y <= 1.02d+192))) then
tmp = (y * 0.5d0) / t
else
tmp = t_1
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 * 0.5) / t;
double tmp;
if (y <= 5.5e-293) {
tmp = t_2;
} else if (y <= 5.6e-132) {
tmp = t_1;
} else if (y <= 5.8e-86) {
tmp = t_2;
} else if (y <= 4.4e-13) {
tmp = z * (-0.5 / t);
} else if ((y <= 6.5e+33) || (!(y <= 4.4e+47) && ((y <= 4.9e+151) || !(y <= 1.02e+192)))) {
tmp = (y * 0.5) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * -0.5) / t t_2 = (x * 0.5) / t tmp = 0 if y <= 5.5e-293: tmp = t_2 elif y <= 5.6e-132: tmp = t_1 elif y <= 5.8e-86: tmp = t_2 elif y <= 4.4e-13: tmp = z * (-0.5 / t) elif (y <= 6.5e+33) or (not (y <= 4.4e+47) and ((y <= 4.9e+151) or not (y <= 1.02e+192))): tmp = (y * 0.5) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * -0.5) / t) t_2 = Float64(Float64(x * 0.5) / t) tmp = 0.0 if (y <= 5.5e-293) tmp = t_2; elseif (y <= 5.6e-132) tmp = t_1; elseif (y <= 5.8e-86) tmp = t_2; elseif (y <= 4.4e-13) tmp = Float64(z * Float64(-0.5 / t)); elseif ((y <= 6.5e+33) || (!(y <= 4.4e+47) && ((y <= 4.9e+151) || !(y <= 1.02e+192)))) tmp = Float64(Float64(y * 0.5) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * -0.5) / t; t_2 = (x * 0.5) / t; tmp = 0.0; if (y <= 5.5e-293) tmp = t_2; elseif (y <= 5.6e-132) tmp = t_1; elseif (y <= 5.8e-86) tmp = t_2; elseif (y <= 4.4e-13) tmp = z * (-0.5 / t); elseif ((y <= 6.5e+33) || (~((y <= 4.4e+47)) && ((y <= 4.9e+151) || ~((y <= 1.02e+192))))) tmp = (y * 0.5) / t; else tmp = t_1; 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[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[y, 5.5e-293], t$95$2, If[LessEqual[y, 5.6e-132], t$95$1, If[LessEqual[y, 5.8e-86], t$95$2, If[LessEqual[y, 4.4e-13], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 6.5e+33], And[N[Not[LessEqual[y, 4.4e+47]], $MachinePrecision], Or[LessEqual[y, 4.9e+151], N[Not[LessEqual[y, 1.02e+192]], $MachinePrecision]]]], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot -0.5}{t}\\
t_2 := \frac{x \cdot 0.5}{t}\\
\mathbf{if}\;y \leq 5.5 \cdot 10^{-293}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-132}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-86}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-13}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+33} \lor \neg \left(y \leq 4.4 \cdot 10^{+47}\right) \land \left(y \leq 4.9 \cdot 10^{+151} \lor \neg \left(y \leq 1.02 \cdot 10^{+192}\right)\right):\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 5.50000000000000028e-293 or 5.60000000000000005e-132 < y < 5.7999999999999998e-86Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 41.6%
associate-*r/41.6%
Simplified41.6%
if 5.50000000000000028e-293 < y < 5.60000000000000005e-132 or 6.49999999999999993e33 < y < 4.3999999999999999e47 or 4.8999999999999999e151 < y < 1.01999999999999996e192Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 57.3%
associate-*r/57.3%
Simplified57.3%
if 5.7999999999999998e-86 < y < 4.39999999999999993e-13Initial program 99.7%
*-lft-identity99.7%
metadata-eval99.7%
times-frac99.7%
*-commutative99.7%
times-frac99.8%
remove-double-neg99.8%
sub0-neg99.8%
div-sub99.8%
metadata-eval99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
metadata-eval99.8%
/-rgt-identity99.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
associate-*r/99.7%
clear-num99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 60.8%
associate-*r/60.8%
associate-/l*60.5%
Simplified60.5%
associate-/r/60.8%
Applied egg-rr60.8%
if 4.39999999999999993e-13 < y < 6.49999999999999993e33 or 4.3999999999999999e47 < y < 4.8999999999999999e151 or 1.01999999999999996e192 < y Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.9%
remove-double-neg99.9%
sub0-neg99.9%
div-sub99.9%
metadata-eval99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
metadata-eval99.9%
/-rgt-identity99.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate--r+99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 77.3%
associate-*r/77.3%
Simplified77.3%
Final simplification52.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+157) (and (not (<= x -5.9e+85)) (<= x -4.8))) (/ (* x 0.5) t) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+157) || (!(x <= -5.9e+85) && (x <= -4.8))) {
tmp = (x * 0.5) / t;
} else {
tmp = -0.5 * ((z - 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 ((x <= (-7.2d+157)) .or. (.not. (x <= (-5.9d+85))) .and. (x <= (-4.8d0))) then
tmp = (x * 0.5d0) / t
else
tmp = (-0.5d0) * ((z - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+157) || (!(x <= -5.9e+85) && (x <= -4.8))) {
tmp = (x * 0.5) / t;
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e+157) or (not (x <= -5.9e+85) and (x <= -4.8)): tmp = (x * 0.5) / t else: tmp = -0.5 * ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e+157) || (!(x <= -5.9e+85) && (x <= -4.8))) tmp = Float64(Float64(x * 0.5) / t); else tmp = Float64(-0.5 * Float64(Float64(z - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e+157) || (~((x <= -5.9e+85)) && (x <= -4.8))) tmp = (x * 0.5) / t; else tmp = -0.5 * ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+157], And[N[Not[LessEqual[x, -5.9e+85]], $MachinePrecision], LessEqual[x, -4.8]]], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], N[(-0.5 * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+157} \lor \neg \left(x \leq -5.9 \cdot 10^{+85}\right) \land x \leq -4.8:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if x < -7.20000000000000049e157 or -5.9e85 < x < -4.79999999999999982Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 67.1%
associate-*r/67.1%
Simplified67.1%
if -7.20000000000000049e157 < x < -5.9e85 or -4.79999999999999982 < x Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 75.7%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-155) (/ -0.5 (/ t (- z x))) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-155) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = -0.5 * ((z - 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 ((x + y) <= (-2d-155)) then
tmp = (-0.5d0) / (t / (z - x))
else
tmp = (-0.5d0) * ((z - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-155) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-155: tmp = -0.5 / (t / (z - x)) else: tmp = -0.5 * ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-155) tmp = Float64(-0.5 / Float64(t / Float64(z - x))); else tmp = Float64(-0.5 * Float64(Float64(z - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -2e-155) tmp = -0.5 / (t / (z - x)); else tmp = -0.5 * ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-155], N[(-0.5 / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-155}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -2.00000000000000003e-155Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 66.3%
associate-*r/66.3%
associate-/l*66.1%
Simplified66.1%
if -2.00000000000000003e-155 < (+.f64 x y) Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.8%
remove-double-neg99.8%
sub0-neg99.8%
div-sub99.8%
metadata-eval99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
metadata-eval99.8%
/-rgt-identity99.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 70.7%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (<= x -7.2e-6) (* (+ x y) (/ 0.5 t)) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e-6) {
tmp = (x + y) * (0.5 / t);
} else {
tmp = -0.5 * ((z - 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 (x <= (-7.2d-6)) then
tmp = (x + y) * (0.5d0 / t)
else
tmp = (-0.5d0) * ((z - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e-6) {
tmp = (x + y) * (0.5 / t);
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.2e-6: tmp = (x + y) * (0.5 / t) else: tmp = -0.5 * ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(Float64(x + y) * Float64(0.5 / t)); else tmp = Float64(-0.5 * Float64(Float64(z - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.2e-6) tmp = (x + y) * (0.5 / t); else tmp = -0.5 * ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.2e-6], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 80.1%
associate-*r/80.1%
Simplified80.1%
associate-/l*79.9%
+-commutative79.9%
associate-/r/79.9%
Applied egg-rr79.9%
if -7.19999999999999967e-6 < x Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 76.0%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (* (- (- z y) x) (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return ((z - y) - 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 = ((z - y) - x) * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return ((z - y) - x) * (-0.5 / t);
}
def code(x, y, z, t): return ((z - y) - x) * (-0.5 / t)
function code(x, y, z, t) return Float64(Float64(Float64(z - y) - x) * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = ((z - y) - x) * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(N[(z - y), $MachinePrecision] - x), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(z - y\right) - x\right) \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-6) (* x (/ 0.5 t)) (* z (/ -0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-6) {
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 (x <= (-2.4d-6)) 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 (x <= -2.4e-6) {
tmp = x * (0.5 / t);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-6: tmp = x * (0.5 / t) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-6) 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 (x <= -2.4e-6) tmp = x * (0.5 / t); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-6], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if x < -2.3999999999999999e-6Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 60.5%
associate-*r/60.5%
metadata-eval60.5%
associate-*r*60.5%
neg-mul-160.5%
*-commutative60.5%
associate-*r/60.3%
distribute-lft-neg-in60.3%
distribute-rgt-neg-in60.3%
distribute-neg-frac60.3%
metadata-eval60.3%
Simplified60.3%
if -2.3999999999999999e-6 < x Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-*r/99.9%
clear-num99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 39.4%
associate-*r/39.4%
associate-/l*39.3%
Simplified39.3%
associate-/r/39.3%
Applied egg-rr39.3%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e-6) (* x (/ 0.5 t)) (/ (* z -0.5) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e-6) {
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 (x <= (-2.6d-6)) 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 (x <= -2.6e-6) {
tmp = x * (0.5 / t);
} else {
tmp = (z * -0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e-6: tmp = x * (0.5 / t) else: tmp = (z * -0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e-6) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(Float64(z * -0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.6e-6) tmp = x * (0.5 / t); else tmp = (z * -0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e-6], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\end{array}
\end{array}
if x < -2.60000000000000009e-6Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 60.5%
associate-*r/60.5%
metadata-eval60.5%
associate-*r*60.5%
neg-mul-160.5%
*-commutative60.5%
associate-*r/60.3%
distribute-lft-neg-in60.3%
distribute-rgt-neg-in60.3%
distribute-neg-frac60.3%
metadata-eval60.3%
Simplified60.3%
if -2.60000000000000009e-6 < x Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 39.4%
associate-*r/39.4%
Simplified39.4%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (if (<= x -6.5e-6) (/ (* x 0.5) t) (/ (* z -0.5) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.5e-6) {
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 (x <= (-6.5d-6)) 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 (x <= -6.5e-6) {
tmp = (x * 0.5) / t;
} else {
tmp = (z * -0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.5e-6: tmp = (x * 0.5) / t else: tmp = (z * -0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.5e-6) tmp = Float64(Float64(x * 0.5) / t); else tmp = Float64(Float64(z * -0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.5e-6) tmp = (x * 0.5) / t; else tmp = (z * -0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.5e-6], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\end{array}
\end{array}
if x < -6.4999999999999996e-6Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 60.5%
associate-*r/60.5%
Simplified60.5%
if -6.4999999999999996e-6 < x Initial program 99.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
*-commutative99.9%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 39.4%
associate-*r/39.4%
Simplified39.4%
Final simplification45.1%
(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%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.7%
remove-double-neg99.7%
sub0-neg99.7%
div-sub99.7%
metadata-eval99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 36.6%
associate-*r/36.6%
metadata-eval36.6%
associate-*r*36.6%
neg-mul-136.6%
*-commutative36.6%
associate-*r/36.5%
distribute-lft-neg-in36.5%
distribute-rgt-neg-in36.5%
distribute-neg-frac36.5%
metadata-eval36.5%
Simplified36.5%
Final simplification36.5%
herbie shell --seed 2023322
(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)))