
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 1e+39)
(/ (* x_m (+ (- y z) 1.0)) z)
(- (/ x_m (/ z (+ y 1.0))) x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 1e+39) {
tmp = (x_m * ((y - z) + 1.0)) / z;
} else {
tmp = (x_m / (z / (y + 1.0))) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 1d+39) then
tmp = (x_m * ((y - z) + 1.0d0)) / z
else
tmp = (x_m / (z / (y + 1.0d0))) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 1e+39) {
tmp = (x_m * ((y - z) + 1.0)) / z;
} else {
tmp = (x_m / (z / (y + 1.0))) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 1e+39: tmp = (x_m * ((y - z) + 1.0)) / z else: tmp = (x_m / (z / (y + 1.0))) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 1e+39) tmp = Float64(Float64(x_m * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(Float64(x_m / Float64(z / Float64(y + 1.0))) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (x_m <= 1e+39) tmp = (x_m * ((y - z) + 1.0)) / z; else tmp = (x_m / (z / (y + 1.0))) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 1e+39], N[(N[(x$95$m * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / N[(z / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 10^{+39}:\\
\;\;\;\;\frac{x\_m \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y + 1}} - x\_m\\
\end{array}
\end{array}
if x < 9.9999999999999994e38Initial program 92.6%
if 9.9999999999999994e38 < x Initial program 74.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
distribute-lft-in99.8%
clear-num99.9%
un-div-inv99.9%
*-commutative99.9%
mul-1-neg99.9%
Applied egg-rr99.9%
Final simplification94.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* y (/ x_m z))))
(*
x_s
(if (<= z -2e+53)
(- x_m)
(if (<= z -1.45e-14)
t_0
(if (<= z -1.1e-92) (/ x_m z) (if (<= z 1.8e+26) t_0 (- x_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = y * (x_m / z);
double tmp;
if (z <= -2e+53) {
tmp = -x_m;
} else if (z <= -1.45e-14) {
tmp = t_0;
} else if (z <= -1.1e-92) {
tmp = x_m / z;
} else if (z <= 1.8e+26) {
tmp = t_0;
} else {
tmp = -x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * (x_m / z)
if (z <= (-2d+53)) then
tmp = -x_m
else if (z <= (-1.45d-14)) then
tmp = t_0
else if (z <= (-1.1d-92)) then
tmp = x_m / z
else if (z <= 1.8d+26) then
tmp = t_0
else
tmp = -x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = y * (x_m / z);
double tmp;
if (z <= -2e+53) {
tmp = -x_m;
} else if (z <= -1.45e-14) {
tmp = t_0;
} else if (z <= -1.1e-92) {
tmp = x_m / z;
} else if (z <= 1.8e+26) {
tmp = t_0;
} else {
tmp = -x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = y * (x_m / z) tmp = 0 if z <= -2e+53: tmp = -x_m elif z <= -1.45e-14: tmp = t_0 elif z <= -1.1e-92: tmp = x_m / z elif z <= 1.8e+26: tmp = t_0 else: tmp = -x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(y * Float64(x_m / z)) tmp = 0.0 if (z <= -2e+53) tmp = Float64(-x_m); elseif (z <= -1.45e-14) tmp = t_0; elseif (z <= -1.1e-92) tmp = Float64(x_m / z); elseif (z <= 1.8e+26) tmp = t_0; else tmp = Float64(-x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = y * (x_m / z); tmp = 0.0; if (z <= -2e+53) tmp = -x_m; elseif (z <= -1.45e-14) tmp = t_0; elseif (z <= -1.1e-92) tmp = x_m / z; elseif (z <= 1.8e+26) tmp = t_0; else tmp = -x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -2e+53], (-x$95$m), If[LessEqual[z, -1.45e-14], t$95$0, If[LessEqual[z, -1.1e-92], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 1.8e+26], t$95$0, (-x$95$m)]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := y \cdot \frac{x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+53}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-92}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -2e53 or 1.80000000000000012e26 < z Initial program 71.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 80.3%
neg-mul-180.3%
Simplified80.3%
if -2e53 < z < -1.4500000000000001e-14 or -1.09999999999999994e-92 < z < 1.80000000000000012e26Initial program 99.9%
associate-/l*87.7%
+-commutative87.7%
associate-+r-87.7%
div-sub87.7%
*-inverses87.7%
sub-neg87.7%
metadata-eval87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in y around inf 60.4%
*-commutative60.4%
associate-/l*62.5%
Applied egg-rr62.5%
if -1.4500000000000001e-14 < z < -1.09999999999999994e-92Initial program 100.0%
associate-/l*99.6%
+-commutative99.6%
associate-+r-99.6%
div-sub99.5%
*-inverses99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 81.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* x_m (/ y z))))
(*
x_s
(if (<= z -9.6e+53)
(- x_m)
(if (<= z -6e-15)
t_0
(if (<= z 1.6e-40) (/ x_m z) (if (<= z 1.32e+26) t_0 (- x_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = x_m * (y / z);
double tmp;
if (z <= -9.6e+53) {
tmp = -x_m;
} else if (z <= -6e-15) {
tmp = t_0;
} else if (z <= 1.6e-40) {
tmp = x_m / z;
} else if (z <= 1.32e+26) {
tmp = t_0;
} else {
tmp = -x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x_m * (y / z)
if (z <= (-9.6d+53)) then
tmp = -x_m
else if (z <= (-6d-15)) then
tmp = t_0
else if (z <= 1.6d-40) then
tmp = x_m / z
else if (z <= 1.32d+26) then
tmp = t_0
else
tmp = -x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = x_m * (y / z);
double tmp;
if (z <= -9.6e+53) {
tmp = -x_m;
} else if (z <= -6e-15) {
tmp = t_0;
} else if (z <= 1.6e-40) {
tmp = x_m / z;
} else if (z <= 1.32e+26) {
tmp = t_0;
} else {
tmp = -x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = x_m * (y / z) tmp = 0 if z <= -9.6e+53: tmp = -x_m elif z <= -6e-15: tmp = t_0 elif z <= 1.6e-40: tmp = x_m / z elif z <= 1.32e+26: tmp = t_0 else: tmp = -x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(x_m * Float64(y / z)) tmp = 0.0 if (z <= -9.6e+53) tmp = Float64(-x_m); elseif (z <= -6e-15) tmp = t_0; elseif (z <= 1.6e-40) tmp = Float64(x_m / z); elseif (z <= 1.32e+26) tmp = t_0; else tmp = Float64(-x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = x_m * (y / z); tmp = 0.0; if (z <= -9.6e+53) tmp = -x_m; elseif (z <= -6e-15) tmp = t_0; elseif (z <= 1.6e-40) tmp = x_m / z; elseif (z <= 1.32e+26) tmp = t_0; else tmp = -x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -9.6e+53], (-x$95$m), If[LessEqual[z, -6e-15], t$95$0, If[LessEqual[z, 1.6e-40], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 1.32e+26], t$95$0, (-x$95$m)]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{+53}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-40}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -9.5999999999999999e53 or 1.32e26 < z Initial program 71.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 80.3%
neg-mul-180.3%
Simplified80.3%
if -9.5999999999999999e53 < z < -6e-15 or 1.60000000000000001e-40 < z < 1.32e26Initial program 99.7%
associate-/l*99.7%
+-commutative99.7%
associate-+r-99.7%
div-sub99.6%
*-inverses99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around inf 65.6%
associate-/l*65.6%
Simplified65.6%
if -6e-15 < z < 1.60000000000000001e-40Initial program 100.0%
associate-/l*86.9%
+-commutative86.9%
associate-+r-86.9%
div-sub86.9%
*-inverses86.9%
sub-neg86.9%
metadata-eval86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 56.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -3.2e+180)
(/ (* x_m y) z)
(if (or (<= y -1.0) (not (<= y 3.1e-13)))
(* x_m (+ -1.0 (/ y z)))
(- (/ x_m z) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= -3.2e+180) {
tmp = (x_m * y) / z;
} else if ((y <= -1.0) || !(y <= 3.1e-13)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.2d+180)) then
tmp = (x_m * y) / z
else if ((y <= (-1.0d0)) .or. (.not. (y <= 3.1d-13))) then
tmp = x_m * ((-1.0d0) + (y / z))
else
tmp = (x_m / z) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= -3.2e+180) {
tmp = (x_m * y) / z;
} else if ((y <= -1.0) || !(y <= 3.1e-13)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if y <= -3.2e+180: tmp = (x_m * y) / z elif (y <= -1.0) or not (y <= 3.1e-13): tmp = x_m * (-1.0 + (y / z)) else: tmp = (x_m / z) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -3.2e+180) tmp = Float64(Float64(x_m * y) / z); elseif ((y <= -1.0) || !(y <= 3.1e-13)) tmp = Float64(x_m * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(x_m / z) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (y <= -3.2e+180) tmp = (x_m * y) / z; elseif ((y <= -1.0) || ~((y <= 3.1e-13))) tmp = x_m * (-1.0 + (y / z)); else tmp = (x_m / z) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, -3.2e+180], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 3.1e-13]], $MachinePrecision]], N[(x$95$m * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+180}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 3.1 \cdot 10^{-13}\right):\\
\;\;\;\;x\_m \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -3.19999999999999994e180Initial program 91.4%
associate-/l*76.1%
+-commutative76.1%
associate-+r-76.1%
div-sub76.1%
*-inverses76.1%
sub-neg76.1%
metadata-eval76.1%
+-commutative76.1%
Simplified76.1%
Taylor expanded in y around inf 91.2%
if -3.19999999999999994e180 < y < -1 or 3.0999999999999999e-13 < y Initial program 89.9%
associate-/l*91.7%
+-commutative91.7%
associate-+r-91.7%
div-sub91.7%
*-inverses91.7%
sub-neg91.7%
metadata-eval91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in y around inf 90.6%
if -1 < y < 3.0999999999999999e-13Initial program 85.8%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
distribute-lft-in99.8%
clear-num99.8%
un-div-inv100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 100.0%
Final simplification95.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= z -2e-16) (not (<= z 1.9e-39)))
(* x_m (+ (/ (+ y 1.0) z) -1.0))
(/ (* x_m (+ y 1.0)) z))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -2e-16) || !(z <= 1.9e-39)) {
tmp = x_m * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x_m * (y + 1.0)) / z;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-2d-16)) .or. (.not. (z <= 1.9d-39))) then
tmp = x_m * (((y + 1.0d0) / z) + (-1.0d0))
else
tmp = (x_m * (y + 1.0d0)) / z
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -2e-16) || !(z <= 1.9e-39)) {
tmp = x_m * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x_m * (y + 1.0)) / z;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -2e-16) or not (z <= 1.9e-39): tmp = x_m * (((y + 1.0) / z) + -1.0) else: tmp = (x_m * (y + 1.0)) / z return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -2e-16) || !(z <= 1.9e-39)) tmp = Float64(x_m * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); else tmp = Float64(Float64(x_m * Float64(y + 1.0)) / z); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -2e-16) || ~((z <= 1.9e-39))) tmp = x_m * (((y + 1.0) / z) + -1.0); else tmp = (x_m * (y + 1.0)) / z; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -2e-16], N[Not[LessEqual[z, 1.9e-39]], $MachinePrecision]], N[(x$95$m * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-16} \lor \neg \left(z \leq 1.9 \cdot 10^{-39}\right):\\
\;\;\;\;x\_m \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -2e-16 or 1.9000000000000001e-39 < z Initial program 77.1%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if -2e-16 < z < 1.9000000000000001e-39Initial program 99.9%
associate-/l*86.8%
+-commutative86.8%
associate-+r-86.8%
div-sub86.8%
*-inverses86.8%
sub-neg86.8%
metadata-eval86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= z -0.9) (not (<= z 2.05e-12)))
(* x_m (+ -1.0 (/ y z)))
(/ (* x_m (+ y 1.0)) z))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -0.9) || !(z <= 2.05e-12)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (x_m * (y + 1.0)) / z;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.9d0)) .or. (.not. (z <= 2.05d-12))) then
tmp = x_m * ((-1.0d0) + (y / z))
else
tmp = (x_m * (y + 1.0d0)) / z
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -0.9) || !(z <= 2.05e-12)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (x_m * (y + 1.0)) / z;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -0.9) or not (z <= 2.05e-12): tmp = x_m * (-1.0 + (y / z)) else: tmp = (x_m * (y + 1.0)) / z return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -0.9) || !(z <= 2.05e-12)) tmp = Float64(x_m * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(x_m * Float64(y + 1.0)) / z); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -0.9) || ~((z <= 2.05e-12))) tmp = x_m * (-1.0 + (y / z)); else tmp = (x_m * (y + 1.0)) / z; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -0.9], N[Not[LessEqual[z, 2.05e-12]], $MachinePrecision]], N[(x$95$m * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -0.9 \lor \neg \left(z \leq 2.05 \cdot 10^{-12}\right):\\
\;\;\;\;x\_m \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -0.900000000000000022 or 2.04999999999999995e-12 < z Initial program 75.3%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 98.7%
if -0.900000000000000022 < z < 2.04999999999999995e-12Initial program 99.9%
associate-/l*87.8%
+-commutative87.8%
associate-+r-87.8%
div-sub87.8%
*-inverses87.8%
sub-neg87.8%
metadata-eval87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in z around 0 98.7%
Final simplification98.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -0.92)
(* x_m (+ -1.0 (/ y z)))
(if (<= z 2.05e-12) (/ (* x_m (+ y 1.0)) z) (- (/ x_m (/ z y)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -0.92) {
tmp = x_m * (-1.0 + (y / z));
} else if (z <= 2.05e-12) {
tmp = (x_m * (y + 1.0)) / z;
} else {
tmp = (x_m / (z / y)) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.92d0)) then
tmp = x_m * ((-1.0d0) + (y / z))
else if (z <= 2.05d-12) then
tmp = (x_m * (y + 1.0d0)) / z
else
tmp = (x_m / (z / y)) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -0.92) {
tmp = x_m * (-1.0 + (y / z));
} else if (z <= 2.05e-12) {
tmp = (x_m * (y + 1.0)) / z;
} else {
tmp = (x_m / (z / y)) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -0.92: tmp = x_m * (-1.0 + (y / z)) elif z <= 2.05e-12: tmp = (x_m * (y + 1.0)) / z else: tmp = (x_m / (z / y)) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -0.92) tmp = Float64(x_m * Float64(-1.0 + Float64(y / z))); elseif (z <= 2.05e-12) tmp = Float64(Float64(x_m * Float64(y + 1.0)) / z); else tmp = Float64(Float64(x_m / Float64(z / y)) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -0.92) tmp = x_m * (-1.0 + (y / z)); elseif (z <= 2.05e-12) tmp = (x_m * (y + 1.0)) / z; else tmp = (x_m / (z / y)) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -0.92], N[(x$95$m * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e-12], N[(N[(x$95$m * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / N[(z / y), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -0.92:\\
\;\;\;\;x\_m \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-12}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y}} - x\_m\\
\end{array}
\end{array}
if z < -0.92000000000000004Initial program 71.7%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 98.4%
if -0.92000000000000004 < z < 2.04999999999999995e-12Initial program 99.9%
associate-/l*87.8%
+-commutative87.8%
associate-+r-87.8%
div-sub87.8%
*-inverses87.8%
sub-neg87.8%
metadata-eval87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in z around 0 98.7%
if 2.04999999999999995e-12 < z Initial program 78.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
distribute-lft-in99.8%
clear-num99.8%
un-div-inv99.9%
*-commutative99.9%
mul-1-neg99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 99.0%
Final simplification98.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= y -4.6) (not (<= y 4.8e+120)))
(/ y (/ z x_m))
(- (/ x_m z) x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -4.6) || !(y <= 4.8e+120)) {
tmp = y / (z / x_m);
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-4.6d0)) .or. (.not. (y <= 4.8d+120))) then
tmp = y / (z / x_m)
else
tmp = (x_m / z) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -4.6) || !(y <= 4.8e+120)) {
tmp = y / (z / x_m);
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (y <= -4.6) or not (y <= 4.8e+120): tmp = y / (z / x_m) else: tmp = (x_m / z) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((y <= -4.6) || !(y <= 4.8e+120)) tmp = Float64(y / Float64(z / x_m)); else tmp = Float64(Float64(x_m / z) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((y <= -4.6) || ~((y <= 4.8e+120))) tmp = y / (z / x_m); else tmp = (x_m / z) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -4.6], N[Not[LessEqual[y, 4.8e+120]], $MachinePrecision]], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.6 \lor \neg \left(y \leq 4.8 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -4.5999999999999996 or 4.80000000000000002e120 < y Initial program 89.7%
associate-/l*86.9%
+-commutative86.9%
associate-+r-86.9%
div-sub86.9%
*-inverses86.9%
sub-neg86.9%
metadata-eval86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in y around inf 76.6%
*-commutative76.6%
associate-/l*77.3%
Applied egg-rr77.3%
clear-num77.2%
un-div-inv77.3%
Applied egg-rr77.3%
if -4.5999999999999996 < y < 4.80000000000000002e120Initial program 87.0%
associate-/l*98.6%
+-commutative98.6%
associate-+r-98.6%
div-sub98.5%
*-inverses98.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
distribute-lft-in98.5%
clear-num98.5%
un-div-inv98.9%
*-commutative98.9%
mul-1-neg98.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 94.1%
Final simplification86.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= y -8.0) (not (<= y 4.4e+122)))
(* y (/ x_m z))
(- (/ x_m z) x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -8.0) || !(y <= 4.4e+122)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-8.0d0)) .or. (.not. (y <= 4.4d+122))) then
tmp = y * (x_m / z)
else
tmp = (x_m / z) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -8.0) || !(y <= 4.4e+122)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (y <= -8.0) or not (y <= 4.4e+122): tmp = y * (x_m / z) else: tmp = (x_m / z) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((y <= -8.0) || !(y <= 4.4e+122)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(Float64(x_m / z) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((y <= -8.0) || ~((y <= 4.4e+122))) tmp = y * (x_m / z); else tmp = (x_m / z) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -8.0], N[Not[LessEqual[y, 4.4e+122]], $MachinePrecision]], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8 \lor \neg \left(y \leq 4.4 \cdot 10^{+122}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -8 or 4.3999999999999998e122 < y Initial program 89.7%
associate-/l*86.9%
+-commutative86.9%
associate-+r-86.9%
div-sub86.9%
*-inverses86.9%
sub-neg86.9%
metadata-eval86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in y around inf 76.6%
*-commutative76.6%
associate-/l*77.3%
Applied egg-rr77.3%
if -8 < y < 4.3999999999999998e122Initial program 87.0%
associate-/l*98.6%
+-commutative98.6%
associate-+r-98.6%
div-sub98.5%
*-inverses98.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
distribute-lft-in98.5%
clear-num98.5%
un-div-inv98.9%
*-commutative98.9%
mul-1-neg98.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 94.1%
Final simplification86.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -4.6)
(/ (* x_m y) z)
(if (<= y 5.8e+118) (- (/ x_m z) x_m) (/ y (/ z x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= -4.6) {
tmp = (x_m * y) / z;
} else if (y <= 5.8e+118) {
tmp = (x_m / z) - x_m;
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-4.6d0)) then
tmp = (x_m * y) / z
else if (y <= 5.8d+118) then
tmp = (x_m / z) - x_m
else
tmp = y / (z / x_m)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= -4.6) {
tmp = (x_m * y) / z;
} else if (y <= 5.8e+118) {
tmp = (x_m / z) - x_m;
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if y <= -4.6: tmp = (x_m * y) / z elif y <= 5.8e+118: tmp = (x_m / z) - x_m else: tmp = y / (z / x_m) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -4.6) tmp = Float64(Float64(x_m * y) / z); elseif (y <= 5.8e+118) tmp = Float64(Float64(x_m / z) - x_m); else tmp = Float64(y / Float64(z / x_m)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (y <= -4.6) tmp = (x_m * y) / z; elseif (y <= 5.8e+118) tmp = (x_m / z) - x_m; else tmp = y / (z / x_m); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, -4.6], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 5.8e+118], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.6:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+118}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\end{array}
\end{array}
if y < -4.5999999999999996Initial program 90.3%
associate-/l*83.9%
+-commutative83.9%
associate-+r-83.9%
div-sub83.9%
*-inverses83.9%
sub-neg83.9%
metadata-eval83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in y around inf 76.5%
if -4.5999999999999996 < y < 5.80000000000000032e118Initial program 87.0%
associate-/l*98.6%
+-commutative98.6%
associate-+r-98.6%
div-sub98.5%
*-inverses98.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
distribute-lft-in98.5%
clear-num98.5%
un-div-inv98.9%
*-commutative98.9%
mul-1-neg98.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 94.1%
if 5.80000000000000032e118 < y Initial program 88.5%
associate-/l*93.9%
+-commutative93.9%
associate-+r-93.9%
div-sub94.0%
*-inverses94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around inf 76.9%
*-commutative76.9%
associate-/l*79.7%
Applied egg-rr79.7%
clear-num79.6%
un-div-inv79.8%
Applied egg-rr79.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (* x_s (if (<= x_m 3.3e-43) (/ (* x_m t_0) z) (* t_0 (/ x_m z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x_m <= 3.3e-43) {
tmp = (x_m * t_0) / z;
} else {
tmp = t_0 * (x_m / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if (x_m <= 3.3d-43) then
tmp = (x_m * t_0) / z
else
tmp = t_0 * (x_m / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x_m <= 3.3e-43) {
tmp = (x_m * t_0) / z;
} else {
tmp = t_0 * (x_m / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = (y - z) + 1.0 tmp = 0 if x_m <= 3.3e-43: tmp = (x_m * t_0) / z else: tmp = t_0 * (x_m / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (x_m <= 3.3e-43) tmp = Float64(Float64(x_m * t_0) / z); else tmp = Float64(t_0 * Float64(x_m / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (x_m <= 3.3e-43) tmp = (x_m * t_0) / z; else tmp = t_0 * (x_m / z); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[x$95$m, 3.3e-43], N[(N[(x$95$m * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(t$95$0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 3.3 \cdot 10^{-43}:\\
\;\;\;\;\frac{x\_m \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
\end{array}
if x < 3.30000000000000016e-43Initial program 92.1%
if 3.30000000000000016e-43 < x Initial program 78.5%
*-commutative78.5%
associate-/l*99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification94.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -1.0) (not (<= z 3.6e-6))) (- x_m) (/ x_m z))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 3.6e-6)) {
tmp = -x_m;
} else {
tmp = x_m / z;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 3.6d-6))) then
tmp = -x_m
else
tmp = x_m / z
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 3.6e-6)) {
tmp = -x_m;
} else {
tmp = x_m / z;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -1.0) or not (z <= 3.6e-6): tmp = -x_m else: tmp = x_m / z return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 3.6e-6)) tmp = Float64(-x_m); else tmp = Float64(x_m / z); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 3.6e-6))) tmp = -x_m; else tmp = x_m / z; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 3.6e-6]], $MachinePrecision]], (-x$95$m), N[(x$95$m / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 3.6 \cdot 10^{-6}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -1 or 3.59999999999999984e-6 < z Initial program 74.8%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 74.4%
neg-mul-174.4%
Simplified74.4%
if -1 < z < 3.59999999999999984e-6Initial program 99.9%
associate-/l*88.0%
+-commutative88.0%
associate-+r-88.0%
div-sub88.0%
*-inverses88.0%
sub-neg88.0%
metadata-eval88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in z around 0 98.7%
Taylor expanded in y around 0 54.2%
Final simplification63.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (- x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * -x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * -x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * -x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * -x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(-x_m)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * -x_m; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * (-x$95$m)), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(-x\_m\right)
\end{array}
Initial program 88.2%
associate-/l*93.5%
+-commutative93.5%
associate-+r-93.5%
div-sub93.5%
*-inverses93.5%
sub-neg93.5%
metadata-eval93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in z around inf 36.7%
neg-mul-136.7%
Simplified36.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * x_m) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * x_m; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot x\_m
\end{array}
Initial program 88.2%
associate-/l*93.5%
+-commutative93.5%
associate-+r-93.5%
div-sub93.5%
*-inverses93.5%
sub-neg93.5%
metadata-eval93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in z around inf 36.7%
neg-mul-136.7%
Simplified36.7%
neg-sub036.7%
sub-neg36.7%
add-sqr-sqrt17.7%
sqrt-unprod18.7%
sqr-neg18.7%
sqrt-unprod1.2%
add-sqr-sqrt2.6%
Applied egg-rr2.6%
Taylor expanded in x around 0 2.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024113
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -67870776678359/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (+ 1 y) (/ x z)) x) (if (< x 1937054408219773/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x))))
(/ (* x (+ (- y z) 1.0)) z))