
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 2e-48)
(- (/ (* x_m (+ 1.0 y)) z) x_m)
(- (/ x_m (/ z (+ 1.0 y))) x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2e-48) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = (x_m / (z / (1.0 + y))) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 2d-48) then
tmp = ((x_m * (1.0d0 + y)) / z) - x_m
else
tmp = (x_m / (z / (1.0d0 + y))) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2e-48) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = (x_m / (z / (1.0 + y))) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 2e-48: tmp = ((x_m * (1.0 + y)) / z) - x_m else: tmp = (x_m / (z / (1.0 + y))) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 2e-48) tmp = Float64(Float64(Float64(x_m * Float64(1.0 + y)) / z) - x_m); else tmp = Float64(Float64(x_m / Float64(z / Float64(1.0 + y))) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (x_m <= 2e-48) tmp = ((x_m * (1.0 + y)) / z) - x_m; else tmp = (x_m / (z / (1.0 + y))) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 2e-48], N[(N[(N[(x$95$m * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(x$95$m / N[(z / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 2 \cdot 10^{-48}:\\
\;\;\;\;\frac{x\_m \cdot \left(1 + y\right)}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{1 + y}} - x\_m\\
\end{array}
\end{array}
if x < 1.9999999999999999e-48Initial program 93.1%
associate-/l*92.4%
+-commutative92.4%
associate-+r-92.4%
div-sub92.4%
*-inverses92.4%
sub-neg92.4%
+-commutative92.4%
metadata-eval92.4%
Simplified92.4%
distribute-lft-in92.4%
clear-num92.4%
un-div-inv93.8%
*-commutative93.8%
mul-1-neg93.8%
Applied egg-rr93.8%
Taylor expanded in z around inf 97.5%
if 1.9999999999999999e-48 < x Initial program 80.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
distribute-lft-in99.9%
clear-num99.9%
un-div-inv100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
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
(*
x_s
(if (<= z -1.75e+45)
(- x_m)
(if (<= z -8e-14)
(* x_m (/ y z))
(if (<= z -2.6e-125)
(/ x_m z)
(if (<= z 1.4e-239)
(* y (/ x_m z))
(if (<= z 1.0) (/ 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 (z <= -1.75e+45) {
tmp = -x_m;
} else if (z <= -8e-14) {
tmp = x_m * (y / z);
} else if (z <= -2.6e-125) {
tmp = x_m / z;
} else if (z <= 1.4e-239) {
tmp = y * (x_m / z);
} else if (z <= 1.0) {
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) :: tmp
if (z <= (-1.75d+45)) then
tmp = -x_m
else if (z <= (-8d-14)) then
tmp = x_m * (y / z)
else if (z <= (-2.6d-125)) then
tmp = x_m / z
else if (z <= 1.4d-239) then
tmp = y * (x_m / z)
else if (z <= 1.0d0) 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 tmp;
if (z <= -1.75e+45) {
tmp = -x_m;
} else if (z <= -8e-14) {
tmp = x_m * (y / z);
} else if (z <= -2.6e-125) {
tmp = x_m / z;
} else if (z <= 1.4e-239) {
tmp = y * (x_m / z);
} else if (z <= 1.0) {
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): tmp = 0 if z <= -1.75e+45: tmp = -x_m elif z <= -8e-14: tmp = x_m * (y / z) elif z <= -2.6e-125: tmp = x_m / z elif z <= 1.4e-239: tmp = y * (x_m / z) elif z <= 1.0: 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) tmp = 0.0 if (z <= -1.75e+45) tmp = Float64(-x_m); elseif (z <= -8e-14) tmp = Float64(x_m * Float64(y / z)); elseif (z <= -2.6e-125) tmp = Float64(x_m / z); elseif (z <= 1.4e-239) tmp = Float64(y * Float64(x_m / z)); elseif (z <= 1.0) 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) tmp = 0.0; if (z <= -1.75e+45) tmp = -x_m; elseif (z <= -8e-14) tmp = x_m * (y / z); elseif (z <= -2.6e-125) tmp = x_m / z; elseif (z <= 1.4e-239) tmp = y * (x_m / z); elseif (z <= 1.0) 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_] := N[(x$95$s * If[LessEqual[z, -1.75e+45], (-x$95$m), If[LessEqual[z, -8e-14], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.6e-125], N[(x$95$m / z), $MachinePrecision], If[LessEqual[z, 1.4e-239], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], 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)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+45}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-14}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-125}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-239}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
if z < -1.75000000000000011e45 or 1 < z Initial program 77.2%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 77.0%
neg-mul-177.0%
Simplified77.0%
if -1.75000000000000011e45 < z < -7.99999999999999999e-14Initial program 99.8%
associate-/l*99.4%
+-commutative99.4%
associate-+r-99.4%
div-sub99.4%
*-inverses99.4%
sub-neg99.4%
+-commutative99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 87.9%
associate-/l*87.5%
Simplified87.5%
if -7.99999999999999999e-14 < z < -2.60000000000000006e-125 or 1.40000000000000006e-239 < z < 1Initial program 99.9%
Taylor expanded in y around 0 65.8%
*-commutative65.8%
sub-neg65.8%
metadata-eval65.8%
distribute-neg-in65.8%
+-commutative65.8%
associate-/l*65.8%
+-commutative65.8%
distribute-neg-in65.8%
metadata-eval65.8%
sub-neg65.8%
Simplified65.8%
Taylor expanded in z around 0 64.8%
if -2.60000000000000006e-125 < z < 1.40000000000000006e-239Initial program 100.0%
associate-/l*83.5%
+-commutative83.5%
associate-+r-83.5%
div-sub83.5%
*-inverses83.5%
sub-neg83.5%
+-commutative83.5%
metadata-eval83.5%
Simplified83.5%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
associate-/l*81.1%
Applied egg-rr81.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= z -7.5e-17) (not (<= z 2.4e-21)))
(* x_m (+ -1.0 (/ (+ 1.0 y) z)))
(/ (* x_m (+ 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 ((z <= -7.5e-17) || !(z <= 2.4e-21)) {
tmp = x_m * (-1.0 + ((1.0 + y) / z));
} else {
tmp = (x_m * (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 ((z <= (-7.5d-17)) .or. (.not. (z <= 2.4d-21))) then
tmp = x_m * ((-1.0d0) + ((1.0d0 + y) / z))
else
tmp = (x_m * (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 ((z <= -7.5e-17) || !(z <= 2.4e-21)) {
tmp = x_m * (-1.0 + ((1.0 + y) / z));
} else {
tmp = (x_m * (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 (z <= -7.5e-17) or not (z <= 2.4e-21): tmp = x_m * (-1.0 + ((1.0 + y) / z)) else: tmp = (x_m * (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 ((z <= -7.5e-17) || !(z <= 2.4e-21)) tmp = Float64(x_m * Float64(-1.0 + Float64(Float64(1.0 + y) / z))); else tmp = Float64(Float64(x_m * Float64(1.0 + 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 <= -7.5e-17) || ~((z <= 2.4e-21))) tmp = x_m * (-1.0 + ((1.0 + y) / z)); else tmp = (x_m * (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[Or[LessEqual[z, -7.5e-17], N[Not[LessEqual[z, 2.4e-21]], $MachinePrecision]], N[(x$95$m * N[(-1.0 + N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(1.0 + y), $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 -7.5 \cdot 10^{-17} \lor \neg \left(z \leq 2.4 \cdot 10^{-21}\right):\\
\;\;\;\;x\_m \cdot \left(-1 + \frac{1 + y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(1 + y\right)}{z}\\
\end{array}
\end{array}
if z < -7.49999999999999984e-17 or 2.3999999999999999e-21 < z Initial program 79.9%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
if -7.49999999999999984e-17 < z < 2.3999999999999999e-21Initial program 99.9%
associate-/l*88.8%
+-commutative88.8%
associate-+r-88.8%
div-sub88.8%
*-inverses88.8%
sub-neg88.8%
+-commutative88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -6e+23)
(* x_m (+ (/ y z) -1.0))
(if (<= z 8.5e+15)
(* (+ 1.0 (- y z)) (/ x_m z))
(- (* x_m (/ y z)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -6e+23) {
tmp = x_m * ((y / z) + -1.0);
} else if (z <= 8.5e+15) {
tmp = (1.0 + (y - z)) * (x_m / z);
} else {
tmp = (x_m * (y / z)) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-6d+23)) then
tmp = x_m * ((y / z) + (-1.0d0))
else if (z <= 8.5d+15) then
tmp = (1.0d0 + (y - z)) * (x_m / z)
else
tmp = (x_m * (y / z)) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -6e+23) {
tmp = x_m * ((y / z) + -1.0);
} else if (z <= 8.5e+15) {
tmp = (1.0 + (y - z)) * (x_m / z);
} else {
tmp = (x_m * (y / z)) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -6e+23: tmp = x_m * ((y / z) + -1.0) elif z <= 8.5e+15: tmp = (1.0 + (y - z)) * (x_m / z) else: tmp = (x_m * (y / z)) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -6e+23) tmp = Float64(x_m * Float64(Float64(y / z) + -1.0)); elseif (z <= 8.5e+15) tmp = Float64(Float64(1.0 + Float64(y - z)) * Float64(x_m / z)); else tmp = Float64(Float64(x_m * Float64(y / 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 (z <= -6e+23) tmp = x_m * ((y / z) + -1.0); elseif (z <= 8.5e+15) tmp = (1.0 + (y - z)) * (x_m / z); else tmp = (x_m * (y / z)) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -6e+23], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+15], N[(N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(y / 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}\;z \leq -6 \cdot 10^{+23}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + -1\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(y - z\right)\right) \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y}{z} - x\_m\\
\end{array}
\end{array}
if z < -6.0000000000000002e23Initial program 70.4%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -6.0000000000000002e23 < z < 8.5e15Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
+-commutative99.9%
Applied egg-rr99.9%
if 8.5e15 < z Initial program 82.0%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 99.9%
distribute-rgt-in100.0%
neg-mul-1100.0%
unsub-neg100.0%
*-commutative100.0%
Applied egg-rr100.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 (<= z -4.9e+42)
(- x_m)
(if (<= z -8.5e-14) (* x_m (/ y z)) (if (<= z 1.0) (/ 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 (z <= -4.9e+42) {
tmp = -x_m;
} else if (z <= -8.5e-14) {
tmp = x_m * (y / z);
} else if (z <= 1.0) {
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) :: tmp
if (z <= (-4.9d+42)) then
tmp = -x_m
else if (z <= (-8.5d-14)) then
tmp = x_m * (y / z)
else if (z <= 1.0d0) 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 tmp;
if (z <= -4.9e+42) {
tmp = -x_m;
} else if (z <= -8.5e-14) {
tmp = x_m * (y / z);
} else if (z <= 1.0) {
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): tmp = 0 if z <= -4.9e+42: tmp = -x_m elif z <= -8.5e-14: tmp = x_m * (y / z) elif z <= 1.0: 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) tmp = 0.0 if (z <= -4.9e+42) tmp = Float64(-x_m); elseif (z <= -8.5e-14) tmp = Float64(x_m * Float64(y / z)); elseif (z <= 1.0) 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) tmp = 0.0; if (z <= -4.9e+42) tmp = -x_m; elseif (z <= -8.5e-14) tmp = x_m * (y / z); elseif (z <= 1.0) 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_] := N[(x$95$s * If[LessEqual[z, -4.9e+42], (-x$95$m), If[LessEqual[z, -8.5e-14], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], 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)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+42}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-14}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\_m\\
\end{array}
\end{array}
if z < -4.9000000000000002e42 or 1 < z Initial program 77.2%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 77.0%
neg-mul-177.0%
Simplified77.0%
if -4.9000000000000002e42 < z < -8.50000000000000038e-14Initial program 99.8%
associate-/l*99.4%
+-commutative99.4%
associate-+r-99.4%
div-sub99.4%
*-inverses99.4%
sub-neg99.4%
+-commutative99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 87.9%
associate-/l*87.5%
Simplified87.5%
if -8.50000000000000038e-14 < z < 1Initial program 99.9%
Taylor expanded in y around 0 58.9%
*-commutative58.9%
sub-neg58.9%
metadata-eval58.9%
distribute-neg-in58.9%
+-commutative58.9%
associate-/l*58.9%
+-commutative58.9%
distribute-neg-in58.9%
metadata-eval58.9%
sub-neg58.9%
Simplified58.9%
Taylor expanded in z around 0 58.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 (<= y -2.55e+20) (not (<= y 1.0)))
(* x_m (+ (/ y z) -1.0))
(- (/ 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.55e+20) || !(y <= 1.0)) {
tmp = x_m * ((y / z) + -1.0);
} 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 <= (-2.55d+20)) .or. (.not. (y <= 1.0d0))) then
tmp = x_m * ((y / z) + (-1.0d0))
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 <= -2.55e+20) || !(y <= 1.0)) {
tmp = x_m * ((y / z) + -1.0);
} 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 <= -2.55e+20) or not (y <= 1.0): tmp = x_m * ((y / z) + -1.0) 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 <= -2.55e+20) || !(y <= 1.0)) tmp = Float64(x_m * Float64(Float64(y / z) + -1.0)); 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 <= -2.55e+20) || ~((y <= 1.0))) tmp = x_m * ((y / z) + -1.0); 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, -2.55e+20], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + -1.0), $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 -2.55 \cdot 10^{+20} \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -2.55e20 or 1 < y Initial program 87.5%
associate-/l*88.8%
+-commutative88.8%
associate-+r-88.8%
div-sub88.9%
*-inverses88.9%
sub-neg88.9%
+-commutative88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in y around inf 88.9%
if -2.55e20 < y < 1Initial program 92.7%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
+-commutative99.8%
metadata-eval99.8%
Simplified99.8%
distribute-lft-in99.7%
clear-num99.7%
un-div-inv100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.5%
Final simplification93.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -1.4e+40)
(* x_m (+ (/ y z) -1.0))
(if (<= z 1.0) (/ (* x_m (+ 1.0 y)) z) (- (* x_m (/ y z)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -1.4e+40) {
tmp = x_m * ((y / z) + -1.0);
} else if (z <= 1.0) {
tmp = (x_m * (1.0 + y)) / z;
} else {
tmp = (x_m * (y / z)) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.4d+40)) then
tmp = x_m * ((y / z) + (-1.0d0))
else if (z <= 1.0d0) then
tmp = (x_m * (1.0d0 + y)) / z
else
tmp = (x_m * (y / z)) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -1.4e+40) {
tmp = x_m * ((y / z) + -1.0);
} else if (z <= 1.0) {
tmp = (x_m * (1.0 + y)) / z;
} else {
tmp = (x_m * (y / z)) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -1.4e+40: tmp = x_m * ((y / z) + -1.0) elif z <= 1.0: tmp = (x_m * (1.0 + y)) / z else: tmp = (x_m * (y / z)) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -1.4e+40) tmp = Float64(x_m * Float64(Float64(y / z) + -1.0)); elseif (z <= 1.0) tmp = Float64(Float64(x_m * Float64(1.0 + y)) / z); else tmp = Float64(Float64(x_m * Float64(y / 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 (z <= -1.4e+40) tmp = x_m * ((y / z) + -1.0); elseif (z <= 1.0) tmp = (x_m * (1.0 + y)) / z; else tmp = (x_m * (y / z)) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -1.4e+40], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(x$95$m * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m * N[(y / 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}\;z \leq -1.4 \cdot 10^{+40}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + -1\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x\_m \cdot \left(1 + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y}{z} - x\_m\\
\end{array}
\end{array}
if z < -1.4000000000000001e40Initial program 69.0%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -1.4000000000000001e40 < z < 1Initial program 99.9%
associate-/l*89.9%
+-commutative89.9%
associate-+r-89.9%
div-sub89.9%
*-inverses89.9%
sub-neg89.9%
+-commutative89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in z around 0 98.8%
if 1 < z Initial program 82.2%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 99.4%
distribute-rgt-in99.4%
neg-mul-199.4%
unsub-neg99.4%
*-commutative99.4%
Applied egg-rr99.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.55e+20)
(- (* x_m (/ y z)) x_m)
(if (<= y 1.0) (- (/ x_m z) x_m) (* x_m (+ (/ y 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 (y <= -2.55e+20) {
tmp = (x_m * (y / z)) - x_m;
} else if (y <= 1.0) {
tmp = (x_m / z) - x_m;
} else {
tmp = x_m * ((y / 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 (y <= (-2.55d+20)) then
tmp = (x_m * (y / z)) - x_m
else if (y <= 1.0d0) then
tmp = (x_m / z) - x_m
else
tmp = x_m * ((y / 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 (y <= -2.55e+20) {
tmp = (x_m * (y / z)) - x_m;
} else if (y <= 1.0) {
tmp = (x_m / z) - x_m;
} else {
tmp = x_m * ((y / 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 y <= -2.55e+20: tmp = (x_m * (y / z)) - x_m elif y <= 1.0: tmp = (x_m / z) - x_m else: tmp = x_m * ((y / 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 (y <= -2.55e+20) tmp = Float64(Float64(x_m * Float64(y / z)) - x_m); elseif (y <= 1.0) tmp = Float64(Float64(x_m / z) - x_m); else tmp = Float64(x_m * Float64(Float64(y / 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 (y <= -2.55e+20) tmp = (x_m * (y / z)) - x_m; elseif (y <= 1.0) tmp = (x_m / z) - x_m; else tmp = x_m * ((y / 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[y, -2.55e+20], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision], If[LessEqual[y, 1.0], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(x$95$m * N[(N[(y / 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}\;y \leq -2.55 \cdot 10^{+20}:\\
\;\;\;\;x\_m \cdot \frac{y}{z} - x\_m\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + -1\right)\\
\end{array}
\end{array}
if y < -2.55e20Initial program 87.8%
associate-/l*86.4%
+-commutative86.4%
associate-+r-86.4%
div-sub86.4%
*-inverses86.4%
sub-neg86.4%
+-commutative86.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in y around inf 86.4%
distribute-rgt-in86.4%
neg-mul-186.4%
unsub-neg86.4%
*-commutative86.4%
Applied egg-rr86.4%
if -2.55e20 < y < 1Initial program 92.7%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
+-commutative99.8%
metadata-eval99.8%
Simplified99.8%
distribute-lft-in99.7%
clear-num99.7%
un-div-inv100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.5%
if 1 < y Initial program 87.1%
associate-/l*91.8%
+-commutative91.8%
associate-+r-91.8%
div-sub91.8%
*-inverses91.8%
sub-neg91.8%
+-commutative91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in y around inf 91.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 (or (<= y -8.6e+55) (not (<= y 6e+45)))
(/ (* x_m y) z)
(- (/ x_m z) x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -8.6e+55) || !(y <= 6e+45)) {
tmp = (x_m * y) / z;
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-8.6d+55)) .or. (.not. (y <= 6d+45))) then
tmp = (x_m * y) / z
else
tmp = (x_m / z) - x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y <= -8.6e+55) || !(y <= 6e+45)) {
tmp = (x_m * y) / z;
} else {
tmp = (x_m / z) - x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (y <= -8.6e+55) or not (y <= 6e+45): tmp = (x_m * y) / z else: tmp = (x_m / z) - x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((y <= -8.6e+55) || !(y <= 6e+45)) tmp = Float64(Float64(x_m * y) / z); else tmp = Float64(Float64(x_m / z) - x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((y <= -8.6e+55) || ~((y <= 6e+45))) tmp = (x_m * y) / z; else tmp = (x_m / z) - x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -8.6e+55], N[Not[LessEqual[y, 6e+45]], $MachinePrecision]], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+55} \lor \neg \left(y \leq 6 \cdot 10^{+45}\right):\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -8.5999999999999998e55 or 6.00000000000000021e45 < y Initial program 89.1%
associate-/l*88.2%
+-commutative88.2%
associate-+r-88.2%
div-sub88.2%
*-inverses88.2%
sub-neg88.2%
+-commutative88.2%
metadata-eval88.2%
Simplified88.2%
Taylor expanded in y around inf 76.3%
if -8.5999999999999998e55 < y < 6.00000000000000021e45Initial program 90.8%
associate-/l*99.1%
+-commutative99.1%
associate-+r-99.1%
div-sub99.1%
*-inverses99.1%
sub-neg99.1%
+-commutative99.1%
metadata-eval99.1%
Simplified99.1%
distribute-lft-in99.1%
clear-num99.1%
un-div-inv99.8%
*-commutative99.8%
mul-1-neg99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 95.2%
Final simplification86.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 (or (<= y -7e+55) (not (<= y 2.5e+44)))
(* 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 <= -7e+55) || !(y <= 2.5e+44)) {
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 <= (-7d+55)) .or. (.not. (y <= 2.5d+44))) 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 <= -7e+55) || !(y <= 2.5e+44)) {
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 <= -7e+55) or not (y <= 2.5e+44): 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 <= -7e+55) || !(y <= 2.5e+44)) 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 <= -7e+55) || ~((y <= 2.5e+44))) 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, -7e+55], N[Not[LessEqual[y, 2.5e+44]], $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 -7 \cdot 10^{+55} \lor \neg \left(y \leq 2.5 \cdot 10^{+44}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -7.00000000000000021e55 or 2.4999999999999998e44 < y Initial program 89.1%
associate-/l*88.2%
+-commutative88.2%
associate-+r-88.2%
div-sub88.2%
*-inverses88.2%
sub-neg88.2%
+-commutative88.2%
metadata-eval88.2%
Simplified88.2%
Taylor expanded in y around inf 76.3%
*-commutative76.3%
associate-/l*73.4%
Applied egg-rr73.4%
if -7.00000000000000021e55 < y < 2.4999999999999998e44Initial program 90.8%
associate-/l*99.1%
+-commutative99.1%
associate-+r-99.1%
div-sub99.1%
*-inverses99.1%
sub-neg99.1%
+-commutative99.1%
metadata-eval99.1%
Simplified99.1%
distribute-lft-in99.1%
clear-num99.1%
un-div-inv99.8%
*-commutative99.8%
mul-1-neg99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 95.2%
Final simplification85.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 (<= x_m 20000000.0)
(- (/ (* x_m (+ 1.0 y)) z) x_m)
(* (+ 1.0 (- y z)) (/ 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 (x_m <= 20000000.0) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = (1.0 + (y - z)) * (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 (x_m <= 20000000.0d0) then
tmp = ((x_m * (1.0d0 + y)) / z) - x_m
else
tmp = (1.0d0 + (y - z)) * (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 (x_m <= 20000000.0) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = (1.0 + (y - z)) * (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 x_m <= 20000000.0: tmp = ((x_m * (1.0 + y)) / z) - x_m else: tmp = (1.0 + (y - z)) * (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 (x_m <= 20000000.0) tmp = Float64(Float64(Float64(x_m * Float64(1.0 + y)) / z) - x_m); else tmp = Float64(Float64(1.0 + Float64(y - z)) * 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 (x_m <= 20000000.0) tmp = ((x_m * (1.0 + y)) / z) - x_m; else tmp = (1.0 + (y - z)) * (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[x$95$m, 20000000.0], N[(N[(N[(x$95$m * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(1.0 + N[(y - z), $MachinePrecision]), $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}\;x\_m \leq 20000000:\\
\;\;\;\;\frac{x\_m \cdot \left(1 + y\right)}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(y - z\right)\right) \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if x < 2e7Initial program 93.3%
associate-/l*92.6%
+-commutative92.6%
associate-+r-92.6%
div-sub92.7%
*-inverses92.7%
sub-neg92.7%
+-commutative92.7%
metadata-eval92.7%
Simplified92.7%
distribute-lft-in92.7%
clear-num92.6%
un-div-inv94.0%
*-commutative94.0%
mul-1-neg94.0%
Applied egg-rr94.0%
Taylor expanded in z around inf 97.6%
if 2e7 < x Initial program 78.8%
*-commutative78.8%
associate-/l*99.9%
+-commutative99.9%
Applied egg-rr99.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -1.0) (not (<= z 1.0))) (- x_m) (/ x_m z))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x_m;
} else {
tmp = x_m / z;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = -x_m
else
tmp = x_m / z
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x_m;
} else {
tmp = x_m / z;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = -x_m else: tmp = x_m / z return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(-x_m); else tmp = Float64(x_m / z); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = -x_m; else tmp = x_m / z; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x$95$m), N[(x$95$m / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 78.2%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 73.8%
neg-mul-173.8%
Simplified73.8%
if -1 < z < 1Initial program 99.9%
Taylor expanded in y around 0 58.4%
*-commutative58.4%
sub-neg58.4%
metadata-eval58.4%
distribute-neg-in58.4%
+-commutative58.4%
associate-/l*58.4%
+-commutative58.4%
distribute-neg-in58.4%
metadata-eval58.4%
sub-neg58.4%
Simplified58.4%
Taylor expanded in z around 0 57.3%
Final simplification64.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 90.1%
associate-/l*94.3%
+-commutative94.3%
associate-+r-94.3%
div-sub94.3%
*-inverses94.3%
sub-neg94.3%
+-commutative94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in z around inf 35.1%
neg-mul-135.1%
Simplified35.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s 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 90.1%
associate-/l*94.3%
+-commutative94.3%
associate-+r-94.3%
div-sub94.3%
*-inverses94.3%
sub-neg94.3%
+-commutative94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in z around inf 35.1%
neg-mul-135.1%
Simplified35.1%
neg-sub035.1%
sub-neg35.1%
add-sqr-sqrt17.4%
sqrt-unprod20.4%
sqr-neg20.4%
sqrt-unprod1.6%
add-sqr-sqrt3.0%
Applied egg-rr3.0%
+-lft-identity3.0%
Simplified3.0%
(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 2024157
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -67870776678359/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (+ 1 y) (/ x z)) x) (if (< x 1937054408219773/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x))))
(/ (* x (+ (- y z) 1.0)) z))