
(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 1 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 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* x_m (/ y z))))
(*
x_s
(if (<= z -4e+49)
(- x_m)
(if (<= z -1.55e-252)
t_0
(if (<= z 5.2e-285)
(/ x_m z)
(if (<= z 6.5e-254) t_0 (if (<= z 8e-13) (/ 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 t_0 = x_m * (y / z);
double tmp;
if (z <= -4e+49) {
tmp = -x_m;
} else if (z <= -1.55e-252) {
tmp = t_0;
} else if (z <= 5.2e-285) {
tmp = x_m / z;
} else if (z <= 6.5e-254) {
tmp = t_0;
} else if (z <= 8e-13) {
tmp = x_m / z;
} 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 <= (-4d+49)) then
tmp = -x_m
else if (z <= (-1.55d-252)) then
tmp = t_0
else if (z <= 5.2d-285) then
tmp = x_m / z
else if (z <= 6.5d-254) then
tmp = t_0
else if (z <= 8d-13) then
tmp = x_m / z
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 <= -4e+49) {
tmp = -x_m;
} else if (z <= -1.55e-252) {
tmp = t_0;
} else if (z <= 5.2e-285) {
tmp = x_m / z;
} else if (z <= 6.5e-254) {
tmp = t_0;
} else if (z <= 8e-13) {
tmp = x_m / z;
} 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 <= -4e+49: tmp = -x_m elif z <= -1.55e-252: tmp = t_0 elif z <= 5.2e-285: tmp = x_m / z elif z <= 6.5e-254: tmp = t_0 elif z <= 8e-13: tmp = x_m / z 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 <= -4e+49) tmp = Float64(-x_m); elseif (z <= -1.55e-252) tmp = t_0; elseif (z <= 5.2e-285) tmp = Float64(x_m / z); elseif (z <= 6.5e-254) tmp = t_0; elseif (z <= 8e-13) tmp = Float64(x_m / z); 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 <= -4e+49) tmp = -x_m; elseif (z <= -1.55e-252) tmp = t_0; elseif (z <= 5.2e-285) tmp = x_m / z; elseif (z <= 6.5e-254) tmp = t_0; elseif (z <= 8e-13) tmp = x_m / z; 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, -4e+49], (-x$95$m), If[LessEqual[z, -1.55e-252], t$95$0, If[LessEqual[z, 5.2e-285], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 6.5e-254], t$95$0, If[LessEqual[z, 8e-13], N[(x$95$m / z), $MachinePrecision], (-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 -4 \cdot 10^{+49}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-252}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-285}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-254}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-13}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -3.99999999999999979e49 or 8.0000000000000002e-13 < z Initial program 73.6%
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 78.4%
neg-mul-178.4%
Simplified78.4%
if -3.99999999999999979e49 < z < -1.5499999999999999e-252 or 5.2000000000000003e-285 < z < 6.5e-254Initial program 99.9%
associate-/l*92.8%
+-commutative92.8%
associate-+r-92.8%
div-sub92.8%
*-inverses92.8%
sub-neg92.8%
metadata-eval92.8%
+-commutative92.8%
Simplified92.8%
Taylor expanded in y around inf 68.1%
associate-/l*61.2%
Simplified61.2%
if -1.5499999999999999e-252 < z < 5.2000000000000003e-285 or 6.5e-254 < z < 8.0000000000000002e-13Initial program 99.9%
associate-/l*89.1%
+-commutative89.1%
associate-+r-89.1%
div-sub89.1%
*-inverses89.1%
sub-neg89.1%
metadata-eval89.1%
+-commutative89.1%
Simplified89.1%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around 0 64.2%
Final simplification69.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* y (/ x_m z))))
(*
x_s
(if (<= z -5.8e+49)
(- x_m)
(if (<= z -2.35e-254)
t_0
(if (<= z 1.65e-285) (/ x_m z) (if (<= z 9.5e+28) 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 <= -5.8e+49) {
tmp = -x_m;
} else if (z <= -2.35e-254) {
tmp = t_0;
} else if (z <= 1.65e-285) {
tmp = x_m / z;
} else if (z <= 9.5e+28) {
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 <= (-5.8d+49)) then
tmp = -x_m
else if (z <= (-2.35d-254)) then
tmp = t_0
else if (z <= 1.65d-285) then
tmp = x_m / z
else if (z <= 9.5d+28) 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 <= -5.8e+49) {
tmp = -x_m;
} else if (z <= -2.35e-254) {
tmp = t_0;
} else if (z <= 1.65e-285) {
tmp = x_m / z;
} else if (z <= 9.5e+28) {
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 <= -5.8e+49: tmp = -x_m elif z <= -2.35e-254: tmp = t_0 elif z <= 1.65e-285: tmp = x_m / z elif z <= 9.5e+28: 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 <= -5.8e+49) tmp = Float64(-x_m); elseif (z <= -2.35e-254) tmp = t_0; elseif (z <= 1.65e-285) tmp = Float64(x_m / z); elseif (z <= 9.5e+28) 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 <= -5.8e+49) tmp = -x_m; elseif (z <= -2.35e-254) tmp = t_0; elseif (z <= 1.65e-285) tmp = x_m / z; elseif (z <= 9.5e+28) 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, -5.8e+49], (-x$95$m), If[LessEqual[z, -2.35e-254], t$95$0, If[LessEqual[z, 1.65e-285], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 9.5e+28], 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 -5.8 \cdot 10^{+49}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{-254}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-285}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+28}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -5.8e49 or 9.49999999999999927e28 < 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 -5.8e49 < z < -2.35000000000000013e-254 or 1.64999999999999993e-285 < z < 9.49999999999999927e28Initial program 99.8%
*-commutative99.8%
associate-/l*99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.3%
*-commutative62.3%
associate-*r/65.2%
Simplified65.2%
if -2.35000000000000013e-254 < z < 1.64999999999999993e-285Initial program 100.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%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 85.2%
Final simplification73.2%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 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%
distribute-lft-in99.9%
associate-*r/100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.4%
if 4.29999999999999986e123 < y Initial program 92.0%
*-commutative92.0%
associate-/l*94.7%
+-commutative94.7%
Applied egg-rr94.7%
Taylor expanded in y around inf 89.5%
*-commutative89.5%
associate-*r/89.7%
Simplified89.7%
Final simplification97.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 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)))
(* (+ y 1.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 tmp;
if ((z <= -1.0) || !(z <= 8e-13)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (y + 1.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) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 8d-13))) then
tmp = x_m * ((-1.0d0) + (y / z))
else
tmp = (y + 1.0d0) * (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 <= 8e-13)) {
tmp = x_m * (-1.0 + (y / z));
} else {
tmp = (y + 1.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): tmp = 0 if (z <= -1.0) or not (z <= 8e-13): tmp = x_m * (-1.0 + (y / z)) else: tmp = (y + 1.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) tmp = 0.0 if ((z <= -1.0) || !(z <= 8e-13)) tmp = Float64(x_m * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(y + 1.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) tmp = 0.0; if ((z <= -1.0) || ~((z <= 8e-13))) tmp = x_m * (-1.0 + (y / z)); else tmp = (y + 1.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_] := 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[(y + 1.0), $MachinePrecision] * 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 -1 \lor \neg \left(z \leq 8 \cdot 10^{-13}\right):\\
\;\;\;\;x\_m \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x\_m}{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%
*-commutative99.8%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 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)
(* (+ y 1.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 tmp;
if ((z <= -1.05) || !(z <= 8e-13)) {
tmp = (x_m * (y / z)) - x_m;
} else {
tmp = (y + 1.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) :: tmp
if ((z <= (-1.05d0)) .or. (.not. (z <= 8d-13))) then
tmp = (x_m * (y / z)) - x_m
else
tmp = (y + 1.0d0) * (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.05) || !(z <= 8e-13)) {
tmp = (x_m * (y / z)) - x_m;
} else {
tmp = (y + 1.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): tmp = 0 if (z <= -1.05) or not (z <= 8e-13): tmp = (x_m * (y / z)) - x_m else: tmp = (y + 1.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) tmp = 0.0 if ((z <= -1.05) || !(z <= 8e-13)) tmp = Float64(Float64(x_m * Float64(y / z)) - x_m); else tmp = Float64(Float64(y + 1.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) tmp = 0.0; if ((z <= -1.05) || ~((z <= 8e-13))) tmp = (x_m * (y / z)) - x_m; else tmp = (y + 1.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_] := 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[(y + 1.0), $MachinePrecision] * 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 -1.05 \lor \neg \left(z \leq 8 \cdot 10^{-13}\right):\\
\;\;\;\;x\_m \cdot \frac{y}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x\_m}{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-/l*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%
*-commutative99.8%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= y -3.1e+54) (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 <= -3.1e+54) || !(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 <= (-3.1d+54)) .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 <= -3.1e+54) || !(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 <= -3.1e+54) 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 <= -3.1e+54) || !(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 <= -3.1e+54) || ~((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, -3.1e+54], 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 -3.1 \cdot 10^{+54} \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 < -3.0999999999999999e54 or 2.5000000000000001e109 < y Initial program 91.5%
*-commutative91.5%
associate-/l*92.2%
+-commutative92.2%
Applied egg-rr92.2%
Taylor expanded in y around inf 80.8%
*-commutative80.8%
associate-*r/82.5%
Simplified82.5%
if -3.0999999999999999e54 < 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%
distribute-lft-in99.3%
associate-*r/98.8%
*-commutative98.8%
mul-1-neg98.8%
Applied egg-rr98.8%
Taylor expanded in y around 0 91.4%
Final simplification87.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -4e+54)
(/ y (/ z x_m))
(if (<= y 2.5e+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 <= -4e+54) {
tmp = y / (z / x_m);
} else if (y <= 2.5e+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 <= (-4d+54)) then
tmp = y / (z / x_m)
else if (y <= 2.5d+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 <= -4e+54) {
tmp = y / (z / x_m);
} else if (y <= 2.5e+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 <= -4e+54: tmp = y / (z / x_m) elif y <= 2.5e+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 <= -4e+54) tmp = Float64(y / Float64(z / x_m)); elseif (y <= 2.5e+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 <= -4e+54) tmp = y / (z / x_m); elseif (y <= 2.5e+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, -4e+54], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+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 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+109}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -4.0000000000000003e54Initial program 91.0%
*-commutative91.0%
associate-/l*90.6%
+-commutative90.6%
Applied egg-rr90.6%
Taylor expanded in y around inf 75.5%
*-commutative75.5%
associate-*r/78.0%
Simplified78.0%
clear-num78.0%
un-div-inv78.1%
Applied egg-rr78.1%
if -4.0000000000000003e54 < 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%
distribute-lft-in99.3%
associate-*r/98.8%
*-commutative98.8%
mul-1-neg98.8%
Applied egg-rr98.8%
Taylor expanded in y around 0 91.4%
if 2.5000000000000001e109 < y Initial program 92.2%
*-commutative92.2%
associate-/l*94.8%
+-commutative94.8%
Applied egg-rr94.8%
Taylor expanded in y around inf 89.8%
*-commutative89.8%
associate-*r/90.0%
Simplified90.0%
Final simplification87.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 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%
distribute-lft-in76.9%
associate-*r/94.6%
*-commutative94.6%
mul-1-neg94.6%
Applied egg-rr94.6%
Taylor expanded in y around inf 94.6%
associate-/l*76.9%
Simplified76.9%
unsub-neg76.9%
*-commutative76.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 1 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%
distribute-lft-in78.6%
associate-*r/95.0%
*-commutative95.0%
mul-1-neg95.0%
Applied egg-rr95.0%
Taylor expanded in y around inf 95.0%
associate-/l*78.6%
Simplified78.6%
unsub-neg78.6%
*-commutative78.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 1 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 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -85.0) (not (<= z 8e-13))) (- 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 <= -85.0) || !(z <= 8e-13)) {
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 <= (-85.0d0)) .or. (.not. (z <= 8d-13))) 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 <= -85.0) || !(z <= 8e-13)) {
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 <= -85.0) or not (z <= 8e-13): 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 <= -85.0) || !(z <= 8e-13)) 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 <= -85.0) || ~((z <= 8e-13))) 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, -85.0], N[Not[LessEqual[z, 8e-13]], $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 -85 \lor \neg \left(z \leq 8 \cdot 10^{-13}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -85 or 8.0000000000000002e-13 < z Initial program 76.0%
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 73.9%
neg-mul-173.9%
Simplified73.9%
if -85 < z < 8.0000000000000002e-13Initial program 99.9%
associate-/l*90.6%
+-commutative90.6%
associate-+r-90.6%
div-sub90.6%
*-inverses90.6%
sub-neg90.6%
metadata-eval90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 49.5%
Final simplification62.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 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
:herbie-target
(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))