
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (+ (- y z) x)))
double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y - z) + x);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.5d0 / t) * ((y - z) + x)
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y - z) + x);
}
def code(x, y, z, t): return (0.5 / t) * ((y - z) + x)
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(Float64(y - z) + x)) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * ((y - z) + x); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(\left(y - z\right) + x\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in x around 0 95.3%
+-commutative95.3%
associate-*r/95.7%
associate-*l/95.6%
associate-*r/95.6%
associate-*l/95.5%
distribute-lft-out99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -7.2e+23)
(* 0.5 (/ x t))
(if (or (<= x -2.5e-205) (and (not (<= x 4.4e-307)) (<= x 6e-230)))
(* z (/ -0.5 t))
(/ 0.5 (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e+23) {
tmp = 0.5 * (x / t);
} else if ((x <= -2.5e-205) || (!(x <= 4.4e-307) && (x <= 6e-230))) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
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+23)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-2.5d-205)) .or. (.not. (x <= 4.4d-307)) .and. (x <= 6d-230)) then
tmp = z * ((-0.5d0) / t)
else
tmp = 0.5d0 / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e+23) {
tmp = 0.5 * (x / t);
} else if ((x <= -2.5e-205) || (!(x <= 4.4e-307) && (x <= 6e-230))) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.2e+23: tmp = 0.5 * (x / t) elif (x <= -2.5e-205) or (not (x <= 4.4e-307) and (x <= 6e-230)): tmp = z * (-0.5 / t) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.2e+23) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -2.5e-205) || (!(x <= 4.4e-307) && (x <= 6e-230))) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(0.5 / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.2e+23) tmp = 0.5 * (x / t); elseif ((x <= -2.5e-205) || (~((x <= 4.4e-307)) && (x <= 6e-230))) tmp = z * (-0.5 / t); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.2e+23], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2.5e-205], And[N[Not[LessEqual[x, 4.4e-307]], $MachinePrecision], LessEqual[x, 6e-230]]], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+23}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-205} \lor \neg \left(x \leq 4.4 \cdot 10^{-307}\right) \land x \leq 6 \cdot 10^{-230}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -7.1999999999999997e23Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 64.6%
if -7.1999999999999997e23 < x < -2.5e-205 or 4.4e-307 < x < 6e-230Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 52.2%
associate-*r/53.4%
associate-/l*53.2%
Simplified53.2%
associate-/r/53.4%
Applied egg-rr53.4%
if -2.5e-205 < x < 4.4e-307 or 6e-230 < x Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around 0 97.1%
+-commutative97.1%
associate-*r/97.1%
associate-*l/97.0%
associate-*r/97.0%
associate-*l/96.9%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in x around 0 73.9%
associate-/r/73.7%
Applied egg-rr73.7%
Taylor expanded in y around inf 41.3%
Final simplification49.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.2e+23)
(* 0.5 (/ x t))
(if (or (<= x -1.56e-206) (and (not (<= x -1.45e-301)) (<= x 8.2e-227)))
(* z (/ -0.5 t))
(/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+23) {
tmp = 0.5 * (x / t);
} else if ((x <= -1.56e-206) || (!(x <= -1.45e-301) && (x <= 8.2e-227))) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-6.2d+23)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-1.56d-206)) .or. (.not. (x <= (-1.45d-301))) .and. (x <= 8.2d-227)) then
tmp = z * ((-0.5d0) / t)
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+23) {
tmp = 0.5 * (x / t);
} else if ((x <= -1.56e-206) || (!(x <= -1.45e-301) && (x <= 8.2e-227))) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e+23: tmp = 0.5 * (x / t) elif (x <= -1.56e-206) or (not (x <= -1.45e-301) and (x <= 8.2e-227)): tmp = z * (-0.5 / t) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e+23) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -1.56e-206) || (!(x <= -1.45e-301) && (x <= 8.2e-227))) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.2e+23) tmp = 0.5 * (x / t); elseif ((x <= -1.56e-206) || (~((x <= -1.45e-301)) && (x <= 8.2e-227))) tmp = z * (-0.5 / t); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e+23], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.56e-206], And[N[Not[LessEqual[x, -1.45e-301]], $MachinePrecision], LessEqual[x, 8.2e-227]]], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -1.56 \cdot 10^{-206} \lor \neg \left(x \leq -1.45 \cdot 10^{-301}\right) \land x \leq 8.2 \cdot 10^{-227}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if x < -6.19999999999999941e23Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 64.6%
if -6.19999999999999941e23 < x < -1.56000000000000008e-206 or -1.44999999999999992e-301 < x < 8.20000000000000018e-227Initial program 98.5%
associate--l+98.5%
Simplified98.5%
Taylor expanded in z around inf 52.9%
associate-*r/54.1%
associate-/l*53.9%
Simplified53.9%
associate-/r/54.0%
Applied egg-rr54.0%
if -1.56000000000000008e-206 < x < -1.44999999999999992e-301 or 8.20000000000000018e-227 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 41.5%
Final simplification49.6%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.2e+23)
(* 0.5 (/ x t))
(if (<= x -9.5e-204)
(/ (/ z -2.0) t)
(if (or (<= x 3.5e-302) (not (<= x 1.02e-225)))
(/ y (* t 2.0))
(* z (/ -0.5 t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+23) {
tmp = 0.5 * (x / t);
} else if (x <= -9.5e-204) {
tmp = (z / -2.0) / t;
} else if ((x <= 3.5e-302) || !(x <= 1.02e-225)) {
tmp = y / (t * 2.0);
} 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.2d+23)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-9.5d-204)) then
tmp = (z / (-2.0d0)) / t
else if ((x <= 3.5d-302) .or. (.not. (x <= 1.02d-225))) then
tmp = y / (t * 2.0d0)
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.2e+23) {
tmp = 0.5 * (x / t);
} else if (x <= -9.5e-204) {
tmp = (z / -2.0) / t;
} else if ((x <= 3.5e-302) || !(x <= 1.02e-225)) {
tmp = y / (t * 2.0);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e+23: tmp = 0.5 * (x / t) elif x <= -9.5e-204: tmp = (z / -2.0) / t elif (x <= 3.5e-302) or not (x <= 1.02e-225): tmp = y / (t * 2.0) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e+23) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -9.5e-204) tmp = Float64(Float64(z / -2.0) / t); elseif ((x <= 3.5e-302) || !(x <= 1.02e-225)) tmp = Float64(y / Float64(t * 2.0)); 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 <= -6.2e+23) tmp = 0.5 * (x / t); elseif (x <= -9.5e-204) tmp = (z / -2.0) / t; elseif ((x <= 3.5e-302) || ~((x <= 1.02e-225))) tmp = y / (t * 2.0); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e+23], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e-204], N[(N[(z / -2.0), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[x, 3.5e-302], N[Not[LessEqual[x, 1.02e-225]], $MachinePrecision]], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{z}{-2}}{t}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-302} \lor \neg \left(x \leq 1.02 \cdot 10^{-225}\right):\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if x < -6.19999999999999941e23Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 64.6%
if -6.19999999999999941e23 < x < -9.50000000000000063e-204Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 53.7%
associate-*r/53.7%
associate-/l*53.5%
Simplified53.5%
associate-/r/53.6%
Applied egg-rr53.6%
associate-/r/53.5%
div-inv53.5%
metadata-eval53.5%
metadata-eval53.5%
clear-num53.7%
times-frac53.7%
*-lft-identity53.7%
associate-/r*53.7%
metadata-eval53.7%
Applied egg-rr53.7%
if -9.50000000000000063e-204 < x < 3.5000000000000001e-302 or 1.01999999999999995e-225 < x Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in y around inf 40.7%
if 3.5000000000000001e-302 < x < 1.01999999999999995e-225Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 47.8%
associate-*r/52.8%
associate-/l*52.4%
Simplified52.4%
associate-/r/52.8%
Applied egg-rr52.8%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e+32) (not (<= z 9.5e-23))) (* (/ 0.5 t) (- y z)) (* (/ 0.5 t) (+ y x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e+32) || !(z <= 9.5e-23)) {
tmp = (0.5 / t) * (y - z);
} else {
tmp = (0.5 / t) * (y + x);
}
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 <= (-3.1d+32)) .or. (.not. (z <= 9.5d-23))) then
tmp = (0.5d0 / t) * (y - z)
else
tmp = (0.5d0 / t) * (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e+32) || !(z <= 9.5e-23)) {
tmp = (0.5 / t) * (y - z);
} else {
tmp = (0.5 / t) * (y + x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.1e+32) or not (z <= 9.5e-23): tmp = (0.5 / t) * (y - z) else: tmp = (0.5 / t) * (y + x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.1e+32) || !(z <= 9.5e-23)) tmp = Float64(Float64(0.5 / t) * Float64(y - z)); else tmp = Float64(Float64(0.5 / t) * Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.1e+32) || ~((z <= 9.5e-23))) tmp = (0.5 / t) * (y - z); else tmp = (0.5 / t) * (y + x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.1e+32], N[Not[LessEqual[z, 9.5e-23]], $MachinePrecision]], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+32} \lor \neg \left(z \leq 9.5 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y + x\right)\\
\end{array}
\end{array}
if z < -3.09999999999999993e32 or 9.50000000000000058e-23 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 91.7%
+-commutative91.7%
associate-*r/92.4%
associate-*l/92.3%
associate-*r/92.3%
associate-*l/92.2%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in x around 0 87.8%
if -3.09999999999999993e32 < z < 9.50000000000000058e-23Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around 0 98.5%
+-commutative98.5%
associate-*r/98.5%
associate-*l/98.4%
associate-*r/98.4%
associate-*l/98.3%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in z around 0 94.7%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (if (<= z -5.3e+88) (/ (/ z -2.0) t) (if (<= z 1e+108) (* (/ 0.5 t) (+ y x)) (* (/ z t) -0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.3e+88) {
tmp = (z / -2.0) / t;
} else if (z <= 1e+108) {
tmp = (0.5 / t) * (y + x);
} else {
tmp = (z / t) * -0.5;
}
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 <= (-5.3d+88)) then
tmp = (z / (-2.0d0)) / t
else if (z <= 1d+108) then
tmp = (0.5d0 / t) * (y + x)
else
tmp = (z / t) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.3e+88) {
tmp = (z / -2.0) / t;
} else if (z <= 1e+108) {
tmp = (0.5 / t) * (y + x);
} else {
tmp = (z / t) * -0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.3e+88: tmp = (z / -2.0) / t elif z <= 1e+108: tmp = (0.5 / t) * (y + x) else: tmp = (z / t) * -0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.3e+88) tmp = Float64(Float64(z / -2.0) / t); elseif (z <= 1e+108) tmp = Float64(Float64(0.5 / t) * Float64(y + x)); else tmp = Float64(Float64(z / t) * -0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.3e+88) tmp = (z / -2.0) / t; elseif (z <= 1e+108) tmp = (0.5 / t) * (y + x); else tmp = (z / t) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.3e+88], N[(N[(z / -2.0), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1e+108], N[(N[(0.5 / t), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{z}{-2}}{t}\\
\mathbf{elif}\;z \leq 10^{+108}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\end{array}
\end{array}
if z < -5.29999999999999987e88Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 85.7%
associate-*r/87.7%
associate-/l*87.3%
Simplified87.3%
associate-/r/87.5%
Applied egg-rr87.5%
associate-/r/87.3%
div-inv85.4%
metadata-eval85.4%
metadata-eval85.4%
clear-num85.7%
times-frac87.7%
*-lft-identity87.7%
associate-/r*87.7%
metadata-eval87.7%
Applied egg-rr87.7%
if -5.29999999999999987e88 < z < 1e108Initial program 99.4%
associate--l+99.4%
Simplified99.4%
Taylor expanded in x around 0 95.9%
+-commutative95.9%
associate-*r/95.9%
associate-*l/95.8%
associate-*r/95.9%
associate-*l/95.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in z around 0 88.5%
if 1e108 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 83.6%
*-commutative83.6%
Simplified83.6%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -5e-130) (/ (- x z) (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
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 + x) <= (-5d-130)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -5e-130: tmp = (x - z) / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -5e-130) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -5e-130) tmp = (x - z) / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -5e-130], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -5 \cdot 10^{-130}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999996e-130Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in y around 0 60.7%
if -4.9999999999999996e-130 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.1%
+-commutative95.1%
associate-*r/95.7%
associate-*l/95.6%
associate-*r/95.6%
associate-*l/95.6%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in x around 0 74.2%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -5e-130) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-5d-130)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -5e-130: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -5e-130) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -5e-130) tmp = (x - z) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -5e-130], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -5 \cdot 10^{-130}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999996e-130Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in y around 0 60.7%
if -4.9999999999999996e-130 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 74.3%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e+30) (not (<= z 3.7e-21))) (* z (/ -0.5 t)) (* 0.5 (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e+30) || !(z <= 3.7e-21)) {
tmp = z * (-0.5 / 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 <= (-7d+30)) .or. (.not. (z <= 3.7d-21))) then
tmp = z * ((-0.5d0) / 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 <= -7e+30) || !(z <= 3.7e-21)) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e+30) or not (z <= 3.7e-21): tmp = z * (-0.5 / t) else: tmp = 0.5 * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e+30) || !(z <= 3.7e-21)) tmp = Float64(z * Float64(-0.5 / 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 <= -7e+30) || ~((z <= 3.7e-21))) tmp = z * (-0.5 / t); else tmp = 0.5 * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e+30], N[Not[LessEqual[z, 3.7e-21]], $MachinePrecision]], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+30} \lor \neg \left(z \leq 3.7 \cdot 10^{-21}\right):\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -7.00000000000000042e30 or 3.7000000000000002e-21 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 70.6%
associate-*r/71.3%
associate-/l*71.0%
Simplified71.0%
associate-/r/71.1%
Applied egg-rr71.1%
if -7.00000000000000042e30 < z < 3.7000000000000002e-21Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around inf 49.9%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (<= z -8.6e+30) (* z (/ -0.5 t)) (if (<= z 1.5e-27) (* 0.5 (/ x t)) (* (/ z t) -0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.6e+30) {
tmp = z * (-0.5 / t);
} else if (z <= 1.5e-27) {
tmp = 0.5 * (x / t);
} else {
tmp = (z / t) * -0.5;
}
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 <= (-8.6d+30)) then
tmp = z * ((-0.5d0) / t)
else if (z <= 1.5d-27) then
tmp = 0.5d0 * (x / t)
else
tmp = (z / t) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.6e+30) {
tmp = z * (-0.5 / t);
} else if (z <= 1.5e-27) {
tmp = 0.5 * (x / t);
} else {
tmp = (z / t) * -0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.6e+30: tmp = z * (-0.5 / t) elif z <= 1.5e-27: tmp = 0.5 * (x / t) else: tmp = (z / t) * -0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.6e+30) tmp = Float64(z * Float64(-0.5 / t)); elseif (z <= 1.5e-27) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(Float64(z / t) * -0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.6e+30) tmp = z * (-0.5 / t); elseif (z <= 1.5e-27) tmp = 0.5 * (x / t); else tmp = (z / t) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.6e+30], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-27], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+30}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-27}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\end{array}
\end{array}
if z < -8.6e30Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 78.5%
associate-*r/80.1%
associate-/l*79.7%
Simplified79.7%
associate-/r/79.9%
Applied egg-rr79.9%
if -8.6e30 < z < 1.5000000000000001e-27Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around inf 49.9%
if 1.5000000000000001e-27 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 65.1%
*-commutative65.1%
Simplified65.1%
Final simplification59.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 99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in x around inf 36.0%
Final simplification36.0%
herbie shell --seed 2023297
(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)))