
(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 8 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.15e-211)
t_2
(if (<= y -3.1e-306)
t_1
(if (<= y 6e-278)
t_2
(if (<= y 2.4e-256)
t_1
(if (<= y 6.8e-199)
t_2
(if (or (<= y 3.6e+71)
(and (not (<= y 1.8e+110))
(or (<= y 2e+132)
(and (not (<= y 5.5e+150)) (<= y 3.4e+168)))))
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.15e-211) {
tmp = t_2;
} else if (y <= -3.1e-306) {
tmp = t_1;
} else if (y <= 6e-278) {
tmp = t_2;
} else if (y <= 2.4e-256) {
tmp = t_1;
} else if (y <= 6.8e-199) {
tmp = t_2;
} else if ((y <= 3.6e+71) || (!(y <= 1.8e+110) && ((y <= 2e+132) || (!(y <= 5.5e+150) && (y <= 3.4e+168))))) {
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.15d-211)) then
tmp = t_2
else if (y <= (-3.1d-306)) then
tmp = t_1
else if (y <= 6d-278) then
tmp = t_2
else if (y <= 2.4d-256) then
tmp = t_1
else if (y <= 6.8d-199) then
tmp = t_2
else if ((y <= 3.6d+71) .or. (.not. (y <= 1.8d+110)) .and. (y <= 2d+132) .or. (.not. (y <= 5.5d+150)) .and. (y <= 3.4d+168)) 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.15e-211) {
tmp = t_2;
} else if (y <= -3.1e-306) {
tmp = t_1;
} else if (y <= 6e-278) {
tmp = t_2;
} else if (y <= 2.4e-256) {
tmp = t_1;
} else if (y <= 6.8e-199) {
tmp = t_2;
} else if ((y <= 3.6e+71) || (!(y <= 1.8e+110) && ((y <= 2e+132) || (!(y <= 5.5e+150) && (y <= 3.4e+168))))) {
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.15e-211: tmp = t_2 elif y <= -3.1e-306: tmp = t_1 elif y <= 6e-278: tmp = t_2 elif y <= 2.4e-256: tmp = t_1 elif y <= 6.8e-199: tmp = t_2 elif (y <= 3.6e+71) or (not (y <= 1.8e+110) and ((y <= 2e+132) or (not (y <= 5.5e+150) and (y <= 3.4e+168)))): 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.15e-211) tmp = t_2; elseif (y <= -3.1e-306) tmp = t_1; elseif (y <= 6e-278) tmp = t_2; elseif (y <= 2.4e-256) tmp = t_1; elseif (y <= 6.8e-199) tmp = t_2; elseif ((y <= 3.6e+71) || (!(y <= 1.8e+110) && ((y <= 2e+132) || (!(y <= 5.5e+150) && (y <= 3.4e+168))))) 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.15e-211) tmp = t_2; elseif (y <= -3.1e-306) tmp = t_1; elseif (y <= 6e-278) tmp = t_2; elseif (y <= 2.4e-256) tmp = t_1; elseif (y <= 6.8e-199) tmp = t_2; elseif ((y <= 3.6e+71) || (~((y <= 1.8e+110)) && ((y <= 2e+132) || (~((y <= 5.5e+150)) && (y <= 3.4e+168))))) 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.15e-211], t$95$2, If[LessEqual[y, -3.1e-306], t$95$1, If[LessEqual[y, 6e-278], t$95$2, If[LessEqual[y, 2.4e-256], t$95$1, If[LessEqual[y, 6.8e-199], t$95$2, If[Or[LessEqual[y, 3.6e+71], And[N[Not[LessEqual[y, 1.8e+110]], $MachinePrecision], Or[LessEqual[y, 2e+132], And[N[Not[LessEqual[y, 5.5e+150]], $MachinePrecision], LessEqual[y, 3.4e+168]]]]], 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.15 \cdot 10^{-211}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-306}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-278}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-256}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-199}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+71} \lor \neg \left(y \leq 1.8 \cdot 10^{+110}\right) \land \left(y \leq 2 \cdot 10^{+132} \lor \neg \left(y \leq 5.5 \cdot 10^{+150}\right) \land y \leq 3.4 \cdot 10^{+168}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.14999999999999994e-211 or -3.09999999999999998e-306 < y < 6e-278 or 2.3999999999999999e-256 < y < 6.80000000000000011e-199Initial 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 38.5%
if -1.14999999999999994e-211 < y < -3.09999999999999998e-306 or 6e-278 < y < 2.3999999999999999e-256 or 6.80000000000000011e-199 < y < 3.6e71 or 1.7999999999999998e110 < y < 1.99999999999999998e132 or 5.50000000000000017e150 < y < 3.40000000000000003e168Initial 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 inf 57.1%
if 3.6e71 < y < 1.7999999999999998e110 or 1.99999999999999998e132 < y < 5.50000000000000017e150 or 3.40000000000000003e168 < y Initial 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 inf 80.7%
Final simplification53.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e+196) (and (not (<= x -3.3e+141)) (<= x -7e+96))) (* 0.5 (/ x t)) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e+196) || (!(x <= -3.3e+141) && (x <= -7e+96))) {
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.2d+196)) .or. (.not. (x <= (-3.3d+141))) .and. (x <= (-7d+96))) 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.2e+196) || (!(x <= -3.3e+141) && (x <= -7e+96))) {
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.2e+196) or (not (x <= -3.3e+141) and (x <= -7e+96)): 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.2e+196) || (!(x <= -3.3e+141) && (x <= -7e+96))) 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.2e+196) || (~((x <= -3.3e+141)) && (x <= -7e+96))) 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.2e+196], And[N[Not[LessEqual[x, -3.3e+141]], $MachinePrecision], LessEqual[x, -7e+96]]], 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.2 \cdot 10^{+196} \lor \neg \left(x \leq -3.3 \cdot 10^{+141}\right) \land x \leq -7 \cdot 10^{+96}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if x < -3.19999999999999993e196 or -3.2999999999999997e141 < x < -6.9999999999999998e96Initial 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 79.2%
if -3.19999999999999993e196 < x < -3.2999999999999997e141 or -6.9999999999999998e96 < 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 77.6%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+29) (not (<= z 6.2e+53))) (* -0.5 (/ z t)) (* 0.5 (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+29) || !(z <= 6.2e+53)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (x / 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 <= (-1.15d+29)) .or. (.not. (z <= 6.2d+53))) then
tmp = (-0.5d0) * (z / t)
else
tmp = 0.5d0 * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+29) || !(z <= 6.2e+53)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+29) or not (z <= 6.2e+53): tmp = -0.5 * (z / t) else: tmp = 0.5 * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+29) || !(z <= 6.2e+53)) tmp = Float64(-0.5 * Float64(z / t)); else tmp = Float64(0.5 * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+29) || ~((z <= 6.2e+53))) tmp = -0.5 * (z / t); else tmp = 0.5 * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+29], N[Not[LessEqual[z, 6.2e+53]], $MachinePrecision]], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+29} \lor \neg \left(z \leq 6.2 \cdot 10^{+53}\right):\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -1.1500000000000001e29 or 6.20000000000000038e53 < z 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 z around inf 78.4%
if -1.1500000000000001e29 < z < 6.20000000000000038e53Initial 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 49.8%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-237) (/ (* -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-237) {
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-237)) 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-237) {
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-237: 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-237) 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-237) 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-237], 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^{-237}:\\
\;\;\;\;\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-237Initial 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 70.2%
associate-*r/70.2%
Simplified70.2%
if -2e-237 < (+.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.6%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (<= y 235.0) (* (/ -0.5 t) (- z x)) (* -0.5 (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 235.0) {
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 <= 235.0d0) 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 <= 235.0) {
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 <= 235.0: 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 <= 235.0) 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 <= 235.0) 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, 235.0], 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 235:\\
\;\;\;\;\frac{-0.5}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if y < 235Initial 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 79.6%
associate-*r/79.6%
Simplified79.6%
associate-/l*79.2%
associate-/r/79.4%
Applied egg-rr79.4%
if 235 < 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 84.6%
Final simplification80.9%
(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 39.9%
Final simplification39.9%
herbie shell --seed 2024031
(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)))