
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.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 - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.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 - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}
(FPCore (x y z) :precision binary64 (fma (- y x) (+ 4.0 (* z -6.0)) x))
double code(double x, double y, double z) {
return fma((y - x), (4.0 + (z * -6.0)), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(4.0 + Float64(z * -6.0)), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate-*l*99.8%
fma-define99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* -6.0 (* (- y x) z))))
(if (<= z -7.1e-6)
t_1
(if (<= z -2.15e-131)
t_0
(if (<= z 1.06e-127) (* y 4.0) (if (<= z 1150000.0) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x * (-3.0 + (z * 6.0));
double t_1 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_1;
} else if (z <= -2.15e-131) {
tmp = t_0;
} else if (z <= 1.06e-127) {
tmp = y * 4.0;
} else if (z <= 1150000.0) {
tmp = t_0;
} 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 * ((-3.0d0) + (z * 6.0d0))
t_1 = (-6.0d0) * ((y - x) * z)
if (z <= (-7.1d-6)) then
tmp = t_1
else if (z <= (-2.15d-131)) then
tmp = t_0
else if (z <= 1.06d-127) then
tmp = y * 4.0d0
else if (z <= 1150000.0d0) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-3.0 + (z * 6.0));
double t_1 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_1;
} else if (z <= -2.15e-131) {
tmp = t_0;
} else if (z <= 1.06e-127) {
tmp = y * 4.0;
} else if (z <= 1150000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-3.0 + (z * 6.0)) t_1 = -6.0 * ((y - x) * z) tmp = 0 if z <= -7.1e-6: tmp = t_1 elif z <= -2.15e-131: tmp = t_0 elif z <= 1.06e-127: tmp = y * 4.0 elif z <= 1150000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0))) t_1 = Float64(-6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -7.1e-6) tmp = t_1; elseif (z <= -2.15e-131) tmp = t_0; elseif (z <= 1.06e-127) tmp = Float64(y * 4.0); elseif (z <= 1150000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-3.0 + (z * 6.0)); t_1 = -6.0 * ((y - x) * z); tmp = 0.0; if (z <= -7.1e-6) tmp = t_1; elseif (z <= -2.15e-131) tmp = t_0; elseif (z <= 1.06e-127) tmp = y * 4.0; elseif (z <= 1150000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.1e-6], t$95$1, If[LessEqual[z, -2.15e-131], t$95$0, If[LessEqual[z, 1.06e-127], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1150000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -7.1 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-131}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-127}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1150000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0999999999999998e-6 or 1.15e6 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.8%
if -7.0999999999999998e-6 < z < -2.15000000000000009e-131 or 1.06e-127 < z < 1.15e6Initial program 99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around inf 69.3%
sub-neg69.3%
distribute-rgt-in69.3%
metadata-eval69.3%
distribute-lft-neg-in69.3%
associate-+r+69.3%
metadata-eval69.3%
distribute-rgt-neg-in69.3%
metadata-eval69.3%
Simplified69.3%
if -2.15000000000000009e-131 < z < 1.06e-127Initial program 99.4%
+-commutative99.4%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 60.1%
Taylor expanded in z around 0 60.1%
*-commutative60.1%
Simplified60.1%
Final simplification79.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* z -6.0))))
(if (<= z -4.1e-7)
t_0
(if (<= z -1.66e-127)
(* x -3.0)
(if (<= z 0.054) (* y 4.0) (if (<= z 4.5e+127) t_0 (* x (* z 6.0))))))))
double code(double x, double y, double z) {
double t_0 = y * (z * -6.0);
double tmp;
if (z <= -4.1e-7) {
tmp = t_0;
} else if (z <= -1.66e-127) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} else if (z <= 4.5e+127) {
tmp = t_0;
} else {
tmp = x * (z * 6.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 = y * (z * (-6.0d0))
if (z <= (-4.1d-7)) then
tmp = t_0
else if (z <= (-1.66d-127)) then
tmp = x * (-3.0d0)
else if (z <= 0.054d0) then
tmp = y * 4.0d0
else if (z <= 4.5d+127) then
tmp = t_0
else
tmp = x * (z * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (z * -6.0);
double tmp;
if (z <= -4.1e-7) {
tmp = t_0;
} else if (z <= -1.66e-127) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} else if (z <= 4.5e+127) {
tmp = t_0;
} else {
tmp = x * (z * 6.0);
}
return tmp;
}
def code(x, y, z): t_0 = y * (z * -6.0) tmp = 0 if z <= -4.1e-7: tmp = t_0 elif z <= -1.66e-127: tmp = x * -3.0 elif z <= 0.054: tmp = y * 4.0 elif z <= 4.5e+127: tmp = t_0 else: tmp = x * (z * 6.0) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(z * -6.0)) tmp = 0.0 if (z <= -4.1e-7) tmp = t_0; elseif (z <= -1.66e-127) tmp = Float64(x * -3.0); elseif (z <= 0.054) tmp = Float64(y * 4.0); elseif (z <= 4.5e+127) tmp = t_0; else tmp = Float64(x * Float64(z * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (z * -6.0); tmp = 0.0; if (z <= -4.1e-7) tmp = t_0; elseif (z <= -1.66e-127) tmp = x * -3.0; elseif (z <= 0.054) tmp = y * 4.0; elseif (z <= 4.5e+127) tmp = t_0; else tmp = x * (z * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e-7], t$95$0, If[LessEqual[z, -1.66e-127], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.054], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.5e+127], t$95$0, N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.66 \cdot 10^{-127}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.054:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+127}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\end{array}
\end{array}
if z < -4.0999999999999999e-7 or 0.0539999999999999994 < z < 4.50000000000000034e127Initial program 99.7%
+-commutative99.7%
associate-*l*99.8%
fma-define99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 60.5%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
associate-*r*57.6%
Simplified57.6%
if -4.0999999999999999e-7 < z < -1.66000000000000003e-127Initial program 99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around inf 76.9%
sub-neg76.9%
distribute-rgt-in76.9%
metadata-eval76.9%
distribute-lft-neg-in76.9%
associate-+r+77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
metadata-eval77.0%
Simplified77.0%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
Simplified75.2%
if -1.66000000000000003e-127 < z < 0.0539999999999999994Initial program 99.4%
+-commutative99.4%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 57.1%
Taylor expanded in z around 0 56.7%
*-commutative56.7%
Simplified56.7%
if 4.50000000000000034e127 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 58.9%
sub-neg58.9%
distribute-rgt-in58.9%
metadata-eval58.9%
distribute-lft-neg-in58.9%
associate-+r+58.9%
metadata-eval58.9%
distribute-rgt-neg-in58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in z around inf 58.9%
Final simplification59.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -7.1e-6)
t_0
(if (<= z -1.1e-128)
(* x -3.0)
(if (<= z 0.054) (* y 4.0) (if (<= z 4.8e+125) t_0 (* x (* z 6.0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.1e-128) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} else if (z <= 4.8e+125) {
tmp = t_0;
} else {
tmp = x * (z * 6.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 = (-6.0d0) * (y * z)
if (z <= (-7.1d-6)) then
tmp = t_0
else if (z <= (-1.1d-128)) then
tmp = x * (-3.0d0)
else if (z <= 0.054d0) then
tmp = y * 4.0d0
else if (z <= 4.8d+125) then
tmp = t_0
else
tmp = x * (z * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.1e-128) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} else if (z <= 4.8e+125) {
tmp = t_0;
} else {
tmp = x * (z * 6.0);
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) tmp = 0 if z <= -7.1e-6: tmp = t_0 elif z <= -1.1e-128: tmp = x * -3.0 elif z <= 0.054: tmp = y * 4.0 elif z <= 4.8e+125: tmp = t_0 else: tmp = x * (z * 6.0) return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) tmp = 0.0 if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.1e-128) tmp = Float64(x * -3.0); elseif (z <= 0.054) tmp = Float64(y * 4.0); elseif (z <= 4.8e+125) tmp = t_0; else tmp = Float64(x * Float64(z * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (y * z); tmp = 0.0; if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.1e-128) tmp = x * -3.0; elseif (z <= 0.054) tmp = y * 4.0; elseif (z <= 4.8e+125) tmp = t_0; else tmp = x * (z * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.1e-6], t$95$0, If[LessEqual[z, -1.1e-128], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.054], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.8e+125], t$95$0, N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -7.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-128}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.054:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+125}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\end{array}
\end{array}
if z < -7.0999999999999998e-6 or 0.0539999999999999994 < z < 4.7999999999999999e125Initial program 99.7%
+-commutative99.7%
associate-*l*99.8%
fma-define99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 60.5%
Taylor expanded in z around inf 57.5%
if -7.0999999999999998e-6 < z < -1.10000000000000005e-128Initial program 99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around inf 76.9%
sub-neg76.9%
distribute-rgt-in76.9%
metadata-eval76.9%
distribute-lft-neg-in76.9%
associate-+r+77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
metadata-eval77.0%
Simplified77.0%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
Simplified75.2%
if -1.10000000000000005e-128 < z < 0.0539999999999999994Initial program 99.4%
+-commutative99.4%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 57.1%
Taylor expanded in z around 0 56.7%
*-commutative56.7%
Simplified56.7%
if 4.7999999999999999e125 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 58.9%
sub-neg58.9%
distribute-rgt-in58.9%
metadata-eval58.9%
distribute-lft-neg-in58.9%
associate-+r+58.9%
metadata-eval58.9%
distribute-rgt-neg-in58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in z around inf 58.9%
Final simplification59.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -7.1e-6)
t_0
(if (<= z -1.85e-126) (* x -3.0) (if (<= z 0.56) (* y 4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.85e-126) {
tmp = x * -3.0;
} else if (z <= 0.56) {
tmp = y * 4.0;
} 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 = (-6.0d0) * ((y - x) * z)
if (z <= (-7.1d-6)) then
tmp = t_0
else if (z <= (-1.85d-126)) then
tmp = x * (-3.0d0)
else if (z <= 0.56d0) then
tmp = y * 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.85e-126) {
tmp = x * -3.0;
} else if (z <= 0.56) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * ((y - x) * z) tmp = 0 if z <= -7.1e-6: tmp = t_0 elif z <= -1.85e-126: tmp = x * -3.0 elif z <= 0.56: tmp = y * 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.85e-126) tmp = Float64(x * -3.0); elseif (z <= 0.56) tmp = Float64(y * 4.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * ((y - x) * z); tmp = 0.0; if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.85e-126) tmp = x * -3.0; elseif (z <= 0.56) tmp = y * 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.1e-6], t$95$0, If[LessEqual[z, -1.85e-126], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.56], N[(y * 4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -7.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-126}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.56:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.0999999999999998e-6 or 0.56000000000000005 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.2%
if -7.0999999999999998e-6 < z < -1.85e-126Initial program 99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around inf 76.9%
sub-neg76.9%
distribute-rgt-in76.9%
metadata-eval76.9%
distribute-lft-neg-in76.9%
associate-+r+77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
metadata-eval77.0%
Simplified77.0%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
Simplified75.2%
if -1.85e-126 < z < 0.56000000000000005Initial program 99.4%
+-commutative99.4%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 56.5%
Taylor expanded in z around 0 56.1%
*-commutative56.1%
Simplified56.1%
Final simplification77.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -7.1e-6)
t_0
(if (<= z -1.6e-129) (* x -3.0) (if (<= z 0.054) (* y 4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.6e-129) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} 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 = (-6.0d0) * (y * z)
if (z <= (-7.1d-6)) then
tmp = t_0
else if (z <= (-1.6d-129)) then
tmp = x * (-3.0d0)
else if (z <= 0.054d0) then
tmp = y * 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -7.1e-6) {
tmp = t_0;
} else if (z <= -1.6e-129) {
tmp = x * -3.0;
} else if (z <= 0.054) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) tmp = 0 if z <= -7.1e-6: tmp = t_0 elif z <= -1.6e-129: tmp = x * -3.0 elif z <= 0.054: tmp = y * 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) tmp = 0.0 if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.6e-129) tmp = Float64(x * -3.0); elseif (z <= 0.054) tmp = Float64(y * 4.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (y * z); tmp = 0.0; if (z <= -7.1e-6) tmp = t_0; elseif (z <= -1.6e-129) tmp = x * -3.0; elseif (z <= 0.054) tmp = y * 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.1e-6], t$95$0, If[LessEqual[z, -1.6e-129], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.054], N[(y * 4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -7.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.054:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.0999999999999998e-6 or 0.0539999999999999994 < z Initial program 99.7%
+-commutative99.7%
associate-*l*99.7%
fma-define99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 56.5%
Taylor expanded in z around inf 54.1%
if -7.0999999999999998e-6 < z < -1.6000000000000001e-129Initial program 99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around inf 76.9%
sub-neg76.9%
distribute-rgt-in76.9%
metadata-eval76.9%
distribute-lft-neg-in76.9%
associate-+r+77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
metadata-eval77.0%
Simplified77.0%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
Simplified75.2%
if -1.6000000000000001e-129 < z < 0.0539999999999999994Initial program 99.4%
+-commutative99.4%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 57.1%
Taylor expanded in z around 0 56.7%
*-commutative56.7%
Simplified56.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.55) (not (<= z 0.65))) (* z (* (- y x) -6.0)) (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.55) || !(z <= 0.65)) {
tmp = z * ((y - x) * -6.0);
} else {
tmp = x + ((y - x) * 4.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) :: tmp
if ((z <= (-0.55d0)) .or. (.not. (z <= 0.65d0))) then
tmp = z * ((y - x) * (-6.0d0))
else
tmp = x + ((y - x) * 4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.55) || !(z <= 0.65)) {
tmp = z * ((y - x) * -6.0);
} else {
tmp = x + ((y - x) * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.55) or not (z <= 0.65): tmp = z * ((y - x) * -6.0) else: tmp = x + ((y - x) * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.55) || !(z <= 0.65)) tmp = Float64(z * Float64(Float64(y - x) * -6.0)); else tmp = Float64(x + Float64(Float64(y - x) * 4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.55) || ~((z <= 0.65))) tmp = z * ((y - x) * -6.0); else tmp = x + ((y - x) * 4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.55], N[Not[LessEqual[z, 0.65]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.55 \lor \neg \left(z \leq 0.65\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\end{array}
\end{array}
if z < -0.55000000000000004 or 0.650000000000000022 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.2%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
if -0.55000000000000004 < z < 0.650000000000000022Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in z around 0 96.8%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.22e+86) (not (<= y 5.6e-58))) (* y (+ 4.0 (* z -6.0))) (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.22e+86) || !(y <= 5.6e-58)) {
tmp = y * (4.0 + (z * -6.0));
} else {
tmp = x * (-3.0 + (z * 6.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) :: tmp
if ((y <= (-1.22d+86)) .or. (.not. (y <= 5.6d-58))) then
tmp = y * (4.0d0 + (z * (-6.0d0)))
else
tmp = x * ((-3.0d0) + (z * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.22e+86) || !(y <= 5.6e-58)) {
tmp = y * (4.0 + (z * -6.0));
} else {
tmp = x * (-3.0 + (z * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.22e+86) or not (y <= 5.6e-58): tmp = y * (4.0 + (z * -6.0)) else: tmp = x * (-3.0 + (z * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.22e+86) || !(y <= 5.6e-58)) tmp = Float64(y * Float64(4.0 + Float64(z * -6.0))); else tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.22e+86) || ~((y <= 5.6e-58))) tmp = y * (4.0 + (z * -6.0)); else tmp = x * (-3.0 + (z * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.22e+86], N[Not[LessEqual[y, 5.6e-58]], $MachinePrecision]], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+86} \lor \neg \left(y \leq 5.6 \cdot 10^{-58}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\end{array}
\end{array}
if y < -1.21999999999999996e86 or 5.6000000000000001e-58 < y Initial program 99.6%
+-commutative99.6%
associate-*l*99.9%
fma-define99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 80.9%
if -1.21999999999999996e86 < y < 5.6000000000000001e-58Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 76.4%
sub-neg76.4%
distribute-rgt-in76.4%
metadata-eval76.4%
distribute-lft-neg-in76.4%
associate-+r+76.4%
metadata-eval76.4%
distribute-rgt-neg-in76.4%
metadata-eval76.4%
Simplified76.4%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (+ x (+ (* -6.0 (* (- y x) z)) (* (- y x) 4.0))))
double code(double x, double y, double z) {
return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((-6.0d0) * ((y - x) * z)) + ((y - x) * 4.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
}
def code(x, y, z): return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0))
function code(x, y, z) return Float64(x + Float64(Float64(-6.0 * Float64(Float64(y - x) * z)) + Float64(Float64(y - x) * 4.0))) end
function tmp = code(x, y, z) tmp = x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0)); end
code[x_, y_, z_] := N[(x + N[(N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-6 \cdot \left(\left(y - x\right) \cdot z\right) + \left(y - x\right) \cdot 4\right)
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.55e-14) (not (<= x 1.95e+57))) (* x -3.0) (* y 4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.55e-14) || !(x <= 1.95e+57)) {
tmp = x * -3.0;
} else {
tmp = y * 4.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) :: tmp
if ((x <= (-2.55d-14)) .or. (.not. (x <= 1.95d+57))) then
tmp = x * (-3.0d0)
else
tmp = y * 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.55e-14) || !(x <= 1.95e+57)) {
tmp = x * -3.0;
} else {
tmp = y * 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.55e-14) or not (x <= 1.95e+57): tmp = x * -3.0 else: tmp = y * 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.55e-14) || !(x <= 1.95e+57)) tmp = Float64(x * -3.0); else tmp = Float64(y * 4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.55e-14) || ~((x <= 1.95e+57))) tmp = x * -3.0; else tmp = y * 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.55e-14], N[Not[LessEqual[x, 1.95e+57]], $MachinePrecision]], N[(x * -3.0), $MachinePrecision], N[(y * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{-14} \lor \neg \left(x \leq 1.95 \cdot 10^{+57}\right):\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\end{array}
if x < -2.5499999999999999e-14 or 1.94999999999999984e57 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 76.0%
sub-neg76.0%
distribute-rgt-in76.0%
metadata-eval76.0%
distribute-lft-neg-in76.0%
associate-+r+76.0%
metadata-eval76.0%
distribute-rgt-neg-in76.0%
metadata-eval76.0%
Simplified76.0%
Taylor expanded in z around 0 41.6%
*-commutative41.6%
Simplified41.6%
if -2.5499999999999999e-14 < x < 1.94999999999999984e57Initial program 99.5%
+-commutative99.5%
associate-*l*99.8%
fma-define99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 73.6%
Taylor expanded in z around 0 39.9%
*-commutative39.9%
Simplified39.9%
Final simplification40.7%
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- 0.6666666666666666 z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * (0.6666666666666666 - 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 - x) * 6.0d0) * (0.6666666666666666d0 - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * (0.6666666666666666 - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(0.6666666666666666 - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * (0.6666666666666666 - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
(FPCore (x y z) :precision binary64 (* x -3.0))
double code(double x, double y, double z) {
return x * -3.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (-3.0d0)
end function
public static double code(double x, double y, double z) {
return x * -3.0;
}
def code(x, y, z): return x * -3.0
function code(x, y, z) return Float64(x * -3.0) end
function tmp = code(x, y, z) tmp = x * -3.0; end
code[x_, y_, z_] := N[(x * -3.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot -3
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 50.0%
sub-neg50.0%
distribute-rgt-in50.0%
metadata-eval50.0%
distribute-lft-neg-in50.0%
associate-+r+50.0%
metadata-eval50.0%
distribute-rgt-neg-in50.0%
metadata-eval50.0%
Simplified50.0%
Taylor expanded in z around 0 26.7%
*-commutative26.7%
Simplified26.7%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 53.1%
Taylor expanded in x around inf 2.6%
herbie shell --seed 2024135
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
:precision binary64
(+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))