
(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 9 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 (if (or (<= z -6.8e+132) (not (<= z 5.5e+123))) (/ z (* t -2.0)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e+132) || !(z <= 5.5e+123)) {
tmp = z / (t * -2.0);
} 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 <= (-6.8d+132)) .or. (.not. (z <= 5.5d+123))) then
tmp = z / (t * (-2.0d0))
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 <= -6.8e+132) || !(z <= 5.5e+123)) {
tmp = z / (t * -2.0);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.8e+132) or not (z <= 5.5e+123): tmp = z / (t * -2.0) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.8e+132) || !(z <= 5.5e+123)) tmp = Float64(z / Float64(t * -2.0)); 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 <= -6.8e+132) || ~((z <= 5.5e+123))) tmp = z / (t * -2.0); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.8e+132], N[Not[LessEqual[z, 5.5e+123]], $MachinePrecision]], N[(z / N[(t * -2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+132} \lor \neg \left(z \leq 5.5 \cdot 10^{+123}\right):\\
\;\;\;\;\frac{z}{t \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -6.80000000000000051e132 or 5.5000000000000002e123 < z Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
neg-mul-1100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 82.5%
if -6.80000000000000051e132 < z < 5.5000000000000002e123Initial 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 85.1%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e+75) (* 0.5 (/ (+ x y) t)) (* (- z y) (/ -0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e+75) {
tmp = 0.5 * ((x + y) / t);
} else {
tmp = (z - 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 + y) <= (-4d+75)) then
tmp = 0.5d0 * ((x + y) / t)
else
tmp = (z - 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 + y) <= -4e+75) {
tmp = 0.5 * ((x + y) / t);
} else {
tmp = (z - y) * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -4e+75: tmp = 0.5 * ((x + y) / t) else: tmp = (z - y) * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -4e+75) tmp = Float64(0.5 * Float64(Float64(x + y) / t)); else tmp = Float64(Float64(z - y) * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -4e+75) tmp = 0.5 * ((x + y) / t); else tmp = (z - y) * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e+75], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{+75}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z - y\right) \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -3.99999999999999971e75Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
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 z around 0 82.2%
if -3.99999999999999971e75 < (+.f64 x y) 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 0 72.8%
associate-*r/72.8%
associate-*l/72.6%
*-commutative72.6%
Simplified72.6%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e-166) (/ (- z x) (* t -2.0)) (* (- z y) (/ -0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e-166) {
tmp = (z - x) / (t * -2.0);
} else {
tmp = (z - 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 + y) <= 2d-166) then
tmp = (z - x) / (t * (-2.0d0))
else
tmp = (z - 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 + y) <= 2e-166) {
tmp = (z - x) / (t * -2.0);
} else {
tmp = (z - y) * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e-166: tmp = (z - x) / (t * -2.0) else: tmp = (z - y) * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e-166) tmp = Float64(Float64(z - x) / Float64(t * -2.0)); else tmp = Float64(Float64(z - y) * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 2e-166) tmp = (z - x) / (t * -2.0); else tmp = (z - y) * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e-166], N[(N[(z - x), $MachinePrecision] / N[(t * -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{-166}:\\
\;\;\;\;\frac{z - x}{t \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;\left(z - y\right) \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 2.00000000000000008e-166Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
neg-mul-1100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 71.3%
if 2.00000000000000008e-166 < (+.f64 x y) Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
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 68.2%
associate-*r/68.2%
associate-*l/68.1%
*-commutative68.1%
Simplified68.1%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (if (<= y -1.95e-167) (* 0.5 (/ x t)) (if (<= y 7.3e+56) (/ -0.5 (/ t z)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-167) {
tmp = 0.5 * (x / t);
} else if (y <= 7.3e+56) {
tmp = -0.5 / (t / z);
} else {
tmp = 0.5 * (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 <= (-1.95d-167)) then
tmp = 0.5d0 * (x / t)
else if (y <= 7.3d+56) then
tmp = (-0.5d0) / (t / z)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-167) {
tmp = 0.5 * (x / t);
} else if (y <= 7.3e+56) {
tmp = -0.5 / (t / z);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.95e-167: tmp = 0.5 * (x / t) elif y <= 7.3e+56: tmp = -0.5 / (t / z) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-167) tmp = Float64(0.5 * Float64(x / t)); elseif (y <= 7.3e+56) tmp = Float64(-0.5 / Float64(t / z)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.95e-167) tmp = 0.5 * (x / t); elseif (y <= 7.3e+56) tmp = -0.5 / (t / z); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.95e-167], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.3e+56], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-167}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;y \leq 7.3 \cdot 10^{+56}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.94999999999999992e-167Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
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 inf 33.9%
if -1.94999999999999992e-167 < y < 7.3e56Initial 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 52.8%
associate-*r/52.8%
associate-/l*52.5%
Simplified52.5%
if 7.3e56 < y 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 y around inf 63.1%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (if (<= y -4.7e-169) (* 0.5 (/ x t)) (if (<= y 2.75e+57) (/ z (* t -2.0)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.7e-169) {
tmp = 0.5 * (x / t);
} else if (y <= 2.75e+57) {
tmp = z / (t * -2.0);
} else {
tmp = 0.5 * (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 <= (-4.7d-169)) then
tmp = 0.5d0 * (x / t)
else if (y <= 2.75d+57) then
tmp = z / (t * (-2.0d0))
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.7e-169) {
tmp = 0.5 * (x / t);
} else if (y <= 2.75e+57) {
tmp = z / (t * -2.0);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.7e-169: tmp = 0.5 * (x / t) elif y <= 2.75e+57: tmp = z / (t * -2.0) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.7e-169) tmp = Float64(0.5 * Float64(x / t)); elseif (y <= 2.75e+57) tmp = Float64(z / Float64(t * -2.0)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.7e-169) tmp = 0.5 * (x / t); elseif (y <= 2.75e+57) tmp = z / (t * -2.0); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.7e-169], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.75e+57], N[(z / N[(t * -2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{-169}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+57}:\\
\;\;\;\;\frac{z}{t \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -4.6999999999999999e-169Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
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 inf 33.9%
if -4.6999999999999999e-169 < y < 2.7500000000000001e57Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
neg-mul-1100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 52.8%
if 2.7500000000000001e57 < y 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 y around inf 63.1%
Final simplification48.5%
(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 -3.9e-69) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-69) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (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 <= (-3.9d-69)) then
tmp = 0.5d0 * (x / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-69) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-69: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-69) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e-69) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-69], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-69}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -3.89999999999999981e-69Initial 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 54.8%
if -3.89999999999999981e-69 < x Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
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 y around inf 44.6%
Final simplification47.8%
(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%
*-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%
Final simplification36.6%
herbie shell --seed 2024010
(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)))