
(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 13 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 4e-60)
(- (/ (* x_m (+ y 1.0)) z) x_m)
(/ x_m (/ z (+ 1.0 (- y 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 (x_m <= 4e-60) {
tmp = ((x_m * (y + 1.0)) / z) - x_m;
} else {
tmp = x_m / (z / (1.0 + (y - 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 (x_m <= 4d-60) then
tmp = ((x_m * (y + 1.0d0)) / z) - x_m
else
tmp = x_m / (z / (1.0d0 + (y - 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 (x_m <= 4e-60) {
tmp = ((x_m * (y + 1.0)) / z) - x_m;
} else {
tmp = x_m / (z / (1.0 + (y - 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 x_m <= 4e-60: tmp = ((x_m * (y + 1.0)) / z) - x_m else: tmp = x_m / (z / (1.0 + (y - 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 (x_m <= 4e-60) tmp = Float64(Float64(Float64(x_m * Float64(y + 1.0)) / z) - x_m); else tmp = Float64(x_m / Float64(z / Float64(1.0 + Float64(y - 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 (x_m <= 4e-60) tmp = ((x_m * (y + 1.0)) / z) - x_m; else tmp = x_m / (z / (1.0 + (y - 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[LessEqual[x$95$m, 4e-60], N[(N[(N[(x$95$m * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(x$95$m / N[(z / N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $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}\;x\_m \leq 4 \cdot 10^{-60}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{1 + \left(y - z\right)}}\\
\end{array}
\end{array}
if x < 3.9999999999999999e-60Initial program 91.3%
associate-/l*93.7%
+-commutative93.7%
associate-+r-93.7%
div-sub93.7%
*-inverses93.7%
sub-neg93.7%
metadata-eval93.7%
+-commutative93.7%
Simplified93.7%
distribute-lft-in93.7%
associate-*r/97.4%
*-commutative97.4%
mul-1-neg97.4%
Applied egg-rr97.4%
if 3.9999999999999999e-60 < x Initial program 77.3%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification98.1%
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 (+ -1.0 (/ y z)))))
(*
x_s
(if (<= y -1.0)
t_0
(if (<= y 1.0)
(- (/ x_m z) x_m)
(if (<= y 4.3e+123) t_0 (* y (/ 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 = x_m * (-1.0 + (y / z));
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = (x_m / z) - x_m;
} else if (y <= 4.3e+123) {
tmp = t_0;
} else {
tmp = y * (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 = x_m * ((-1.0d0) + (y / z))
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= 1.0d0) then
tmp = (x_m / z) - x_m
else if (y <= 4.3d+123) then
tmp = t_0
else
tmp = y * (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 = x_m * (-1.0 + (y / z));
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = (x_m / z) - x_m;
} else if (y <= 4.3e+123) {
tmp = t_0;
} else {
tmp = y * (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 = x_m * (-1.0 + (y / z)) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= 1.0: tmp = (x_m / z) - x_m elif y <= 4.3e+123: tmp = t_0 else: tmp = y * (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(x_m * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= 1.0) tmp = Float64(Float64(x_m / z) - x_m); elseif (y <= 4.3e+123) tmp = t_0; else tmp = Float64(y * 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 = x_m * (-1.0 + (y / z)); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= 1.0) tmp = (x_m / z) - x_m; elseif (y <= 4.3e+123) tmp = t_0; else tmp = y * (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[(x$95$m * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.0], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision], If[LessEqual[y, 4.3e+123], t$95$0, N[(y * 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 := x\_m \cdot \left(-1 + \frac{y}{z}\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+123}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
\end{array}
if y < -1 or 1 < y < 4.29999999999999986e123Initial program 89.7%
associate-/l*96.9%
+-commutative96.9%
associate-+r-96.9%
div-sub97.0%
*-inverses97.0%
sub-neg97.0%
metadata-eval97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in y around inf 96.9%
if -1 < y < 1Initial program 84.1%
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 0 99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
associate-*l/99.4%
*-lft-identity99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
if 4.29999999999999986e123 < y Initial program 92.0%
associate-/l*76.9%
+-commutative76.9%
associate-+r-76.9%
div-sub76.9%
*-inverses76.9%
sub-neg76.9%
metadata-eval76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in y around inf 89.5%
*-commutative89.5%
associate-/l*89.7%
Applied egg-rr89.7%
Final simplification97.0%
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 -1.0) (not (<= y 1.0)))
(- (* y (/ x_m 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 <= -1.0) || !(y <= 1.0)) {
tmp = (y * (x_m / 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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = (y * (x_m / 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 <= -1.0) || !(y <= 1.0)) {
tmp = (y * (x_m / 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 <= -1.0) or not (y <= 1.0): tmp = (y * (x_m / 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 <= -1.0) || !(y <= 1.0)) tmp = Float64(Float64(y * Float64(x_m / 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 <= -1.0) || ~((y <= 1.0))) tmp = (y * (x_m / 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, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] - x$95$m), $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 -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 90.3%
associate-/l*91.6%
+-commutative91.6%
associate-+r-91.6%
div-sub91.6%
*-inverses91.6%
sub-neg91.6%
metadata-eval91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in y around inf 91.5%
distribute-rgt-in91.6%
neg-mul-191.6%
fma-define91.6%
fma-neg91.6%
associate-*l/93.6%
associate-*r/97.7%
Applied egg-rr97.7%
if -1 < y < 1Initial program 84.1%
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 0 99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
associate-*l/99.4%
*-lft-identity99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
Final simplification98.5%
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 8e-13)))
(* 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 <= -1.0) || !(z <= 8e-13)) {
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 <= (-1.0d0)) .or. (.not. (z <= 8d-13))) 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 <= -1.0) || !(z <= 8e-13)) {
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 <= -1.0) or not (z <= 8e-13): 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 <= -1.0) || !(z <= 8e-13)) 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 <= -1.0) || ~((z <= 8e-13))) 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, -1.0], N[Not[LessEqual[z, 8e-13]], $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 -1 \lor \neg \left(z \leq 8 \cdot 10^{-13}\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 < -1 or 8.0000000000000002e-13 < z Initial program 76.2%
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 99.1%
if -1 < z < 8.0000000000000002e-13Initial program 99.9%
associate-/l*90.5%
+-commutative90.5%
associate-+r-90.5%
div-sub90.5%
*-inverses90.5%
sub-neg90.5%
metadata-eval90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in z around 0 99.8%
Final simplification99.4%
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.05) (not (<= z 8e-13)))
(- (* x_m (/ y z)) x_m)
(/ (* 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 <= -1.05) || !(z <= 8e-13)) {
tmp = (x_m * (y / z)) - x_m;
} 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 <= (-1.05d0)) .or. (.not. (z <= 8d-13))) then
tmp = (x_m * (y / z)) - x_m
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 <= -1.05) || !(z <= 8e-13)) {
tmp = (x_m * (y / z)) - x_m;
} 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 <= -1.05) or not (z <= 8e-13): tmp = (x_m * (y / z)) - x_m 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 <= -1.05) || !(z <= 8e-13)) tmp = Float64(Float64(x_m * Float64(y / z)) - x_m); 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 <= -1.05) || ~((z <= 8e-13))) tmp = (x_m * (y / z)) - x_m; 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, -1.05], N[Not[LessEqual[z, 8e-13]], $MachinePrecision]], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision] - x$95$m), $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 -1.05 \lor \neg \left(z \leq 8 \cdot 10^{-13}\right):\\
\;\;\;\;x\_m \cdot \frac{y}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -1.05000000000000004 or 8.0000000000000002e-13 < z Initial program 76.2%
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%
distribute-lft-in99.9%
associate-*r/93.6%
*-commutative93.6%
mul-1-neg93.6%
Applied egg-rr93.6%
Taylor expanded in y around inf 92.8%
associate-*r/99.1%
Simplified99.1%
if -1.05000000000000004 < z < 8.0000000000000002e-13Initial program 99.9%
associate-/l*90.5%
+-commutative90.5%
associate-+r-90.5%
div-sub90.5%
*-inverses90.5%
sub-neg90.5%
metadata-eval90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in z around 0 99.8%
Final simplification99.4%
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 -4.6e+49) (not (<= z 5.2e+29))) (- x_m) (* x_m (/ y 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 <= -4.6e+49) || !(z <= 5.2e+29)) {
tmp = -x_m;
} else {
tmp = x_m * (y / 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 <= (-4.6d+49)) .or. (.not. (z <= 5.2d+29))) then
tmp = -x_m
else
tmp = x_m * (y / 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 <= -4.6e+49) || !(z <= 5.2e+29)) {
tmp = -x_m;
} else {
tmp = x_m * (y / 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 <= -4.6e+49) or not (z <= 5.2e+29): tmp = -x_m else: tmp = x_m * (y / 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 <= -4.6e+49) || !(z <= 5.2e+29)) tmp = Float64(-x_m); else tmp = Float64(x_m * Float64(y / 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 <= -4.6e+49) || ~((z <= 5.2e+29))) tmp = -x_m; else tmp = x_m * (y / 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, -4.6e+49], N[Not[LessEqual[z, 5.2e+29]], $MachinePrecision]], (-x$95$m), N[(x$95$m * N[(y / z), $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}\;z \leq -4.6 \cdot 10^{+49} \lor \neg \left(z \leq 5.2 \cdot 10^{+29}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -4.60000000000000004e49 or 5.2e29 < z Initial program 72.5%
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 81.3%
neg-mul-181.3%
Simplified81.3%
if -4.60000000000000004e49 < z < 5.2e29Initial program 99.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 60.5%
associate-/l*52.5%
Simplified52.5%
Final simplification65.5%
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 -4.6e+49) (not (<= z 5.5e+29))) (- x_m) (* y (/ 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 <= -4.6e+49) || !(z <= 5.5e+29)) {
tmp = -x_m;
} else {
tmp = y * (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 <= (-4.6d+49)) .or. (.not. (z <= 5.5d+29))) then
tmp = -x_m
else
tmp = y * (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 <= -4.6e+49) || !(z <= 5.5e+29)) {
tmp = -x_m;
} else {
tmp = y * (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 <= -4.6e+49) or not (z <= 5.5e+29): tmp = -x_m else: tmp = y * (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 <= -4.6e+49) || !(z <= 5.5e+29)) tmp = Float64(-x_m); else tmp = Float64(y * 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 <= -4.6e+49) || ~((z <= 5.5e+29))) tmp = -x_m; else tmp = y * (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, -4.6e+49], N[Not[LessEqual[z, 5.5e+29]], $MachinePrecision]], (-x$95$m), N[(y * N[(x$95$m / z), $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}\;z \leq -4.6 \cdot 10^{+49} \lor \neg \left(z \leq 5.5 \cdot 10^{+29}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -4.60000000000000004e49 or 5.5e29 < z Initial program 72.5%
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 81.3%
neg-mul-181.3%
Simplified81.3%
if -4.60000000000000004e49 < z < 5.5e29Initial program 99.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 60.5%
*-commutative60.5%
associate-/l*63.2%
Applied egg-rr63.2%
Final simplification71.4%
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.8e+55) (not (<= y 2.5e+109)))
(* 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 <= -4.8e+55) || !(y <= 2.5e+109)) {
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 <= (-4.8d+55)) .or. (.not. (y <= 2.5d+109))) 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 <= -4.8e+55) || !(y <= 2.5e+109)) {
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 <= -4.8e+55) or not (y <= 2.5e+109): 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 <= -4.8e+55) || !(y <= 2.5e+109)) 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 <= -4.8e+55) || ~((y <= 2.5e+109))) 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, -4.8e+55], N[Not[LessEqual[y, 2.5e+109]], $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 -4.8 \cdot 10^{+55} \lor \neg \left(y \leq 2.5 \cdot 10^{+109}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -4.7999999999999998e55 or 2.5000000000000001e109 < y Initial program 91.5%
associate-/l*89.6%
+-commutative89.6%
associate-+r-89.6%
div-sub89.6%
*-inverses89.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in y around inf 80.8%
*-commutative80.8%
associate-/l*82.5%
Applied egg-rr82.5%
if -4.7999999999999998e55 < y < 2.5000000000000001e109Initial program 84.8%
associate-/l*99.3%
+-commutative99.3%
associate-+r-99.3%
div-sub99.3%
*-inverses99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 91.3%
sub-neg91.3%
metadata-eval91.3%
distribute-rgt-in91.3%
associate-*l/91.4%
*-lft-identity91.4%
neg-mul-191.4%
unsub-neg91.4%
Simplified91.4%
Final simplification87.8%
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.8e+54)
(/ y (/ z x_m))
(if (<= y 2.6e+109) (- (/ x_m z) x_m) (* y (/ 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 (y <= -4.8e+54) {
tmp = y / (z / x_m);
} else if (y <= 2.6e+109) {
tmp = (x_m / z) - x_m;
} else {
tmp = y * (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 (y <= (-4.8d+54)) then
tmp = y / (z / x_m)
else if (y <= 2.6d+109) then
tmp = (x_m / z) - x_m
else
tmp = y * (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 (y <= -4.8e+54) {
tmp = y / (z / x_m);
} else if (y <= 2.6e+109) {
tmp = (x_m / z) - x_m;
} else {
tmp = y * (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 y <= -4.8e+54: tmp = y / (z / x_m) elif y <= 2.6e+109: tmp = (x_m / z) - x_m else: tmp = y * (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 (y <= -4.8e+54) tmp = Float64(y / Float64(z / x_m)); elseif (y <= 2.6e+109) tmp = Float64(Float64(x_m / z) - x_m); else tmp = Float64(y * 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 (y <= -4.8e+54) tmp = y / (z / x_m); elseif (y <= 2.6e+109) tmp = (x_m / z) - x_m; else tmp = y * (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[LessEqual[y, -4.8e+54], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+109], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(y * N[(x$95$m / z), $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.8 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+109}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -4.79999999999999997e54Initial program 91.0%
associate-/l*96.7%
+-commutative96.7%
associate-+r-96.7%
div-sub96.8%
*-inverses96.8%
sub-neg96.8%
metadata-eval96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in y around inf 75.5%
*-commutative75.5%
associate-/l*78.0%
Applied egg-rr78.0%
clear-num78.0%
un-div-inv78.1%
Applied egg-rr78.1%
if -4.79999999999999997e54 < y < 2.5999999999999998e109Initial program 84.8%
associate-/l*99.3%
+-commutative99.3%
associate-+r-99.3%
div-sub99.3%
*-inverses99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 91.3%
sub-neg91.3%
metadata-eval91.3%
distribute-rgt-in91.3%
associate-*l/91.4%
*-lft-identity91.4%
neg-mul-191.4%
unsub-neg91.4%
Simplified91.4%
if 2.5999999999999998e109 < y Initial program 92.2%
associate-/l*77.5%
+-commutative77.5%
associate-+r-77.5%
div-sub77.5%
*-inverses77.5%
sub-neg77.5%
metadata-eval77.5%
+-commutative77.5%
Simplified77.5%
Taylor expanded in y around inf 89.8%
*-commutative89.8%
associate-/l*90.0%
Applied egg-rr90.0%
Final simplification87.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 5.3e+118)
(* x_m (+ (/ (+ y 1.0) z) -1.0))
(- (* y (/ 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 <= 5.3e+118) {
tmp = x_m * (((y + 1.0) / z) + -1.0);
} else {
tmp = (y * (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 <= 5.3d+118) then
tmp = x_m * (((y + 1.0d0) / z) + (-1.0d0))
else
tmp = (y * (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 <= 5.3e+118) {
tmp = x_m * (((y + 1.0) / z) + -1.0);
} else {
tmp = (y * (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 <= 5.3e+118: tmp = x_m * (((y + 1.0) / z) + -1.0) else: tmp = (y * (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 <= 5.3e+118) tmp = Float64(x_m * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); else tmp = Float64(Float64(y * 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 <= 5.3e+118) tmp = x_m * (((y + 1.0) / z) + -1.0); else tmp = (y * (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, 5.3e+118], N[(x$95$m * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x$95$m / z), $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}\;y \leq 5.3 \cdot 10^{+118}:\\
\;\;\;\;x\_m \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < 5.2999999999999997e118Initial program 86.7%
associate-/l*98.5%
+-commutative98.5%
associate-+r-98.5%
div-sub98.6%
*-inverses98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
if 5.2999999999999997e118 < y Initial program 92.0%
associate-/l*76.9%
+-commutative76.9%
associate-+r-76.9%
div-sub76.9%
*-inverses76.9%
sub-neg76.9%
metadata-eval76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in y around inf 76.9%
distribute-rgt-in76.9%
neg-mul-176.9%
fma-define76.9%
fma-neg76.9%
associate-*l/94.6%
associate-*r/97.3%
Applied egg-rr97.3%
Final simplification98.4%
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 2.75e+93) (/ x_m (/ z (+ 1.0 (- y z)))) (- (* y (/ 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 <= 2.75e+93) {
tmp = x_m / (z / (1.0 + (y - z)));
} else {
tmp = (y * (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 <= 2.75d+93) then
tmp = x_m / (z / (1.0d0 + (y - z)))
else
tmp = (y * (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 <= 2.75e+93) {
tmp = x_m / (z / (1.0 + (y - z)));
} else {
tmp = (y * (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 <= 2.75e+93: tmp = x_m / (z / (1.0 + (y - z))) else: tmp = (y * (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 <= 2.75e+93) tmp = Float64(x_m / Float64(z / Float64(1.0 + Float64(y - z)))); else tmp = Float64(Float64(y * 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 <= 2.75e+93) tmp = x_m / (z / (1.0 + (y - z))); else tmp = (y * (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, 2.75e+93], N[(x$95$m / N[(z / N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x$95$m / z), $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}\;y \leq 2.75 \cdot 10^{+93}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{1 + \left(y - z\right)}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < 2.75000000000000015e93Initial program 86.9%
associate-/l*98.5%
Simplified98.5%
clear-num98.4%
un-div-inv99.2%
+-commutative99.2%
Applied egg-rr99.2%
if 2.75000000000000015e93 < y Initial program 90.2%
associate-/l*78.6%
+-commutative78.6%
associate-+r-78.6%
div-sub78.6%
*-inverses78.6%
sub-neg78.6%
metadata-eval78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in y around inf 78.6%
distribute-rgt-in78.6%
neg-mul-178.6%
fma-define78.6%
fma-neg78.6%
associate-*l/95.0%
associate-*r/97.5%
Applied egg-rr97.5%
Final simplification98.9%
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 (+ 1.0 (- y z)))) (* x_s (if (<= x_m 1.05e-59) (/ (* x_m t_0) z) (/ x_m (/ z t_0))))))
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 = 1.0 + (y - z);
double tmp;
if (x_m <= 1.05e-59) {
tmp = (x_m * t_0) / z;
} else {
tmp = x_m / (z / t_0);
}
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 = 1.0d0 + (y - z)
if (x_m <= 1.05d-59) then
tmp = (x_m * t_0) / z
else
tmp = x_m / (z / t_0)
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 = 1.0 + (y - z);
double tmp;
if (x_m <= 1.05e-59) {
tmp = (x_m * t_0) / z;
} else {
tmp = x_m / (z / t_0);
}
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 = 1.0 + (y - z) tmp = 0 if x_m <= 1.05e-59: tmp = (x_m * t_0) / z else: tmp = x_m / (z / t_0) 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(1.0 + Float64(y - z)) tmp = 0.0 if (x_m <= 1.05e-59) tmp = Float64(Float64(x_m * t_0) / z); else tmp = Float64(x_m / Float64(z / t_0)); 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 = 1.0 + (y - z); tmp = 0.0; if (x_m <= 1.05e-59) tmp = (x_m * t_0) / z; else tmp = x_m / (z / t_0); 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[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[x$95$m, 1.05e-59], N[(N[(x$95$m * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := 1 + \left(y - z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 1.05 \cdot 10^{-59}:\\
\;\;\;\;\frac{x\_m \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{t\_0}}\\
\end{array}
\end{array}
\end{array}
if x < 1.04999999999999998e-59Initial program 91.3%
if 1.04999999999999998e-59 < x Initial program 77.3%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification93.6%
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 87.5%
associate-/l*95.4%
+-commutative95.4%
associate-+r-95.4%
div-sub95.4%
*-inverses95.4%
sub-neg95.4%
metadata-eval95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in z around inf 39.9%
neg-mul-139.9%
Simplified39.9%
Final simplification39.9%
(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 2024059
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))