
(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 11 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 2.8e-58)
(/ (* x_m (+ (- y z) 1.0)) z)
(* x_m (+ (/ (+ y 1.0) z) -1.0)))))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 <= 2.8e-58) {
tmp = (x_m * ((y - z) + 1.0)) / z;
} else {
tmp = x_m * (((y + 1.0) / z) + -1.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) :: tmp
if (x_m <= 2.8d-58) then
tmp = (x_m * ((y - z) + 1.0d0)) / z
else
tmp = x_m * (((y + 1.0d0) / z) + (-1.0d0))
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 <= 2.8e-58) {
tmp = (x_m * ((y - z) + 1.0)) / z;
} else {
tmp = x_m * (((y + 1.0) / z) + -1.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): tmp = 0 if x_m <= 2.8e-58: tmp = (x_m * ((y - z) + 1.0)) / z else: tmp = x_m * (((y + 1.0) / z) + -1.0) 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 <= 2.8e-58) tmp = Float64(Float64(x_m * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(x_m * Float64(Float64(Float64(y + 1.0) / z) + -1.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) tmp = 0.0; if (x_m <= 2.8e-58) tmp = (x_m * ((y - z) + 1.0)) / z; else tmp = x_m * (((y + 1.0) / z) + -1.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_] := N[(x$95$s * If[LessEqual[x$95$m, 2.8e-58], N[(N[(x$95$m * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $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 2.8 \cdot 10^{-58}:\\
\;\;\;\;\frac{x\_m \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y + 1}{z} + -1\right)\\
\end{array}
\end{array}
if x < 2.8000000000000001e-58Initial program 90.4%
if 2.8000000000000001e-58 < x Initial program 75.4%
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%
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 -12200000.0)
(- x_m)
(if (<= z -4.9e-21)
(* x_m (/ y z))
(if (<= z -1.8e-287)
(/ x_m z)
(if (<= z 7e-102)
t_0
(if (<= z 2.9e-34)
(/ x_m z)
(if (<= z 2.5e+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 <= -12200000.0) {
tmp = -x_m;
} else if (z <= -4.9e-21) {
tmp = x_m * (y / z);
} else if (z <= -1.8e-287) {
tmp = x_m / z;
} else if (z <= 7e-102) {
tmp = t_0;
} else if (z <= 2.9e-34) {
tmp = x_m / z;
} else if (z <= 2.5e+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 <= (-12200000.0d0)) then
tmp = -x_m
else if (z <= (-4.9d-21)) then
tmp = x_m * (y / z)
else if (z <= (-1.8d-287)) then
tmp = x_m / z
else if (z <= 7d-102) then
tmp = t_0
else if (z <= 2.9d-34) then
tmp = x_m / z
else if (z <= 2.5d+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 <= -12200000.0) {
tmp = -x_m;
} else if (z <= -4.9e-21) {
tmp = x_m * (y / z);
} else if (z <= -1.8e-287) {
tmp = x_m / z;
} else if (z <= 7e-102) {
tmp = t_0;
} else if (z <= 2.9e-34) {
tmp = x_m / z;
} else if (z <= 2.5e+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 <= -12200000.0: tmp = -x_m elif z <= -4.9e-21: tmp = x_m * (y / z) elif z <= -1.8e-287: tmp = x_m / z elif z <= 7e-102: tmp = t_0 elif z <= 2.9e-34: tmp = x_m / z elif z <= 2.5e+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 <= -12200000.0) tmp = Float64(-x_m); elseif (z <= -4.9e-21) tmp = Float64(x_m * Float64(y / z)); elseif (z <= -1.8e-287) tmp = Float64(x_m / z); elseif (z <= 7e-102) tmp = t_0; elseif (z <= 2.9e-34) tmp = Float64(x_m / z); elseif (z <= 2.5e+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 <= -12200000.0) tmp = -x_m; elseif (z <= -4.9e-21) tmp = x_m * (y / z); elseif (z <= -1.8e-287) tmp = x_m / z; elseif (z <= 7e-102) tmp = t_0; elseif (z <= 2.9e-34) tmp = x_m / z; elseif (z <= 2.5e+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, -12200000.0], (-x$95$m), If[LessEqual[z, -4.9e-21], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.8e-287], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 7e-102], t$95$0, If[LessEqual[z, 2.9e-34], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 2.5e+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 -12200000:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{-21}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-287}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-34}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -1.22e7 or 2.5e26 < z Initial program 70.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 77.0%
neg-mul-177.0%
Simplified77.0%
if -1.22e7 < z < -4.9000000000000002e-21Initial program 99.8%
associate-/l*99.6%
+-commutative99.6%
associate-+r-99.6%
div-sub99.6%
*-inverses99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around inf 86.1%
associate-/l*86.1%
Simplified86.1%
if -4.9000000000000002e-21 < z < -1.8000000000000001e-287 or 6.99999999999999973e-102 < z < 2.9000000000000002e-34Initial program 99.9%
associate-/l*97.9%
+-commutative97.9%
associate-+r-97.9%
div-sub97.9%
*-inverses97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 62.5%
sub-neg62.5%
metadata-eval62.5%
distribute-rgt-in62.5%
associate-*l/62.7%
*-lft-identity62.7%
neg-mul-162.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in z around 0 62.7%
if -1.8000000000000001e-287 < z < 6.99999999999999973e-102 or 2.9000000000000002e-34 < z < 2.5e26Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 68.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 (<= y -3.9e+71)
(* x_m (/ y z))
(if (<= y -2.35e+57)
(- x_m)
(if (or (<= y -1.55e+15) (not (<= y 2.05e+124)))
(* 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.9e+71) {
tmp = x_m * (y / z);
} else if (y <= -2.35e+57) {
tmp = -x_m;
} else if ((y <= -1.55e+15) || !(y <= 2.05e+124)) {
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.9d+71)) then
tmp = x_m * (y / z)
else if (y <= (-2.35d+57)) then
tmp = -x_m
else if ((y <= (-1.55d+15)) .or. (.not. (y <= 2.05d+124))) 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.9e+71) {
tmp = x_m * (y / z);
} else if (y <= -2.35e+57) {
tmp = -x_m;
} else if ((y <= -1.55e+15) || !(y <= 2.05e+124)) {
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.9e+71: tmp = x_m * (y / z) elif y <= -2.35e+57: tmp = -x_m elif (y <= -1.55e+15) or not (y <= 2.05e+124): 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.9e+71) tmp = Float64(x_m * Float64(y / z)); elseif (y <= -2.35e+57) tmp = Float64(-x_m); elseif ((y <= -1.55e+15) || !(y <= 2.05e+124)) 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.9e+71) tmp = x_m * (y / z); elseif (y <= -2.35e+57) tmp = -x_m; elseif ((y <= -1.55e+15) || ~((y <= 2.05e+124))) 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[LessEqual[y, -3.9e+71], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.35e+57], (-x$95$m), If[Or[LessEqual[y, -1.55e+15], N[Not[LessEqual[y, 2.05e+124]], $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.9 \cdot 10^{+71}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{+57}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{+15} \lor \neg \left(y \leq 2.05 \cdot 10^{+124}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -3.9000000000000001e71Initial program 83.6%
associate-/l*93.1%
+-commutative93.1%
associate-+r-93.1%
div-sub93.1%
*-inverses93.1%
sub-neg93.1%
metadata-eval93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in y around inf 76.7%
associate-/l*81.2%
Simplified81.2%
if -3.9000000000000001e71 < y < -2.3500000000000001e57Initial program 81.3%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 80.9%
neg-mul-180.9%
Simplified80.9%
if -2.3500000000000001e57 < y < -1.55e15 or 2.05000000000000001e124 < y Initial program 88.7%
*-commutative88.7%
associate-/l*88.7%
+-commutative88.7%
Applied egg-rr88.7%
Taylor expanded in y around inf 83.2%
if -1.55e15 < y < 2.05000000000000001e124Initial program 85.3%
associate-/l*98.6%
+-commutative98.6%
associate-+r-98.6%
div-sub98.6%
*-inverses98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 94.0%
sub-neg94.0%
metadata-eval94.0%
distribute-rgt-in94.0%
associate-*l/94.2%
*-lft-identity94.2%
neg-mul-194.2%
unsub-neg94.2%
Simplified94.2%
Final simplification89.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 (<= y -2.15e+71)
(* x_m (/ y z))
(if (<= y -8.5e+56)
(- x_m)
(if (<= y -7.3e+15)
(/ (* x_m y) z)
(if (<= y 5e+122) (- (/ 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 <= -2.15e+71) {
tmp = x_m * (y / z);
} else if (y <= -8.5e+56) {
tmp = -x_m;
} else if (y <= -7.3e+15) {
tmp = (x_m * y) / z;
} else if (y <= 5e+122) {
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 <= (-2.15d+71)) then
tmp = x_m * (y / z)
else if (y <= (-8.5d+56)) then
tmp = -x_m
else if (y <= (-7.3d+15)) then
tmp = (x_m * y) / z
else if (y <= 5d+122) 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 <= -2.15e+71) {
tmp = x_m * (y / z);
} else if (y <= -8.5e+56) {
tmp = -x_m;
} else if (y <= -7.3e+15) {
tmp = (x_m * y) / z;
} else if (y <= 5e+122) {
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 <= -2.15e+71: tmp = x_m * (y / z) elif y <= -8.5e+56: tmp = -x_m elif y <= -7.3e+15: tmp = (x_m * y) / z elif y <= 5e+122: 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 <= -2.15e+71) tmp = Float64(x_m * Float64(y / z)); elseif (y <= -8.5e+56) tmp = Float64(-x_m); elseif (y <= -7.3e+15) tmp = Float64(Float64(x_m * y) / z); elseif (y <= 5e+122) 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 <= -2.15e+71) tmp = x_m * (y / z); elseif (y <= -8.5e+56) tmp = -x_m; elseif (y <= -7.3e+15) tmp = (x_m * y) / z; elseif (y <= 5e+122) 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, -2.15e+71], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.5e+56], (-x$95$m), If[LessEqual[y, -7.3e+15], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 5e+122], 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 -2.15 \cdot 10^{+71}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{+56}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;y \leq -7.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+122}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -2.14999999999999992e71Initial program 83.6%
associate-/l*93.1%
+-commutative93.1%
associate-+r-93.1%
div-sub93.1%
*-inverses93.1%
sub-neg93.1%
metadata-eval93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in y around inf 76.7%
associate-/l*81.2%
Simplified81.2%
if -2.14999999999999992e71 < y < -8.4999999999999998e56Initial program 81.3%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 80.9%
neg-mul-180.9%
Simplified80.9%
if -8.4999999999999998e56 < y < -7.3e15Initial program 99.5%
associate-/l*89.4%
+-commutative89.4%
associate-+r-89.4%
div-sub89.4%
*-inverses89.4%
sub-neg89.4%
metadata-eval89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in y around inf 78.7%
if -7.3e15 < y < 4.99999999999999989e122Initial program 85.3%
associate-/l*98.6%
+-commutative98.6%
associate-+r-98.6%
div-sub98.6%
*-inverses98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 94.0%
sub-neg94.0%
metadata-eval94.0%
distribute-rgt-in94.0%
associate-*l/94.2%
*-lft-identity94.2%
neg-mul-194.2%
unsub-neg94.2%
Simplified94.2%
if 4.99999999999999989e122 < y Initial program 84.8%
*-commutative84.8%
associate-/l*88.6%
+-commutative88.6%
Applied egg-rr88.6%
Taylor expanded in y around inf 84.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 (* x_m (/ y z))))
(*
x_s
(if (<= z -24000000.0)
(- x_m)
(if (<= z -2.1e-26)
t_0
(if (<= z 1.32e-33) (/ x_m z) (if (<= z 2.8e+25) 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 <= -24000000.0) {
tmp = -x_m;
} else if (z <= -2.1e-26) {
tmp = t_0;
} else if (z <= 1.32e-33) {
tmp = x_m / z;
} else if (z <= 2.8e+25) {
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 <= (-24000000.0d0)) then
tmp = -x_m
else if (z <= (-2.1d-26)) then
tmp = t_0
else if (z <= 1.32d-33) then
tmp = x_m / z
else if (z <= 2.8d+25) 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 <= -24000000.0) {
tmp = -x_m;
} else if (z <= -2.1e-26) {
tmp = t_0;
} else if (z <= 1.32e-33) {
tmp = x_m / z;
} else if (z <= 2.8e+25) {
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 <= -24000000.0: tmp = -x_m elif z <= -2.1e-26: tmp = t_0 elif z <= 1.32e-33: tmp = x_m / z elif z <= 2.8e+25: 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 <= -24000000.0) tmp = Float64(-x_m); elseif (z <= -2.1e-26) tmp = t_0; elseif (z <= 1.32e-33) tmp = Float64(x_m / z); elseif (z <= 2.8e+25) 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 <= -24000000.0) tmp = -x_m; elseif (z <= -2.1e-26) tmp = t_0; elseif (z <= 1.32e-33) tmp = x_m / z; elseif (z <= 2.8e+25) 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, -24000000.0], (-x$95$m), If[LessEqual[z, -2.1e-26], t$95$0, If[LessEqual[z, 1.32e-33], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 2.8e+25], 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 -24000000:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-33}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
\end{array}
if z < -2.4e7 or 2.8000000000000002e25 < z Initial program 70.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 77.0%
neg-mul-177.0%
Simplified77.0%
if -2.4e7 < z < -2.10000000000000008e-26 or 1.31999999999999993e-33 < z < 2.8000000000000002e25Initial program 99.7%
associate-/l*99.6%
+-commutative99.6%
associate-+r-99.6%
div-sub99.6%
*-inverses99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around inf 78.3%
associate-/l*78.2%
Simplified78.2%
if -2.10000000000000008e-26 < z < 1.31999999999999993e-33Initial 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 0 58.0%
sub-neg58.0%
metadata-eval58.0%
distribute-rgt-in58.0%
associate-*l/58.2%
*-lft-identity58.2%
neg-mul-158.2%
unsub-neg58.2%
Simplified58.2%
Taylor expanded in z around 0 58.2%
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 -480000.0) (not (<= z 1.4e+26)))
(- (/ x_m 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 <= -480000.0) || !(z <= 1.4e+26)) {
tmp = (x_m / 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 <= (-480000.0d0)) .or. (.not. (z <= 1.4d+26))) then
tmp = (x_m / 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 <= -480000.0) || !(z <= 1.4e+26)) {
tmp = (x_m / 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 <= -480000.0) or not (z <= 1.4e+26): tmp = (x_m / 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 <= -480000.0) || !(z <= 1.4e+26)) tmp = Float64(Float64(x_m / 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 <= -480000.0) || ~((z <= 1.4e+26))) tmp = (x_m / 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, -480000.0], N[Not[LessEqual[z, 1.4e+26]], $MachinePrecision]], N[(N[(x$95$m / z), $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 -480000 \lor \neg \left(z \leq 1.4 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -4.8e5 or 1.4e26 < z Initial program 70.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 y around 0 77.6%
sub-neg77.6%
metadata-eval77.6%
distribute-rgt-in77.6%
associate-*l/77.6%
*-lft-identity77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
if -4.8e5 < z < 1.4e26Initial program 99.9%
associate-/l*93.8%
+-commutative93.8%
associate-+r-93.8%
div-sub93.8%
*-inverses93.8%
sub-neg93.8%
metadata-eval93.8%
+-commutative93.8%
Simplified93.8%
Taylor expanded in z around 0 99.3%
Final simplification88.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 -12200000.0) (not (<= z 1.7e+27)))
(- (/ x_m z) x_m)
(* (/ x_m z) (+ y 1.0)))))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 <= -12200000.0) || !(z <= 1.7e+27)) {
tmp = (x_m / z) - x_m;
} else {
tmp = (x_m / z) * (y + 1.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) :: tmp
if ((z <= (-12200000.0d0)) .or. (.not. (z <= 1.7d+27))) then
tmp = (x_m / z) - x_m
else
tmp = (x_m / z) * (y + 1.0d0)
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 <= -12200000.0) || !(z <= 1.7e+27)) {
tmp = (x_m / z) - x_m;
} else {
tmp = (x_m / z) * (y + 1.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): tmp = 0 if (z <= -12200000.0) or not (z <= 1.7e+27): tmp = (x_m / z) - x_m else: tmp = (x_m / z) * (y + 1.0) 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 <= -12200000.0) || !(z <= 1.7e+27)) tmp = Float64(Float64(x_m / z) - x_m); else tmp = Float64(Float64(x_m / z) * Float64(y + 1.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) tmp = 0.0; if ((z <= -12200000.0) || ~((z <= 1.7e+27))) tmp = (x_m / z) - x_m; else tmp = (x_m / z) * (y + 1.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_] := N[(x$95$s * If[Or[LessEqual[z, -12200000.0], N[Not[LessEqual[z, 1.7e+27]], $MachinePrecision]], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(y + 1.0), $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 -12200000 \lor \neg \left(z \leq 1.7 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(y + 1\right)\\
\end{array}
\end{array}
if z < -1.22e7 or 1.7e27 < z Initial program 70.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 y around 0 77.6%
sub-neg77.6%
metadata-eval77.6%
distribute-rgt-in77.6%
associate-*l/77.6%
*-lft-identity77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
if -1.22e7 < z < 1.7e27Initial program 99.9%
associate-/l*93.8%
+-commutative93.8%
associate-+r-93.8%
div-sub93.8%
*-inverses93.8%
sub-neg93.8%
metadata-eval93.8%
+-commutative93.8%
Simplified93.8%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
associate-*l/99.3%
+-commutative99.3%
Simplified99.3%
Final simplification88.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 -7000.0) (not (<= z 3.2e+14))) (- 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 <= -7000.0) || !(z <= 3.2e+14)) {
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 <= (-7000.0d0)) .or. (.not. (z <= 3.2d+14))) 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 <= -7000.0) || !(z <= 3.2e+14)) {
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 <= -7000.0) or not (z <= 3.2e+14): 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 <= -7000.0) || !(z <= 3.2e+14)) 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 <= -7000.0) || ~((z <= 3.2e+14))) 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, -7000.0], N[Not[LessEqual[z, 3.2e+14]], $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 -7000 \lor \neg \left(z \leq 3.2 \cdot 10^{+14}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -7e3 or 3.2e14 < z Initial program 71.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 inf 76.4%
neg-mul-176.4%
Simplified76.4%
if -7e3 < z < 3.2e14Initial program 99.9%
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%
Taylor expanded in y around 0 53.6%
sub-neg53.6%
metadata-eval53.6%
distribute-rgt-in53.6%
associate-*l/53.8%
*-lft-identity53.8%
neg-mul-153.8%
unsub-neg53.8%
Simplified53.8%
Taylor expanded in z around 0 53.3%
Final simplification65.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 (* x_m (+ (/ (+ y 1.0) z) -1.0))))
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 * (((y + 1.0) / z) + -1.0));
}
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 * (((y + 1.0d0) / z) + (-1.0d0)))
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 * (((y + 1.0) / z) + -1.0));
}
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 * (((y + 1.0) / z) + -1.0))
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 * Float64(Float64(Float64(y + 1.0) / z) + -1.0))) 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 * (((y + 1.0) / z) + -1.0)); 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 * N[(x$95$m * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \left(\frac{y + 1}{z} + -1\right)\right)
\end{array}
Initial program 85.2%
associate-/l*96.8%
+-commutative96.8%
associate-+r-96.8%
div-sub96.8%
*-inverses96.8%
sub-neg96.8%
metadata-eval96.8%
+-commutative96.8%
Simplified96.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 (- 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 85.2%
associate-/l*96.8%
+-commutative96.8%
associate-+r-96.8%
div-sub96.8%
*-inverses96.8%
sub-neg96.8%
metadata-eval96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in z around inf 40.2%
neg-mul-140.2%
Simplified40.2%
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 85.2%
*-commutative85.2%
associate-/l*88.8%
+-commutative88.8%
Applied egg-rr88.8%
Taylor expanded in z around inf 34.2%
neg-mul-134.2%
Simplified34.2%
add-log-exp10.1%
*-un-lft-identity10.1%
log-prod10.1%
metadata-eval10.1%
add-log-exp34.2%
add-sqr-sqrt15.8%
sqrt-unprod10.0%
sqr-neg10.0%
sqrt-unprod8.6%
add-sqr-sqrt11.6%
Applied egg-rr11.6%
+-lft-identity11.6%
associate-*r/4.1%
associate-*l/3.1%
*-inverses3.1%
*-lft-identity3.1%
Simplified3.1%
(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 2024101
(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))