
(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
(let* ((t_1 (* -0.5 (/ z t))) (t_2 (* 0.5 (/ x t))))
(if (<= y -1.1e-92)
t_2
(if (<= y -1.5e-157)
t_1
(if (<= y 9.5e-106) t_2 (if (<= y 5.1e+66) t_1 (* 0.5 (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = -0.5 * (z / t);
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -1.1e-92) {
tmp = t_2;
} else if (y <= -1.5e-157) {
tmp = t_1;
} else if (y <= 9.5e-106) {
tmp = t_2;
} else if (y <= 5.1e+66) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-0.5d0) * (z / t)
t_2 = 0.5d0 * (x / t)
if (y <= (-1.1d-92)) then
tmp = t_2
else if (y <= (-1.5d-157)) then
tmp = t_1
else if (y <= 9.5d-106) then
tmp = t_2
else if (y <= 5.1d+66) then
tmp = t_1
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 t_1 = -0.5 * (z / t);
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -1.1e-92) {
tmp = t_2;
} else if (y <= -1.5e-157) {
tmp = t_1;
} else if (y <= 9.5e-106) {
tmp = t_2;
} else if (y <= 5.1e+66) {
tmp = t_1;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = -0.5 * (z / t) t_2 = 0.5 * (x / t) tmp = 0 if y <= -1.1e-92: tmp = t_2 elif y <= -1.5e-157: tmp = t_1 elif y <= 9.5e-106: tmp = t_2 elif y <= 5.1e+66: tmp = t_1 else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(-0.5 * Float64(z / t)) t_2 = Float64(0.5 * Float64(x / t)) tmp = 0.0 if (y <= -1.1e-92) tmp = t_2; elseif (y <= -1.5e-157) tmp = t_1; elseif (y <= 9.5e-106) tmp = t_2; elseif (y <= 5.1e+66) tmp = t_1; else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -0.5 * (z / t); t_2 = 0.5 * (x / t); tmp = 0.0; if (y <= -1.1e-92) tmp = t_2; elseif (y <= -1.5e-157) tmp = t_1; elseif (y <= 9.5e-106) tmp = t_2; elseif (y <= 5.1e+66) tmp = t_1; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e-92], t$95$2, If[LessEqual[y, -1.5e-157], t$95$1, If[LessEqual[y, 9.5e-106], t$95$2, If[LessEqual[y, 5.1e+66], t$95$1, N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -0.5 \cdot \frac{z}{t}\\
t_2 := 0.5 \cdot \frac{x}{t}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-92}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-106}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.09999999999999994e-92 or -1.5e-157 < y < 9.4999999999999994e-106Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.6%
remove-double-neg99.6%
sub0-neg99.6%
div-sub99.6%
metadata-eval99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
metadata-eval99.6%
/-rgt-identity99.6%
associate--r-99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
+-commutative99.6%
associate--r+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 47.4%
if -1.09999999999999994e-92 < y < -1.5e-157 or 9.4999999999999994e-106 < y < 5.10000000000000008e66Initial 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 51.3%
if 5.10000000000000008e66 < 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 65.3%
Final simplification51.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e+138) (and (not (<= x -1.25e+119)) (<= x -1.5e+42))) (* 0.5 (/ x t)) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e+138) || (!(x <= -1.25e+119) && (x <= -1.5e+42))) {
tmp = 0.5 * (x / 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 <= (-3.5d+138)) .or. (.not. (x <= (-1.25d+119))) .and. (x <= (-1.5d+42))) then
tmp = 0.5d0 * (x / 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 <= -3.5e+138) || (!(x <= -1.25e+119) && (x <= -1.5e+42))) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.5e+138) or (not (x <= -1.25e+119) and (x <= -1.5e+42)): tmp = 0.5 * (x / t) else: tmp = -0.5 * ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.5e+138) || (!(x <= -1.25e+119) && (x <= -1.5e+42))) tmp = Float64(0.5 * Float64(x / 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 <= -3.5e+138) || (~((x <= -1.25e+119)) && (x <= -1.5e+42))) tmp = 0.5 * (x / t); else tmp = -0.5 * ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.5e+138], And[N[Not[LessEqual[x, -1.25e+119]], $MachinePrecision], LessEqual[x, -1.5e+42]]], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+138} \lor \neg \left(x \leq -1.25 \cdot 10^{+119}\right) \land x \leq -1.5 \cdot 10^{+42}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if x < -3.4999999999999998e138 or -1.25e119 < x < -1.50000000000000014e42Initial 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 77.5%
if -3.4999999999999998e138 < x < -1.25e119 or -1.50000000000000014e42 < x 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 75.6%
Final simplification76.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-242) (/ (* -0.5 (- z x)) t) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-242) {
tmp = (-0.5 * (z - x)) / 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 + y) <= (-2d-242)) then
tmp = ((-0.5d0) * (z - x)) / 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 + y) <= -2e-242) {
tmp = (-0.5 * (z - x)) / t;
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-242: tmp = (-0.5 * (z - x)) / t else: tmp = -0.5 * ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-242) tmp = Float64(Float64(-0.5 * Float64(z - x)) / 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 + y) <= -2e-242) tmp = (-0.5 * (z - x)) / t; else tmp = -0.5 * ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-242], N[(N[(-0.5 * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $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^{-242}:\\
\;\;\;\;\frac{-0.5 \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -2e-242Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.6%
remove-double-neg99.6%
sub0-neg99.6%
div-sub99.6%
metadata-eval99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
metadata-eval99.6%
/-rgt-identity99.6%
associate--r-99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
+-commutative99.6%
associate--r+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 68.2%
associate-*r/68.2%
Simplified68.2%
if -2e-242 < (+.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 66.5%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (<= y 8.1e-13) (* (/ -0.5 t) (- z x)) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.1e-13) {
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 (y <= 8.1d-13) 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 (y <= 8.1e-13) {
tmp = (-0.5 / t) * (z - x);
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 8.1e-13: 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 (y <= 8.1e-13) tmp = Float64(Float64(-0.5 / 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 (y <= 8.1e-13) 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[y, 8.1e-13], N[(N[(-0.5 / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.1 \cdot 10^{-13}:\\
\;\;\;\;\frac{-0.5}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if y < 8.0999999999999998e-13Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.6%
remove-double-neg99.6%
sub0-neg99.6%
div-sub99.6%
metadata-eval99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
metadata-eval99.6%
/-rgt-identity99.6%
associate--r-99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
+-commutative99.6%
associate--r+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 77.8%
associate-*r/77.8%
Simplified77.8%
associate-/l*77.3%
associate-/r/77.5%
Applied egg-rr77.5%
if 8.0999999999999998e-13 < 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 80.7%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (<= y 1.15e-12) (/ -0.5 (/ t (- z x))) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.15e-12) {
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 (y <= 1.15d-12) 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 (y <= 1.15e-12) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = -0.5 * ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.15e-12: 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 (y <= 1.15e-12) 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 (y <= 1.15e-12) 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[y, 1.15e-12], 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}\;y \leq 1.15 \cdot 10^{-12}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if y < 1.14999999999999995e-12Initial program 100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
*-commutative100.0%
times-frac99.6%
remove-double-neg99.6%
sub0-neg99.6%
div-sub99.6%
metadata-eval99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
metadata-eval99.6%
/-rgt-identity99.6%
associate--r-99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
+-commutative99.6%
associate--r+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 77.8%
associate-*r/77.8%
associate-/l*77.3%
Simplified77.3%
if 1.14999999999999995e-12 < 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 80.7%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (<= x -8.8e-35) (* 0.5 (/ x t)) (* -0.5 (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.8e-35) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * (z / 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 <= (-8.8d-35)) then
tmp = 0.5d0 * (x / t)
else
tmp = (-0.5d0) * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.8e-35) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.8e-35: tmp = 0.5 * (x / t) else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.8e-35) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(-0.5 * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.8e-35) tmp = 0.5 * (x / t); else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.8e-35], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -8.79999999999999975e-35Initial 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 61.5%
if -8.79999999999999975e-35 < x 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 z around inf 45.4%
Final simplification49.8%
(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 (* -0.5 (/ z t)))
double code(double x, double y, double z, double t) {
return -0.5 * (z / 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) * (z / t)
end function
public static double code(double x, double y, double z, double t) {
return -0.5 * (z / t);
}
def code(x, y, z, t): return -0.5 * (z / t)
function code(x, y, z, t) return Float64(-0.5 * Float64(z / t)) end
function tmp = code(x, y, z, t) tmp = -0.5 * (z / t); end
code[x_, y_, z_, t_] := N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{z}{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 z around inf 38.2%
Final simplification38.2%
herbie shell --seed 2024021
(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)))