
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-69) (/ (* x 0.5) t) (if (<= (+ x y) 8e+48) (/ (* z -0.5) t) (/ (* y 0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else if ((x + y) <= 8e+48) {
tmp = (z * -0.5) / t;
} else {
tmp = (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) <= (-5d-69)) then
tmp = (x * 0.5d0) / t
else if ((x + y) <= 8d+48) then
tmp = (z * (-0.5d0)) / t
else
tmp = (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) <= -5e-69) {
tmp = (x * 0.5) / t;
} else if ((x + y) <= 8e+48) {
tmp = (z * -0.5) / t;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-69: tmp = (x * 0.5) / t elif (x + y) <= 8e+48: tmp = (z * -0.5) / t else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-69) tmp = Float64(Float64(x * 0.5) / t); elseif (Float64(x + y) <= 8e+48) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-69) tmp = (x * 0.5) / t; elseif ((x + y) <= 8e+48) tmp = (z * -0.5) / t; else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-69], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 8e+48], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-69}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;x + y \leq 8 \cdot 10^{+48}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -5.00000000000000033e-69Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
if -5.00000000000000033e-69 < (+.f64 x y) < 8.00000000000000035e48Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6478.4
Applied rewrites78.4%
if 8.00000000000000035e48 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.5
Applied rewrites45.5%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-69) (/ (* x 0.5) t) (if (<= (+ x y) 8e+48) (* z (/ -0.5 t)) (/ (* y 0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else if ((x + y) <= 8e+48) {
tmp = z * (-0.5 / t);
} else {
tmp = (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) <= (-5d-69)) then
tmp = (x * 0.5d0) / t
else if ((x + y) <= 8d+48) then
tmp = z * ((-0.5d0) / t)
else
tmp = (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) <= -5e-69) {
tmp = (x * 0.5) / t;
} else if ((x + y) <= 8e+48) {
tmp = z * (-0.5 / t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-69: tmp = (x * 0.5) / t elif (x + y) <= 8e+48: tmp = z * (-0.5 / t) else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-69) tmp = Float64(Float64(x * 0.5) / t); elseif (Float64(x + y) <= 8e+48) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-69) tmp = (x * 0.5) / t; elseif ((x + y) <= 8e+48) tmp = z * (-0.5 / t); else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-69], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 8e+48], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-69}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;x + y \leq 8 \cdot 10^{+48}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -5.00000000000000033e-69Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
if -5.00000000000000033e-69 < (+.f64 x y) < 8.00000000000000035e48Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6478.4
Applied rewrites78.4%
Applied rewrites78.3%
if 8.00000000000000035e48 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.5
Applied rewrites45.5%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-115) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-115) {
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 ((x + y) <= (-2d-115)) 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 ((x + y) <= -2e-115) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-115: 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(x + y) <= -2e-115) 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 ((x + y) <= -2e-115) 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[(x + y), $MachinePrecision], -2e-115], 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}\;x + y \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000001e-115Initial program 100.0%
Taylor expanded in y around 0
lower--.f6462.9
Applied rewrites62.9%
if -2.0000000000000001e-115 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6473.2
Applied rewrites73.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-115) (/ (- x z) (* t 2.0)) (* (/ -0.5 t) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-115) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (-0.5 / t) * (z - 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 + y) <= (-2d-115)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = ((-0.5d0) / t) * (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-115) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (-0.5 / t) * (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-115: tmp = (x - z) / (t * 2.0) else: tmp = (-0.5 / t) * (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-115) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(-0.5 / t) * Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -2e-115) tmp = (x - z) / (t * 2.0); else tmp = (-0.5 / t) * (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-115], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000001e-115Initial program 100.0%
Taylor expanded in y around 0
lower--.f6462.9
Applied rewrites62.9%
if -2.0000000000000001e-115 < (+.f64 x y) Initial program 100.0%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/r*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower--.f6473.0
Applied rewrites73.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-115) (* (- x z) (/ 0.5 t)) (* (/ -0.5 t) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-115) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (-0.5 / t) * (z - 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 + y) <= (-2d-115)) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = ((-0.5d0) / t) * (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-115) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (-0.5 / t) * (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-115: tmp = (x - z) * (0.5 / t) else: tmp = (-0.5 / t) * (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-115) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(-0.5 / t) * Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -2e-115) tmp = (x - z) * (0.5 / t); else tmp = (-0.5 / t) * (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-115], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000001e-115Initial program 100.0%
Taylor expanded in y around 0
lower--.f6462.9
Applied rewrites62.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
if -2.0000000000000001e-115 < (+.f64 x y) Initial program 100.0%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/r*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower--.f6473.0
Applied rewrites73.0%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-69) (/ (* x 0.5) t) (* (/ -0.5 t) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else {
tmp = (-0.5 / t) * (z - 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 + y) <= (-5d-69)) then
tmp = (x * 0.5d0) / t
else
tmp = ((-0.5d0) / t) * (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else {
tmp = (-0.5 / t) * (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-69: tmp = (x * 0.5) / t else: tmp = (-0.5 / t) * (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-69) tmp = Float64(Float64(x * 0.5) / t); else tmp = Float64(Float64(-0.5 / t) * Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-69) tmp = (x * 0.5) / t; else tmp = (-0.5 / t) * (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-69], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-69}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -5.00000000000000033e-69Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
if -5.00000000000000033e-69 < (+.f64 x y) Initial program 100.0%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/r*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower--.f6473.8
Applied rewrites73.8%
Final simplification57.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-69) (/ (* x 0.5) t) (* z (/ -0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-5d-69)) then
tmp = (x * 0.5d0) / t
else
tmp = z * ((-0.5d0) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-69) {
tmp = (x * 0.5) / t;
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-69: tmp = (x * 0.5) / t else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-69) tmp = Float64(Float64(x * 0.5) / t); else tmp = Float64(z * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-69) tmp = (x * 0.5) / t; else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-69], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-69}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -5.00000000000000033e-69Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
if -5.00000000000000033e-69 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.4
Applied rewrites45.4%
Applied rewrites45.4%
Final simplification41.5%
(FPCore (x y z t) :precision binary64 (* (/ -0.5 t) (- z (+ x y))))
double code(double x, double y, double z, double t) {
return (-0.5 / t) * (z - (x + y));
}
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) * (z - (x + y))
end function
public static double code(double x, double y, double z, double t) {
return (-0.5 / t) * (z - (x + y));
}
def code(x, y, z, t): return (-0.5 / t) * (z - (x + y))
function code(x, y, z, t) return Float64(Float64(-0.5 / t) * Float64(z - Float64(x + y))) end
function tmp = code(x, y, z, t) tmp = (-0.5 / t) * (z - (x + y)); end
code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{t} \cdot \left(z - \left(x + y\right)\right)
\end{array}
Initial program 100.0%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/r*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.7
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (* z (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return z * (-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 * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return z * (-0.5 / t);
}
def code(x, y, z, t): return z * (-0.5 / t)
function code(x, y, z, t) return Float64(z * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = z * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.4
Applied rewrites38.4%
Applied rewrites38.3%
Final simplification38.3%
herbie shell --seed 2024228
(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)))