
(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 (* (/ (- z (+ x y)) t) -0.5))
double code(double x, double y, double z, double t) {
return ((z - (x + y)) / t) * -0.5;
}
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 - (x + y)) / t) * (-0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return ((z - (x + y)) / t) * -0.5;
}
def code(x, y, z, t): return ((z - (x + y)) / t) * -0.5
function code(x, y, z, t) return Float64(Float64(Float64(z - Float64(x + y)) / t) * -0.5) end
function tmp = code(x, y, z, t) tmp = ((z - (x + y)) / t) * -0.5; end
code[x_, y_, z_, t_] := N[(N[(N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{z - \left(x + y\right)}{t} \cdot -0.5
\end{array}
Initial program 99.6%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.3e+53) (* 0.5 (/ x t)) (if (<= x -2e-212) (* -0.5 (/ z t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.3e+53) {
tmp = 0.5 * (x / t);
} else if (x <= -2e-212) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.3d+53)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-2d-212)) then
tmp = (-0.5d0) * (z / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.3e+53) {
tmp = 0.5 * (x / t);
} else if (x <= -2e-212) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.3e+53: tmp = 0.5 * (x / t) elif x <= -2e-212: tmp = -0.5 * (z / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.3e+53) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -2e-212) tmp = Float64(-0.5 * Float64(z / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.3e+53) tmp = 0.5 * (x / t); elseif (x <= -2e-212) tmp = -0.5 * (z / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.3e+53], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e-212], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+53}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-212}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.29999999999999999e53Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 68.8%
if -1.29999999999999999e53 < x < -1.99999999999999991e-212Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 60.2%
if -1.99999999999999991e-212 < x Initial program 99.2%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 46.0%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.3e+51) (* 0.5 (/ x t)) (if (<= x -5.2e-180) (* z (/ -0.5 t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+51) {
tmp = 0.5 * (x / t);
} else if (x <= -5.2e-180) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.3d+51)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-5.2d-180)) then
tmp = z * ((-0.5d0) / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+51) {
tmp = 0.5 * (x / t);
} else if (x <= -5.2e-180) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e+51: tmp = 0.5 * (x / t) elif x <= -5.2e-180: tmp = z * (-0.5 / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+51) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -5.2e-180) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e+51) tmp = 0.5 * (x / t); elseif (x <= -5.2e-180) tmp = z * (-0.5 / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+51], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.2e-180], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+51}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-180}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.30000000000000005e51Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 68.8%
if -2.30000000000000005e51 < x < -5.1999999999999998e-180Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 58.2%
metadata-eval58.2%
distribute-lft-neg-in58.2%
*-lft-identity58.2%
associate-*l/58.1%
associate-*l*58.1%
*-commutative58.1%
distribute-rgt-neg-in58.1%
associate-*r/58.1%
metadata-eval58.1%
distribute-neg-frac58.1%
metadata-eval58.1%
Simplified58.1%
if -5.1999999999999998e-180 < x Initial program 99.3%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 46.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-222) (/ (* -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-222) {
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-222)) 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-222) {
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-222: 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-222) tmp = Float64(Float64(-0.5 * Float64(z - x)) / t); else tmp = Float64(Float64(-0.5 * Float64(z - y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -2e-222) 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-222], N[(N[(-0.5 * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(-0.5 * N[(z - y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-222}:\\
\;\;\;\;\frac{-0.5 \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot \left(z - y\right)}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000001e-222Initial program 99.3%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 70.9%
associate-*r/70.9%
Simplified70.9%
if -2.0000000000000001e-222 < (+.f64 x y) Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 70.9%
associate-*r/70.9%
Simplified70.9%
(FPCore (x y z t) :precision binary64 (if (<= y 2.6e+161) (/ (* -0.5 (- z x)) t) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.6e+161) {
tmp = (-0.5 * (z - x)) / t;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.6d+161) then
tmp = ((-0.5d0) * (z - x)) / t
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.6e+161) {
tmp = (-0.5 * (z - x)) / t;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.6e+161: tmp = (-0.5 * (z - x)) / t else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.6e+161) tmp = Float64(Float64(-0.5 * Float64(z - x)) / t); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.6e+161) tmp = (-0.5 * (z - x)) / t; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.6e+161], N[(N[(-0.5 * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+161}:\\
\;\;\;\;\frac{-0.5 \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 2.5999999999999998e161Initial program 99.6%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
Simplified75.7%
if 2.5999999999999998e161 < y Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 79.3%
(FPCore (x y z t) :precision binary64 (if (<= y 4.1e+161) (/ -0.5 (/ t (- z x))) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.1e+161) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.1d+161) then
tmp = (-0.5d0) / (t / (z - x))
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.1e+161) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.1e+161: tmp = -0.5 / (t / (z - x)) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.1e+161) tmp = Float64(-0.5 / Float64(t / Float64(z - x))); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.1e+161) tmp = -0.5 / (t / (z - x)); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.1e+161], N[(-0.5 / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.1 \cdot 10^{+161}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 4.1000000000000001e161Initial program 99.6%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
*-commutative100.0%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 75.5%
if 4.1000000000000001e161 < y Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 79.3%
(FPCore (x y z t) :precision binary64 (if (<= x -3.7e-25) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.7e-25) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.7d-25)) then
tmp = 0.5d0 * (x / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.7e-25) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.7e-25: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.7e-25) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.7e-25) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.7e-25], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-25}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -3.70000000000000009e-25Initial program 100.0%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 61.1%
if -3.70000000000000009e-25 < x Initial program 99.5%
associate-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 44.0%
(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-/r*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-frac-neg2100.0%
distribute-neg-frac100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 36.0%
herbie shell --seed 2024163
(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)))