
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * 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 * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * 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 * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 7e-60)
(- x_m (* z (* x_m (- 1.0 y))))
(+ x_m (* (+ -1.0 y) (* x_m z))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 7e-60) {
tmp = x_m - (z * (x_m * (1.0 - y)));
} else {
tmp = x_m + ((-1.0 + 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 (x_m <= 7d-60) then
tmp = x_m - (z * (x_m * (1.0d0 - y)))
else
tmp = x_m + (((-1.0d0) + 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 (x_m <= 7e-60) {
tmp = x_m - (z * (x_m * (1.0 - y)));
} else {
tmp = x_m + ((-1.0 + 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 x_m <= 7e-60: tmp = x_m - (z * (x_m * (1.0 - y))) else: tmp = x_m + ((-1.0 + 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 (x_m <= 7e-60) tmp = Float64(x_m - Float64(z * Float64(x_m * Float64(1.0 - y)))); else tmp = Float64(x_m + Float64(Float64(-1.0 + 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 (x_m <= 7e-60) tmp = x_m - (z * (x_m * (1.0 - y))); else tmp = x_m + ((-1.0 + 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[x$95$m, 7e-60], N[(x$95$m - N[(z * N[(x$95$m * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m + N[(N[(-1.0 + y), $MachinePrecision] * N[(x$95$m * z), $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 7 \cdot 10^{-60}:\\
\;\;\;\;x_m - z \cdot \left(x_m \cdot \left(1 - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x_m + \left(-1 + y\right) \cdot \left(x_m \cdot z\right)\\
\end{array}
\end{array}
if x < 6.99999999999999952e-60Initial program 95.9%
Taylor expanded in z around 0 95.9%
Taylor expanded in y around 0 90.5%
+-commutative90.5%
*-commutative90.5%
associate-*r*88.8%
*-commutative88.8%
distribute-lft-in95.8%
*-commutative95.8%
associate-*l*99.4%
+-commutative99.4%
Simplified99.4%
if 6.99999999999999952e-60 < x Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 92.7%
+-commutative92.7%
*-commutative92.7%
associate-*r*88.3%
*-commutative88.3%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l*90.4%
+-commutative90.4%
Simplified90.4%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z (- 1.0 y)) 5e+286)
(* x_m (+ 1.0 (* z (+ -1.0 y))))
(+ x_m (* y (* x_m z))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * (1.0 - y)) <= 5e+286) {
tmp = x_m * (1.0 + (z * (-1.0 + y)));
} else {
tmp = x_m + (y * (x_m * z));
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * (1.0d0 - y)) <= 5d+286) then
tmp = x_m * (1.0d0 + (z * ((-1.0d0) + y)))
else
tmp = x_m + (y * (x_m * z))
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * (1.0 - y)) <= 5e+286) {
tmp = x_m * (1.0 + (z * (-1.0 + y)));
} else {
tmp = x_m + (y * (x_m * z));
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z * (1.0 - y)) <= 5e+286: tmp = x_m * (1.0 + (z * (-1.0 + y))) else: tmp = x_m + (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 (Float64(z * Float64(1.0 - y)) <= 5e+286) tmp = Float64(x_m * Float64(1.0 + Float64(z * Float64(-1.0 + y)))); else tmp = Float64(x_m + Float64(y * Float64(x_m * z))); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z * (1.0 - y)) <= 5e+286) tmp = x_m * (1.0 + (z * (-1.0 + y))); else tmp = x_m + (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[N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 5e+286], N[(x$95$m * N[(1.0 + N[(z * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m + N[(y * N[(x$95$m * z), $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}\;z \cdot \left(1 - y\right) \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x_m \cdot \left(1 + z \cdot \left(-1 + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x_m + y \cdot \left(x_m \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < 5.0000000000000004e286Initial program 98.7%
if 5.0000000000000004e286 < (*.f64 (-.f64 1 y) z) Initial program 76.6%
Taylor expanded in z around 0 76.6%
Taylor expanded in y around 0 51.6%
+-commutative51.6%
*-commutative51.6%
associate-*r*74.8%
*-commutative74.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around 0 76.6%
associate-*r*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 76.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.8%
Simplified99.8%
Final simplification98.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z (- 1.0 y)) 5e+286)
(+ x_m (* x_m (* z (+ -1.0 y))))
(+ x_m (* y (* x_m z))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * (1.0 - y)) <= 5e+286) {
tmp = x_m + (x_m * (z * (-1.0 + y)));
} else {
tmp = x_m + (y * (x_m * z));
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * (1.0d0 - y)) <= 5d+286) then
tmp = x_m + (x_m * (z * ((-1.0d0) + y)))
else
tmp = x_m + (y * (x_m * z))
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * (1.0 - y)) <= 5e+286) {
tmp = x_m + (x_m * (z * (-1.0 + y)));
} else {
tmp = x_m + (y * (x_m * z));
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z * (1.0 - y)) <= 5e+286: tmp = x_m + (x_m * (z * (-1.0 + y))) else: tmp = x_m + (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 (Float64(z * Float64(1.0 - y)) <= 5e+286) tmp = Float64(x_m + Float64(x_m * Float64(z * Float64(-1.0 + y)))); else tmp = Float64(x_m + Float64(y * Float64(x_m * z))); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z * (1.0 - y)) <= 5e+286) tmp = x_m + (x_m * (z * (-1.0 + y))); else tmp = x_m + (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[N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 5e+286], N[(x$95$m + N[(x$95$m * N[(z * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m + N[(y * N[(x$95$m * z), $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}\;z \cdot \left(1 - y\right) \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x_m + x_m \cdot \left(z \cdot \left(-1 + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x_m + y \cdot \left(x_m \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < 5.0000000000000004e286Initial program 98.7%
Taylor expanded in z around 0 98.7%
if 5.0000000000000004e286 < (*.f64 (-.f64 1 y) z) Initial program 76.6%
Taylor expanded in z around 0 76.6%
Taylor expanded in y around 0 51.6%
+-commutative51.6%
*-commutative51.6%
associate-*r*74.8%
*-commutative74.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around 0 76.6%
associate-*r*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 76.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.8%
Simplified99.8%
Final simplification98.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* x_m (* z y))))
(*
x_s
(if (<= y -13500000.0)
t_0
(if (<= y -1.05e-245) x_m (if (<= y 7.0) (* x_m (- z)) t_0))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = x_m * (z * y);
double tmp;
if (y <= -13500000.0) {
tmp = t_0;
} else if (y <= -1.05e-245) {
tmp = x_m;
} else if (y <= 7.0) {
tmp = x_m * -z;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x_m * (z * y)
if (y <= (-13500000.0d0)) then
tmp = t_0
else if (y <= (-1.05d-245)) then
tmp = x_m
else if (y <= 7.0d0) then
tmp = x_m * -z
else
tmp = t_0
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = x_m * (z * y);
double tmp;
if (y <= -13500000.0) {
tmp = t_0;
} else if (y <= -1.05e-245) {
tmp = x_m;
} else if (y <= 7.0) {
tmp = x_m * -z;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = x_m * (z * y) tmp = 0 if y <= -13500000.0: tmp = t_0 elif y <= -1.05e-245: tmp = x_m elif y <= 7.0: tmp = x_m * -z else: tmp = t_0 return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(x_m * Float64(z * y)) tmp = 0.0 if (y <= -13500000.0) tmp = t_0; elseif (y <= -1.05e-245) tmp = x_m; elseif (y <= 7.0) tmp = Float64(x_m * Float64(-z)); else tmp = t_0; end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = x_m * (z * y); tmp = 0.0; if (y <= -13500000.0) tmp = t_0; elseif (y <= -1.05e-245) tmp = x_m; elseif (y <= 7.0) tmp = x_m * -z; else tmp = t_0; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -13500000.0], t$95$0, If[LessEqual[y, -1.05e-245], x$95$m, If[LessEqual[y, 7.0], N[(x$95$m * (-z)), $MachinePrecision], t$95$0]]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := x_m \cdot \left(z \cdot y\right)\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -13500000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-245}:\\
\;\;\;\;x_m\\
\mathbf{elif}\;y \leq 7:\\
\;\;\;\;x_m \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
\end{array}
if y < -1.35e7 or 7 < y Initial program 94.3%
Taylor expanded in y around inf 71.6%
*-commutative71.6%
Simplified71.6%
if -1.35e7 < y < -1.05000000000000005e-245Initial program 100.0%
Taylor expanded in z around 0 68.0%
if -1.05000000000000005e-245 < y < 7Initial program 100.0%
Taylor expanded in z around inf 59.5%
Taylor expanded in y around 0 59.6%
mul-1-neg59.6%
*-commutative59.6%
distribute-rgt-neg-in59.6%
Simplified59.6%
Final simplification67.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= y -1.0) (not (<= y 2.8e-8)))
(+ x_m (* x_m (* z y)))
(- 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 ((y <= -1.0) || !(y <= 2.8e-8)) {
tmp = x_m + (x_m * (z * y));
} else {
tmp = x_m - (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 <= (-1.0d0)) .or. (.not. (y <= 2.8d-8))) then
tmp = x_m + (x_m * (z * y))
else
tmp = x_m - (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 <= -1.0) || !(y <= 2.8e-8)) {
tmp = x_m + (x_m * (z * y));
} else {
tmp = x_m - (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 <= -1.0) or not (y <= 2.8e-8): tmp = x_m + (x_m * (z * y)) else: tmp = x_m - (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 <= -1.0) || !(y <= 2.8e-8)) tmp = Float64(x_m + Float64(x_m * Float64(z * y))); else tmp = Float64(x_m - 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 <= -1.0) || ~((y <= 2.8e-8))) tmp = x_m + (x_m * (z * y)); else tmp = x_m - (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[y, -1.0], N[Not[LessEqual[y, 2.8e-8]], $MachinePrecision]], N[(x$95$m + N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m - 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 -1 \lor \neg \left(y \leq 2.8 \cdot 10^{-8}\right):\\
\;\;\;\;x_m + x_m \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x_m - x_m \cdot z\\
\end{array}
\end{array}
if y < -1 or 2.7999999999999999e-8 < y Initial program 94.4%
Taylor expanded in z around 0 94.5%
Taylor expanded in y around inf 93.4%
*-commutative93.4%
Simplified93.4%
if -1 < y < 2.7999999999999999e-8Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 95.7%
+-commutative95.7%
*-commutative95.7%
associate-*r*90.5%
*-commutative90.5%
distribute-lft-in100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification96.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -5.9e+46)
(* z (* x_m y))
(if (<= y 2200.0) (- x_m (* x_m z)) (* x_m (* z (+ -1.0 y)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= -5.9e+46) {
tmp = z * (x_m * y);
} else if (y <= 2200.0) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m * (z * (-1.0 + 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)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.9d+46)) then
tmp = z * (x_m * y)
else if (y <= 2200.0d0) then
tmp = x_m - (x_m * z)
else
tmp = x_m * (z * ((-1.0d0) + 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 tmp;
if (y <= -5.9e+46) {
tmp = z * (x_m * y);
} else if (y <= 2200.0) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m * (z * (-1.0 + 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): tmp = 0 if y <= -5.9e+46: tmp = z * (x_m * y) elif y <= 2200.0: tmp = x_m - (x_m * z) else: tmp = x_m * (z * (-1.0 + y)) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -5.9e+46) tmp = Float64(z * Float64(x_m * y)); elseif (y <= 2200.0) tmp = Float64(x_m - Float64(x_m * z)); else tmp = Float64(x_m * Float64(z * Float64(-1.0 + 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) tmp = 0.0; if (y <= -5.9e+46) tmp = z * (x_m * y); elseif (y <= 2200.0) tmp = x_m - (x_m * z); else tmp = x_m * (z * (-1.0 + 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_] := N[(x$95$s * If[LessEqual[y, -5.9e+46], N[(z * N[(x$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2200.0], N[(x$95$m - N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(z * N[(-1.0 + y), $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 -5.9 \cdot 10^{+46}:\\
\;\;\;\;z \cdot \left(x_m \cdot y\right)\\
\mathbf{elif}\;y \leq 2200:\\
\;\;\;\;x_m - x_m \cdot z\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \left(z \cdot \left(-1 + y\right)\right)\\
\end{array}
\end{array}
if y < -5.8999999999999999e46Initial program 89.6%
Taylor expanded in y around inf 71.0%
associate-*r*77.8%
*-commutative77.8%
Simplified77.8%
if -5.8999999999999999e46 < y < 2200Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 96.2%
+-commutative96.2%
*-commutative96.2%
associate-*r*91.6%
*-commutative91.6%
distribute-lft-in100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 95.8%
neg-mul-195.8%
unsub-neg95.8%
Simplified95.8%
if 2200 < y Initial program 96.9%
Taylor expanded in z around inf 76.9%
Final simplification86.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -1.0)
(+ x_m (* y (* x_m z)))
(if (<= y 2.8e-8) (- x_m (* x_m z)) (+ x_m (* x_m (* 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 tmp;
if (y <= -1.0) {
tmp = x_m + (y * (x_m * z));
} else if (y <= 2.8e-8) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m + (x_m * (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)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x_m + (y * (x_m * z))
else if (y <= 2.8d-8) then
tmp = x_m - (x_m * z)
else
tmp = x_m + (x_m * (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 tmp;
if (y <= -1.0) {
tmp = x_m + (y * (x_m * z));
} else if (y <= 2.8e-8) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m + (x_m * (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): tmp = 0 if y <= -1.0: tmp = x_m + (y * (x_m * z)) elif y <= 2.8e-8: tmp = x_m - (x_m * z) else: tmp = x_m + (x_m * (z * y)) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(x_m + Float64(y * Float64(x_m * z))); elseif (y <= 2.8e-8) tmp = Float64(x_m - Float64(x_m * z)); else tmp = Float64(x_m + Float64(x_m * Float64(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) tmp = 0.0; if (y <= -1.0) tmp = x_m + (y * (x_m * z)); elseif (y <= 2.8e-8) tmp = x_m - (x_m * z); else tmp = x_m + (x_m * (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_] := N[(x$95$s * If[LessEqual[y, -1.0], N[(x$95$m + N[(y * N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e-8], N[(x$95$m - N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m + N[(x$95$m * N[(z * y), $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 -1:\\
\;\;\;\;x_m + y \cdot \left(x_m \cdot z\right)\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-8}:\\
\;\;\;\;x_m - x_m \cdot z\\
\mathbf{else}:\\
\;\;\;\;x_m + x_m \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if y < -1Initial program 91.7%
Taylor expanded in z around 0 91.8%
Taylor expanded in y around 0 91.7%
+-commutative91.7%
*-commutative91.7%
associate-*r*96.2%
*-commutative96.2%
distribute-lft-in96.2%
*-commutative96.2%
associate-*l*94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in z around 0 91.8%
associate-*r*96.2%
sub-neg96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in y around inf 90.5%
associate-*r*93.1%
*-commutative93.1%
associate-*r*95.0%
Simplified95.0%
if -1 < y < 2.7999999999999999e-8Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 95.7%
+-commutative95.7%
*-commutative95.7%
associate-*r*90.5%
*-commutative90.5%
distribute-lft-in100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
if 2.7999999999999999e-8 < y Initial program 97.0%
Taylor expanded in z around 0 97.1%
Taylor expanded in y around inf 96.1%
*-commutative96.1%
Simplified96.1%
Final simplification97.6%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 1e-25)
(- x_m (* z (* x_m (- 1.0 y))))
(+ x_m (* x_m (* z (+ -1.0 y)))))))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 <= 1e-25) {
tmp = x_m - (z * (x_m * (1.0 - y)));
} else {
tmp = x_m + (x_m * (z * (-1.0 + 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)
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 <= 1d-25) then
tmp = x_m - (z * (x_m * (1.0d0 - y)))
else
tmp = x_m + (x_m * (z * ((-1.0d0) + 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 tmp;
if (x_m <= 1e-25) {
tmp = x_m - (z * (x_m * (1.0 - y)));
} else {
tmp = x_m + (x_m * (z * (-1.0 + 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): tmp = 0 if x_m <= 1e-25: tmp = x_m - (z * (x_m * (1.0 - y))) else: tmp = x_m + (x_m * (z * (-1.0 + y))) 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 <= 1e-25) tmp = Float64(x_m - Float64(z * Float64(x_m * Float64(1.0 - y)))); else tmp = Float64(x_m + Float64(x_m * Float64(z * Float64(-1.0 + 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) tmp = 0.0; if (x_m <= 1e-25) tmp = x_m - (z * (x_m * (1.0 - y))); else tmp = x_m + (x_m * (z * (-1.0 + 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_] := N[(x$95$s * If[LessEqual[x$95$m, 1e-25], N[(x$95$m - N[(z * N[(x$95$m * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m + N[(x$95$m * N[(z * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;x_m \leq 10^{-25}:\\
\;\;\;\;x_m - z \cdot \left(x_m \cdot \left(1 - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x_m + x_m \cdot \left(z \cdot \left(-1 + y\right)\right)\\
\end{array}
\end{array}
if x < 1.00000000000000004e-25Initial program 96.0%
Taylor expanded in z around 0 96.0%
Taylor expanded in y around 0 90.8%
+-commutative90.8%
*-commutative90.8%
associate-*r*89.2%
*-commutative89.2%
distribute-lft-in95.9%
*-commutative95.9%
associate-*l*99.4%
+-commutative99.4%
Simplified99.4%
if 1.00000000000000004e-25 < x Initial program 99.9%
Taylor expanded in z around 0 99.9%
Final simplification99.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= y -2.5e+47) (not (<= y 6.2e+16)))
(* x_m (* z y))
(* x_m (- 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 ((y <= -2.5e+47) || !(y <= 6.2e+16)) {
tmp = x_m * (z * y);
} else {
tmp = x_m * (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 ((y <= (-2.5d+47)) .or. (.not. (y <= 6.2d+16))) then
tmp = x_m * (z * y)
else
tmp = x_m * (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 ((y <= -2.5e+47) || !(y <= 6.2e+16)) {
tmp = x_m * (z * y);
} else {
tmp = x_m * (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 (y <= -2.5e+47) or not (y <= 6.2e+16): tmp = x_m * (z * y) else: tmp = x_m * (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 ((y <= -2.5e+47) || !(y <= 6.2e+16)) tmp = Float64(x_m * Float64(z * y)); else tmp = Float64(x_m * Float64(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 ((y <= -2.5e+47) || ~((y <= 6.2e+16))) tmp = x_m * (z * y); else tmp = x_m * (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[y, -2.5e+47], N[Not[LessEqual[y, 6.2e+16]], $MachinePrecision]], N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - 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.5 \cdot 10^{+47} \lor \neg \left(y \leq 6.2 \cdot 10^{+16}\right):\\
\;\;\;\;x_m \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -2.50000000000000011e47 or 6.2e16 < y Initial program 93.5%
Taylor expanded in y around inf 75.0%
*-commutative75.0%
Simplified75.0%
if -2.50000000000000011e47 < y < 6.2e16Initial program 100.0%
Taylor expanded in y around 0 94.5%
Final simplification85.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -1.8e+44)
(* z (* x_m y))
(if (<= y 1.8e+17) (* x_m (- 1.0 z)) (* x_m (* 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 tmp;
if (y <= -1.8e+44) {
tmp = z * (x_m * y);
} else if (y <= 1.8e+17) {
tmp = x_m * (1.0 - z);
} else {
tmp = x_m * (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)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.8d+44)) then
tmp = z * (x_m * y)
else if (y <= 1.8d+17) then
tmp = x_m * (1.0d0 - z)
else
tmp = x_m * (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 tmp;
if (y <= -1.8e+44) {
tmp = z * (x_m * y);
} else if (y <= 1.8e+17) {
tmp = x_m * (1.0 - z);
} else {
tmp = x_m * (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): tmp = 0 if y <= -1.8e+44: tmp = z * (x_m * y) elif y <= 1.8e+17: tmp = x_m * (1.0 - z) else: tmp = x_m * (z * y) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -1.8e+44) tmp = Float64(z * Float64(x_m * y)); elseif (y <= 1.8e+17) tmp = Float64(x_m * Float64(1.0 - z)); else tmp = Float64(x_m * Float64(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) tmp = 0.0; if (y <= -1.8e+44) tmp = z * (x_m * y); elseif (y <= 1.8e+17) tmp = x_m * (1.0 - z); else tmp = x_m * (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_] := N[(x$95$s * If[LessEqual[y, -1.8e+44], N[(z * N[(x$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+17], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(z * 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}\;y \leq -1.8 \cdot 10^{+44}:\\
\;\;\;\;z \cdot \left(x_m \cdot y\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+17}:\\
\;\;\;\;x_m \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if y < -1.8e44Initial program 89.6%
Taylor expanded in y around inf 71.0%
associate-*r*77.8%
*-commutative77.8%
Simplified77.8%
if -1.8e44 < y < 1.8e17Initial program 100.0%
Taylor expanded in y around 0 94.5%
if 1.8e17 < y Initial program 96.8%
Taylor expanded in y around inf 78.4%
*-commutative78.4%
Simplified78.4%
Final simplification86.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -5.2e+47)
(* z (* x_m y))
(if (<= y 5.4e+16) (- x_m (* x_m z)) (* x_m (* 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 tmp;
if (y <= -5.2e+47) {
tmp = z * (x_m * y);
} else if (y <= 5.4e+16) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m * (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)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.2d+47)) then
tmp = z * (x_m * y)
else if (y <= 5.4d+16) then
tmp = x_m - (x_m * z)
else
tmp = x_m * (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 tmp;
if (y <= -5.2e+47) {
tmp = z * (x_m * y);
} else if (y <= 5.4e+16) {
tmp = x_m - (x_m * z);
} else {
tmp = x_m * (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): tmp = 0 if y <= -5.2e+47: tmp = z * (x_m * y) elif y <= 5.4e+16: tmp = x_m - (x_m * z) else: tmp = x_m * (z * y) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= -5.2e+47) tmp = Float64(z * Float64(x_m * y)); elseif (y <= 5.4e+16) tmp = Float64(x_m - Float64(x_m * z)); else tmp = Float64(x_m * Float64(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) tmp = 0.0; if (y <= -5.2e+47) tmp = z * (x_m * y); elseif (y <= 5.4e+16) tmp = x_m - (x_m * z); else tmp = x_m * (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_] := N[(x$95$s * If[LessEqual[y, -5.2e+47], N[(z * N[(x$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+16], N[(x$95$m - N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(z * 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}\;y \leq -5.2 \cdot 10^{+47}:\\
\;\;\;\;z \cdot \left(x_m \cdot y\right)\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+16}:\\
\;\;\;\;x_m - x_m \cdot z\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if y < -5.20000000000000007e47Initial program 89.6%
Taylor expanded in y around inf 71.0%
associate-*r*77.8%
*-commutative77.8%
Simplified77.8%
if -5.20000000000000007e47 < y < 5.4e16Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 96.3%
+-commutative96.3%
*-commutative96.3%
associate-*r*91.9%
*-commutative91.9%
distribute-lft-in100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 94.5%
neg-mul-194.5%
unsub-neg94.5%
Simplified94.5%
if 5.4e16 < y Initial program 96.8%
Taylor expanded in y around inf 78.4%
*-commutative78.4%
Simplified78.4%
Final simplification86.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -210000000.0) (not (<= z 1.45e-5))) (* 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 <= -210000000.0) || !(z <= 1.45e-5)) {
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 <= (-210000000.0d0)) .or. (.not. (z <= 1.45d-5))) 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 <= -210000000.0) || !(z <= 1.45e-5)) {
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 <= -210000000.0) or not (z <= 1.45e-5): 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 <= -210000000.0) || !(z <= 1.45e-5)) tmp = Float64(x_m * Float64(-z)); 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) tmp = 0.0; if ((z <= -210000000.0) || ~((z <= 1.45e-5))) 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[Or[LessEqual[z, -210000000.0], N[Not[LessEqual[z, 1.45e-5]], $MachinePrecision]], 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 -210000000 \lor \neg \left(z \leq 1.45 \cdot 10^{-5}\right):\\
\;\;\;\;x_m \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x_m\\
\end{array}
\end{array}
if z < -2.1e8 or 1.45e-5 < z Initial program 94.0%
Taylor expanded in z around inf 93.3%
Taylor expanded in y around 0 51.8%
mul-1-neg51.8%
*-commutative51.8%
distribute-rgt-neg-in51.8%
Simplified51.8%
if -2.1e8 < z < 1.45e-5Initial program 99.8%
Taylor expanded in z around 0 66.1%
Final simplification59.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * x_m
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * 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 96.9%
Taylor expanded in z around 0 35.2%
Final simplification35.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))
(t_1 (+ x (* (- 1.0 y) (* (- z) x)))))
(if (< t_0 -1.618195973607049e+50)
t_1
(if (< t_0 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) t_1))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = x * (1.0d0 - ((1.0d0 - y) * z))
t_1 = x + ((1.0d0 - y) * (-z * x))
if (t_0 < (-1.618195973607049d+50)) then
tmp = t_1
else if (t_0 < 3.892237649663903d+134) then
tmp = ((x * y) * z) - ((x * z) - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - ((1.0 - y) * z)) t_1 = x + ((1.0 - y) * (-z * x)) tmp = 0 if t_0 < -1.618195973607049e+50: tmp = t_1 elif t_0 < 3.892237649663903e+134: tmp = ((x * y) * z) - ((x * z) - x) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) t_1 = Float64(x + Float64(Float64(1.0 - y) * Float64(Float64(-z) * x))) tmp = 0.0 if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = Float64(Float64(Float64(x * y) * z) - Float64(Float64(x * z) - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - ((1.0 - y) * z)); t_1 = x + ((1.0 - y) * (-z * x)); tmp = 0.0; if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = ((x * y) * z) - ((x * z) - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * N[((-z) * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$0, -1.618195973607049e+50], t$95$1, If[Less[t$95$0, 3.892237649663903e+134], N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\
\mathbf{if}\;t_0 < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 < 3.892237649663903 \cdot 10^{+134}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2024010
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:herbie-target
(if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))
(* x (- 1.0 (* (- 1.0 y) z))))