
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= x_m 95000000000000.0)
(/ (* x_m (- y z)) (- t z))
(* (- z y) (/ x_m (- z t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 95000000000000.0) {
tmp = (x_m * (y - z)) / (t - z);
} else {
tmp = (z - y) * (x_m / (z - t));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x_m <= 95000000000000.0d0) then
tmp = (x_m * (y - z)) / (t - z)
else
tmp = (z - y) * (x_m / (z - t))
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) {
double tmp;
if (x_m <= 95000000000000.0) {
tmp = (x_m * (y - z)) / (t - z);
} else {
tmp = (z - y) * (x_m / (z - t));
}
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): tmp = 0 if x_m <= 95000000000000.0: tmp = (x_m * (y - z)) / (t - z) else: tmp = (z - y) * (x_m / (z - t)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (x_m <= 95000000000000.0) tmp = Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)); else tmp = Float64(Float64(z - y) * Float64(x_m / Float64(z - t))); 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) tmp = 0.0; if (x_m <= 95000000000000.0) tmp = (x_m * (y - z)) / (t - z); else tmp = (z - y) * (x_m / (z - t)); 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_, t_] := N[(x$95$s * If[LessEqual[x$95$m, 95000000000000.0], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(x$95$m / N[(z - t), $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 95000000000000:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\left(z - y\right) \cdot \frac{x\_m}{z - t}\\
\end{array}
\end{array}
if x < 9.5e13Initial program 86.7%
if 9.5e13 < x Initial program 59.7%
remove-double-neg59.7%
distribute-lft-neg-out59.7%
distribute-neg-frac59.7%
distribute-neg-frac259.7%
distribute-lft-neg-out59.7%
distribute-rgt-neg-in59.7%
sub-neg59.7%
distribute-neg-in59.7%
remove-double-neg59.7%
+-commutative59.7%
sub-neg59.7%
sub-neg59.7%
distribute-neg-in59.7%
remove-double-neg59.7%
+-commutative59.7%
sub-neg59.7%
Simplified59.7%
*-commutative59.7%
associate-/l*95.9%
Applied egg-rr95.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -1.2e-52)
x_m
(if (<= z -3e-126)
(/ (* x_m (- y)) z)
(if (<= z 1.4e-53) (* y (/ x_m t)) 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) {
double tmp;
if (z <= -1.2e-52) {
tmp = x_m;
} else if (z <= -3e-126) {
tmp = (x_m * -y) / z;
} else if (z <= 1.4e-53) {
tmp = y * (x_m / t);
} 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.2d-52)) then
tmp = x_m
else if (z <= (-3d-126)) then
tmp = (x_m * -y) / z
else if (z <= 1.4d-53) then
tmp = y * (x_m / t)
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) {
double tmp;
if (z <= -1.2e-52) {
tmp = x_m;
} else if (z <= -3e-126) {
tmp = (x_m * -y) / z;
} else if (z <= 1.4e-53) {
tmp = y * (x_m / t);
} 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): tmp = 0 if z <= -1.2e-52: tmp = x_m elif z <= -3e-126: tmp = (x_m * -y) / z elif z <= 1.4e-53: tmp = y * (x_m / t) 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) tmp = 0.0 if (z <= -1.2e-52) tmp = x_m; elseif (z <= -3e-126) tmp = Float64(Float64(x_m * Float64(-y)) / z); elseif (z <= 1.4e-53) tmp = Float64(y * Float64(x_m / t)); else tmp = 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) tmp = 0.0; if (z <= -1.2e-52) tmp = x_m; elseif (z <= -3e-126) tmp = (x_m * -y) / z; elseif (z <= 1.4e-53) tmp = y * (x_m / t); 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_, t_] := N[(x$95$s * If[LessEqual[z, -1.2e-52], x$95$m, If[LessEqual[z, -3e-126], N[(N[(x$95$m * (-y)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.4e-53], N[(y * N[(x$95$m / t), $MachinePrecision]), $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.2 \cdot 10^{-52}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-126}:\\
\;\;\;\;\frac{x\_m \cdot \left(-y\right)}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.2000000000000001e-52 or 1.39999999999999993e-53 < z Initial program 71.6%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in z around inf 56.8%
if -1.2000000000000001e-52 < z < -3.0000000000000002e-126Initial program 94.4%
associate-/l*88.7%
Simplified88.7%
Taylor expanded in y around inf 77.1%
Taylor expanded in t around 0 66.1%
associate-*r/66.1%
associate-*r*66.1%
neg-mul-166.1%
*-commutative66.1%
Simplified66.1%
if -3.0000000000000002e-126 < z < 1.39999999999999993e-53Initial program 93.2%
associate-/l*87.3%
Simplified87.3%
Taylor expanded in z around 0 77.8%
*-commutative77.8%
associate-/l*78.2%
Applied egg-rr78.2%
Final simplification65.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -4.2e-45) (not (<= z 3.6)))
(* x_m (- 1.0 (/ y z)))
(/ (* x_m y) (- t 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) {
double tmp;
if ((z <= -4.2e-45) || !(z <= 3.6)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = (x_m * y) / (t - 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.2d-45)) .or. (.not. (z <= 3.6d0))) then
tmp = x_m * (1.0d0 - (y / z))
else
tmp = (x_m * y) / (t - 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) {
double tmp;
if ((z <= -4.2e-45) || !(z <= 3.6)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = (x_m * y) / (t - 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): tmp = 0 if (z <= -4.2e-45) or not (z <= 3.6): tmp = x_m * (1.0 - (y / z)) else: tmp = (x_m * y) / (t - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -4.2e-45) || !(z <= 3.6)) tmp = Float64(x_m * Float64(1.0 - Float64(y / z))); else tmp = Float64(Float64(x_m * y) / Float64(t - 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) tmp = 0.0; if ((z <= -4.2e-45) || ~((z <= 3.6))) tmp = x_m * (1.0 - (y / z)); else tmp = (x_m * y) / (t - 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_, t_] := N[(x$95$s * If[Or[LessEqual[z, -4.2e-45], N[Not[LessEqual[z, 3.6]], $MachinePrecision]], N[(x$95$m * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-45} \lor \neg \left(z \leq 3.6\right):\\
\;\;\;\;x\_m \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot y}{t - z}\\
\end{array}
\end{array}
if z < -4.1999999999999999e-45 or 3.60000000000000009 < z Initial program 69.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 54.1%
mul-1-neg54.1%
associate-/l*77.3%
distribute-rgt-neg-in77.3%
distribute-frac-neg77.3%
sub-neg77.3%
distribute-neg-in77.3%
remove-double-neg77.3%
+-commutative77.3%
sub-neg77.3%
div-sub77.3%
*-inverses77.3%
Simplified77.3%
if -4.1999999999999999e-45 < z < 3.60000000000000009Initial program 93.8%
associate-/l*87.5%
Simplified87.5%
Taylor expanded in y around inf 83.7%
Final simplification80.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -9e-9) (not (<= z 1.7e-35)))
(* x_m (- 1.0 (/ y z)))
(/ x_m (/ (- t z) y)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -9e-9) || !(z <= 1.7e-35)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = x_m / ((t - z) / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9d-9)) .or. (.not. (z <= 1.7d-35))) then
tmp = x_m * (1.0d0 - (y / z))
else
tmp = x_m / ((t - z) / y)
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) {
double tmp;
if ((z <= -9e-9) || !(z <= 1.7e-35)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = x_m / ((t - z) / y);
}
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): tmp = 0 if (z <= -9e-9) or not (z <= 1.7e-35): tmp = x_m * (1.0 - (y / z)) else: tmp = x_m / ((t - z) / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -9e-9) || !(z <= 1.7e-35)) tmp = Float64(x_m * Float64(1.0 - Float64(y / z))); else tmp = Float64(x_m / Float64(Float64(t - z) / y)); 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) tmp = 0.0; if ((z <= -9e-9) || ~((z <= 1.7e-35))) tmp = x_m * (1.0 - (y / z)); else tmp = x_m / ((t - z) / y); 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_, t_] := N[(x$95$s * If[Or[LessEqual[z, -9e-9], N[Not[LessEqual[z, 1.7e-35]], $MachinePrecision]], N[(x$95$m * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(N[(t - z), $MachinePrecision] / y), $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 -9 \cdot 10^{-9} \lor \neg \left(z \leq 1.7 \cdot 10^{-35}\right):\\
\;\;\;\;x\_m \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{t - z}{y}}\\
\end{array}
\end{array}
if z < -8.99999999999999953e-9 or 1.7000000000000001e-35 < z Initial program 70.6%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in t around 0 56.1%
mul-1-neg56.1%
associate-/l*78.6%
distribute-rgt-neg-in78.6%
distribute-frac-neg78.6%
sub-neg78.6%
distribute-neg-in78.6%
remove-double-neg78.6%
+-commutative78.6%
sub-neg78.6%
div-sub78.6%
*-inverses78.6%
Simplified78.6%
if -8.99999999999999953e-9 < z < 1.7000000000000001e-35Initial program 93.1%
associate-/l*88.3%
Simplified88.3%
Taylor expanded in x around 0 93.1%
*-rgt-identity93.1%
times-frac93.4%
/-rgt-identity93.4%
associate-/r/87.9%
Simplified87.9%
Taylor expanded in y around inf 77.8%
Final simplification78.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -1.52e-9) (not (<= z 9e-63)))
(* x_m (- 1.0 (/ y z)))
(* x_m (/ (- y z) t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -1.52e-9) || !(z <= 9e-63)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = x_m * ((y - z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.52d-9)) .or. (.not. (z <= 9d-63))) then
tmp = x_m * (1.0d0 - (y / z))
else
tmp = x_m * ((y - z) / t)
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) {
double tmp;
if ((z <= -1.52e-9) || !(z <= 9e-63)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = x_m * ((y - z) / t);
}
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): tmp = 0 if (z <= -1.52e-9) or not (z <= 9e-63): tmp = x_m * (1.0 - (y / z)) else: tmp = x_m * ((y - z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -1.52e-9) || !(z <= 9e-63)) tmp = Float64(x_m * Float64(1.0 - Float64(y / z))); else tmp = Float64(x_m * Float64(Float64(y - z) / t)); 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) tmp = 0.0; if ((z <= -1.52e-9) || ~((z <= 9e-63))) tmp = x_m * (1.0 - (y / z)); else tmp = x_m * ((y - z) / t); 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_, t_] := N[(x$95$s * If[Or[LessEqual[z, -1.52e-9], N[Not[LessEqual[z, 9e-63]], $MachinePrecision]], N[(x$95$m * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y - z), $MachinePrecision] / t), $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.52 \cdot 10^{-9} \lor \neg \left(z \leq 9 \cdot 10^{-63}\right):\\
\;\;\;\;x\_m \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if z < -1.51999999999999992e-9 or 8.9999999999999999e-63 < z Initial program 71.5%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in t around 0 56.6%
mul-1-neg56.6%
associate-/l*77.8%
distribute-rgt-neg-in77.8%
distribute-frac-neg77.8%
sub-neg77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
+-commutative77.8%
sub-neg77.8%
div-sub77.8%
*-inverses77.8%
Simplified77.8%
if -1.51999999999999992e-9 < z < 8.9999999999999999e-63Initial program 92.8%
associate-/l*87.9%
Simplified87.9%
Taylor expanded in t around inf 76.0%
associate-/l*74.9%
Simplified74.9%
Final simplification76.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -3e-126) (not (<= z 3.7e-60)))
(* x_m (- 1.0 (/ y z)))
(* y (/ x_m t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -3e-126) || !(z <= 3.7e-60)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = y * (x_m / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3d-126)) .or. (.not. (z <= 3.7d-60))) then
tmp = x_m * (1.0d0 - (y / z))
else
tmp = y * (x_m / t)
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) {
double tmp;
if ((z <= -3e-126) || !(z <= 3.7e-60)) {
tmp = x_m * (1.0 - (y / z));
} else {
tmp = y * (x_m / t);
}
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): tmp = 0 if (z <= -3e-126) or not (z <= 3.7e-60): tmp = x_m * (1.0 - (y / z)) else: tmp = y * (x_m / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -3e-126) || !(z <= 3.7e-60)) tmp = Float64(x_m * Float64(1.0 - Float64(y / z))); else tmp = Float64(y * Float64(x_m / t)); 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) tmp = 0.0; if ((z <= -3e-126) || ~((z <= 3.7e-60))) tmp = x_m * (1.0 - (y / z)); else tmp = y * (x_m / t); 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_, t_] := N[(x$95$s * If[Or[LessEqual[z, -3e-126], N[Not[LessEqual[z, 3.7e-60]], $MachinePrecision]], N[(x$95$m * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x$95$m / t), $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 -3 \cdot 10^{-126} \lor \neg \left(z \leq 3.7 \cdot 10^{-60}\right):\\
\;\;\;\;x\_m \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\end{array}
\end{array}
if z < -3.0000000000000002e-126 or 3.70000000000000025e-60 < z Initial program 74.4%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in t around 0 56.3%
mul-1-neg56.3%
associate-/l*73.2%
distribute-rgt-neg-in73.2%
distribute-frac-neg73.2%
sub-neg73.2%
distribute-neg-in73.2%
remove-double-neg73.2%
+-commutative73.2%
sub-neg73.2%
div-sub73.3%
*-inverses73.3%
Simplified73.3%
if -3.0000000000000002e-126 < z < 3.70000000000000025e-60Initial program 93.1%
associate-/l*87.0%
Simplified87.0%
Taylor expanded in z around 0 78.4%
*-commutative78.4%
associate-/l*78.8%
Applied egg-rr78.8%
Final simplification75.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -1.6e-6) x_m (if (<= z 1.4e-53) (* y (/ x_m t)) 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) {
double tmp;
if (z <= -1.6e-6) {
tmp = x_m;
} else if (z <= 1.4e-53) {
tmp = y * (x_m / t);
} 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.6d-6)) then
tmp = x_m
else if (z <= 1.4d-53) then
tmp = y * (x_m / t)
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) {
double tmp;
if (z <= -1.6e-6) {
tmp = x_m;
} else if (z <= 1.4e-53) {
tmp = y * (x_m / t);
} 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): tmp = 0 if z <= -1.6e-6: tmp = x_m elif z <= 1.4e-53: tmp = y * (x_m / t) 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) tmp = 0.0 if (z <= -1.6e-6) tmp = x_m; elseif (z <= 1.4e-53) tmp = Float64(y * Float64(x_m / t)); else tmp = 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) tmp = 0.0; if (z <= -1.6e-6) tmp = x_m; elseif (z <= 1.4e-53) tmp = y * (x_m / t); 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_, t_] := N[(x$95$s * If[LessEqual[z, -1.6e-6], x$95$m, If[LessEqual[z, 1.4e-53], N[(y * N[(x$95$m / t), $MachinePrecision]), $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.6 \cdot 10^{-6}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.5999999999999999e-6 or 1.39999999999999993e-53 < z Initial program 71.1%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in z around inf 58.3%
if -1.5999999999999999e-6 < z < 1.39999999999999993e-53Initial program 93.0%
associate-/l*88.1%
Simplified88.1%
Taylor expanded in z around 0 69.3%
*-commutative69.3%
associate-/l*70.4%
Applied egg-rr70.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -1.9e+27) x_m (if (<= z 1.4e-53) (* x_m (/ y t)) 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) {
double tmp;
if (z <= -1.9e+27) {
tmp = x_m;
} else if (z <= 1.4e-53) {
tmp = x_m * (y / t);
} 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.9d+27)) then
tmp = x_m
else if (z <= 1.4d-53) then
tmp = x_m * (y / t)
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) {
double tmp;
if (z <= -1.9e+27) {
tmp = x_m;
} else if (z <= 1.4e-53) {
tmp = x_m * (y / t);
} 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): tmp = 0 if z <= -1.9e+27: tmp = x_m elif z <= 1.4e-53: tmp = x_m * (y / t) 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) tmp = 0.0 if (z <= -1.9e+27) tmp = x_m; elseif (z <= 1.4e-53) tmp = Float64(x_m * Float64(y / t)); else tmp = 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) tmp = 0.0; if (z <= -1.9e+27) tmp = x_m; elseif (z <= 1.4e-53) tmp = x_m * (y / t); 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_, t_] := N[(x$95$s * If[LessEqual[z, -1.9e+27], x$95$m, If[LessEqual[z, 1.4e-53], N[(x$95$m * N[(y / t), $MachinePrecision]), $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.9 \cdot 10^{+27}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-53}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.90000000000000011e27 or 1.39999999999999993e-53 < z Initial program 68.8%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in z around inf 60.8%
if -1.90000000000000011e27 < z < 1.39999999999999993e-53Initial program 92.4%
associate-/l*89.4%
Simplified89.4%
Taylor expanded in z around 0 64.8%
associate-/l*66.1%
Simplified66.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y 3.9e+157)
(* x_m (/ (- y z) (- t z)))
(* (- z y) (/ x_m (- z t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= 3.9e+157) {
tmp = x_m * ((y - z) / (t - z));
} else {
tmp = (z - y) * (x_m / (z - t));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.9d+157) then
tmp = x_m * ((y - z) / (t - z))
else
tmp = (z - y) * (x_m / (z - t))
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) {
double tmp;
if (y <= 3.9e+157) {
tmp = x_m * ((y - z) / (t - z));
} else {
tmp = (z - y) * (x_m / (z - t));
}
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): tmp = 0 if y <= 3.9e+157: tmp = x_m * ((y - z) / (t - z)) else: tmp = (z - y) * (x_m / (z - t)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= 3.9e+157) tmp = Float64(x_m * Float64(Float64(y - z) / Float64(t - z))); else tmp = Float64(Float64(z - y) * Float64(x_m / Float64(z - t))); 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) tmp = 0.0; if (y <= 3.9e+157) tmp = x_m * ((y - z) / (t - z)); else tmp = (z - y) * (x_m / (z - t)); 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_, t_] := N[(x$95$s * If[LessEqual[y, 3.9e+157], N[(x$95$m * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(x$95$m / N[(z - t), $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}\;y \leq 3.9 \cdot 10^{+157}:\\
\;\;\;\;x\_m \cdot \frac{y - z}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\left(z - y\right) \cdot \frac{x\_m}{z - t}\\
\end{array}
\end{array}
if y < 3.89999999999999971e157Initial program 81.5%
associate-/l*96.3%
Simplified96.3%
if 3.89999999999999971e157 < y Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
distribute-lft-neg-out81.5%
distribute-rgt-neg-in81.5%
sub-neg81.5%
distribute-neg-in81.5%
remove-double-neg81.5%
+-commutative81.5%
sub-neg81.5%
sub-neg81.5%
distribute-neg-in81.5%
remove-double-neg81.5%
+-commutative81.5%
sub-neg81.5%
Simplified81.5%
*-commutative81.5%
associate-/l*97.1%
Applied egg-rr97.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (- y z) (- t 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) {
return x_s * (x_m * ((y - z) / (t - z)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * ((y - z) / (t - z)))
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) {
return x_s * (x_m * ((y - z) / (t - z)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * ((y - z) / (t - z)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(y - z) / Float64(t - z)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * ((y - z) / (t - z))); 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_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $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 \frac{y - z}{t - z}\right)
\end{array}
Initial program 81.5%
associate-/l*93.8%
Simplified93.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :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, double t) {
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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
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, double t) {
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, t): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) 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, t) 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_, t_] := 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 81.5%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in z around inf 34.6%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024165
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))