
(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) (fma z -6.0 4.0) x))
double code(double x, double y, double z) {
return fma((y - x), fma(z, -6.0, 4.0), x);
}
function code(x, y, z) return fma(Float64(y - x), fma(z, -6.0, 4.0), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(z * -6.0 + 4.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
distribute-rgt-neg-out99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
(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.6%
+-commutative99.6%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.7%
metadata-eval99.7%
metadata-eval99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* x 6.0))) (t_1 (* 6.0 (* y (- 0.6666666666666666 z)))))
(if (<= y -7.5e-83)
t_1
(if (<= y 1.38e-281)
t_0
(if (<= y 8.2e-202)
(* x -3.0)
(if (<= y 4.4e-149) t_0 (if (<= y 2.26e-69) (* x -3.0) t_1)))))))
double code(double x, double y, double z) {
double t_0 = z * (x * 6.0);
double t_1 = 6.0 * (y * (0.6666666666666666 - z));
double tmp;
if (y <= -7.5e-83) {
tmp = t_1;
} else if (y <= 1.38e-281) {
tmp = t_0;
} else if (y <= 8.2e-202) {
tmp = x * -3.0;
} else if (y <= 4.4e-149) {
tmp = t_0;
} else if (y <= 2.26e-69) {
tmp = x * -3.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 = z * (x * 6.0d0)
t_1 = 6.0d0 * (y * (0.6666666666666666d0 - z))
if (y <= (-7.5d-83)) then
tmp = t_1
else if (y <= 1.38d-281) then
tmp = t_0
else if (y <= 8.2d-202) then
tmp = x * (-3.0d0)
else if (y <= 4.4d-149) then
tmp = t_0
else if (y <= 2.26d-69) then
tmp = x * (-3.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (x * 6.0);
double t_1 = 6.0 * (y * (0.6666666666666666 - z));
double tmp;
if (y <= -7.5e-83) {
tmp = t_1;
} else if (y <= 1.38e-281) {
tmp = t_0;
} else if (y <= 8.2e-202) {
tmp = x * -3.0;
} else if (y <= 4.4e-149) {
tmp = t_0;
} else if (y <= 2.26e-69) {
tmp = x * -3.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * 6.0) t_1 = 6.0 * (y * (0.6666666666666666 - z)) tmp = 0 if y <= -7.5e-83: tmp = t_1 elif y <= 1.38e-281: tmp = t_0 elif y <= 8.2e-202: tmp = x * -3.0 elif y <= 4.4e-149: tmp = t_0 elif y <= 2.26e-69: tmp = x * -3.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * 6.0)) t_1 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))) tmp = 0.0 if (y <= -7.5e-83) tmp = t_1; elseif (y <= 1.38e-281) tmp = t_0; elseif (y <= 8.2e-202) tmp = Float64(x * -3.0); elseif (y <= 4.4e-149) tmp = t_0; elseif (y <= 2.26e-69) tmp = Float64(x * -3.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * 6.0); t_1 = 6.0 * (y * (0.6666666666666666 - z)); tmp = 0.0; if (y <= -7.5e-83) tmp = t_1; elseif (y <= 1.38e-281) tmp = t_0; elseif (y <= 8.2e-202) tmp = x * -3.0; elseif (y <= 4.4e-149) tmp = t_0; elseif (y <= 2.26e-69) tmp = x * -3.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.5e-83], t$95$1, If[LessEqual[y, 1.38e-281], t$95$0, If[LessEqual[y, 8.2e-202], N[(x * -3.0), $MachinePrecision], If[LessEqual[y, 4.4e-149], t$95$0, If[LessEqual[y, 2.26e-69], N[(x * -3.0), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot 6\right)\\
t_1 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{-281}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-202}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-149}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.26 \cdot 10^{-69}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.4999999999999997e-83 or 2.2599999999999999e-69 < y Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.5%
fma-define99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 73.4%
if -7.4999999999999997e-83 < y < 1.37999999999999993e-281 or 8.2000000000000008e-202 < y < 4.3999999999999996e-149Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around inf 93.1%
Taylor expanded in z around inf 63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in y around 0 49.3%
*-commutative49.3%
Simplified49.3%
if 1.37999999999999993e-281 < y < 8.2000000000000008e-202 or 4.3999999999999996e-149 < y < 2.2599999999999999e-69Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 90.3%
sub-neg90.3%
distribute-rgt-in90.3%
metadata-eval90.3%
distribute-lft-neg-in90.3%
associate-+r+90.3%
metadata-eval90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in z around 0 70.9%
*-commutative70.9%
Simplified70.9%
(FPCore (x y z)
:precision binary64
(if (<= z -0.0026)
(* z (* y -6.0))
(if (<= z 2.2e-16)
(* x -3.0)
(if (<= z 6e+114) (* 6.0 (* x z)) (* -6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0026) {
tmp = z * (y * -6.0);
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 6e+114) {
tmp = 6.0 * (x * z);
} else {
tmp = -6.0 * (y * z);
}
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.0026d0)) then
tmp = z * (y * (-6.0d0))
else if (z <= 2.2d-16) then
tmp = x * (-3.0d0)
else if (z <= 6d+114) then
tmp = 6.0d0 * (x * z)
else
tmp = (-6.0d0) * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.0026) {
tmp = z * (y * -6.0);
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 6e+114) {
tmp = 6.0 * (x * z);
} else {
tmp = -6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0026: tmp = z * (y * -6.0) elif z <= 2.2e-16: tmp = x * -3.0 elif z <= 6e+114: tmp = 6.0 * (x * z) else: tmp = -6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0026) tmp = Float64(z * Float64(y * -6.0)); elseif (z <= 2.2e-16) tmp = Float64(x * -3.0); elseif (z <= 6e+114) tmp = Float64(6.0 * Float64(x * z)); else tmp = Float64(-6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.0026) tmp = z * (y * -6.0); elseif (z <= 2.2e-16) tmp = x * -3.0; elseif (z <= 6e+114) tmp = 6.0 * (x * z); else tmp = -6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0026], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-16], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6e+114], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0026:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-16}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+114}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.0025999999999999999Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around inf 54.4%
if -0.0025999999999999999 < z < 2.2e-16Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
distribute-lft-neg-in53.8%
associate-+r+53.8%
metadata-eval53.8%
distribute-rgt-neg-in53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in z around 0 53.8%
*-commutative53.8%
Simplified53.8%
if 2.2e-16 < z < 6.0000000000000001e114Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 68.6%
sub-neg68.6%
distribute-rgt-in68.6%
metadata-eval68.6%
distribute-lft-neg-in68.6%
associate-+r+68.6%
metadata-eval68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
Simplified68.6%
Taylor expanded in z around inf 61.7%
if 6.0000000000000001e114 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 75.8%
Final simplification58.0%
(FPCore (x y z)
:precision binary64
(if (<= z -0.45)
(* y (* z -6.0))
(if (<= z 2.2e-16)
(* x -3.0)
(if (<= z 4.8e+114) (* 6.0 (* x z)) (* -6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.45) {
tmp = y * (z * -6.0);
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 4.8e+114) {
tmp = 6.0 * (x * z);
} else {
tmp = -6.0 * (y * z);
}
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.45d0)) then
tmp = y * (z * (-6.0d0))
else if (z <= 2.2d-16) then
tmp = x * (-3.0d0)
else if (z <= 4.8d+114) then
tmp = 6.0d0 * (x * z)
else
tmp = (-6.0d0) * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.45) {
tmp = y * (z * -6.0);
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 4.8e+114) {
tmp = 6.0 * (x * z);
} else {
tmp = -6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.45: tmp = y * (z * -6.0) elif z <= 2.2e-16: tmp = x * -3.0 elif z <= 4.8e+114: tmp = 6.0 * (x * z) else: tmp = -6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.45) tmp = Float64(y * Float64(z * -6.0)); elseif (z <= 2.2e-16) tmp = Float64(x * -3.0); elseif (z <= 4.8e+114) tmp = Float64(6.0 * Float64(x * z)); else tmp = Float64(-6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.45) tmp = y * (z * -6.0); elseif (z <= 2.2e-16) tmp = x * -3.0; elseif (z <= 4.8e+114) tmp = 6.0 * (x * z); else tmp = -6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.45], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-16], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.8e+114], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.45:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-16}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+114}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.450000000000000011Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around inf 54.4%
Taylor expanded in z around 0 54.4%
associate-*r*54.4%
*-commutative54.4%
associate-*r*54.4%
Simplified54.4%
if -0.450000000000000011 < z < 2.2e-16Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
distribute-lft-neg-in53.8%
associate-+r+53.8%
metadata-eval53.8%
distribute-rgt-neg-in53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in z around 0 53.8%
*-commutative53.8%
Simplified53.8%
if 2.2e-16 < z < 4.8e114Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 68.6%
sub-neg68.6%
distribute-rgt-in68.6%
metadata-eval68.6%
distribute-lft-neg-in68.6%
associate-+r+68.6%
metadata-eval68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
Simplified68.6%
Taylor expanded in z around inf 61.7%
if 4.8e114 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 75.8%
Final simplification58.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -0.7)
t_0
(if (<= z 2.2e-16) (* x -3.0) (if (<= z 8e+113) (* 6.0 (* x z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -0.7) {
tmp = t_0;
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 8e+113) {
tmp = 6.0 * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (-6.0d0) * (y * z)
if (z <= (-0.7d0)) then
tmp = t_0
else if (z <= 2.2d-16) then
tmp = x * (-3.0d0)
else if (z <= 8d+113) then
tmp = 6.0d0 * (x * z)
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 <= -0.7) {
tmp = t_0;
} else if (z <= 2.2e-16) {
tmp = x * -3.0;
} else if (z <= 8e+113) {
tmp = 6.0 * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) tmp = 0 if z <= -0.7: tmp = t_0 elif z <= 2.2e-16: tmp = x * -3.0 elif z <= 8e+113: tmp = 6.0 * (x * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) tmp = 0.0 if (z <= -0.7) tmp = t_0; elseif (z <= 2.2e-16) tmp = Float64(x * -3.0); elseif (z <= 8e+113) tmp = Float64(6.0 * Float64(x * z)); 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 <= -0.7) tmp = t_0; elseif (z <= 2.2e-16) tmp = x * -3.0; elseif (z <= 8e+113) tmp = 6.0 * (x * z); 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, -0.7], t$95$0, If[LessEqual[z, 2.2e-16], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 8e+113], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-16}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+113}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.69999999999999996 or 8e113 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in y around inf 62.0%
if -0.69999999999999996 < z < 2.2e-16Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
distribute-lft-neg-in53.8%
associate-+r+53.8%
metadata-eval53.8%
distribute-rgt-neg-in53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in z around 0 53.8%
*-commutative53.8%
Simplified53.8%
if 2.2e-16 < z < 8e113Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 68.6%
sub-neg68.6%
distribute-rgt-in68.6%
metadata-eval68.6%
distribute-lft-neg-in68.6%
associate-+r+68.6%
metadata-eval68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
Simplified68.6%
Taylor expanded in z around inf 61.7%
(FPCore (x y z) :precision binary64 (if (<= z -0.52) (* z (* (- y x) -6.0)) (if (<= z 0.65) (+ x (* (- y x) 4.0)) (+ x (* -6.0 (* (- y x) z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.52) {
tmp = z * ((y - x) * -6.0);
} else if (z <= 0.65) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = x + (-6.0 * ((y - x) * z));
}
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.52d0)) then
tmp = z * ((y - x) * (-6.0d0))
else if (z <= 0.65d0) then
tmp = x + ((y - x) * 4.0d0)
else
tmp = x + ((-6.0d0) * ((y - x) * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.52) {
tmp = z * ((y - x) * -6.0);
} else if (z <= 0.65) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = x + (-6.0 * ((y - x) * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.52: tmp = z * ((y - x) * -6.0) elif z <= 0.65: tmp = x + ((y - x) * 4.0) else: tmp = x + (-6.0 * ((y - x) * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.52) tmp = Float64(z * Float64(Float64(y - x) * -6.0)); elseif (z <= 0.65) tmp = Float64(x + Float64(Float64(y - x) * 4.0)); else tmp = Float64(x + Float64(-6.0 * Float64(Float64(y - x) * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.52) tmp = z * ((y - x) * -6.0); elseif (z <= 0.65) tmp = x + ((y - x) * 4.0); else tmp = x + (-6.0 * ((y - x) * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.52], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.65], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.52:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -0.52000000000000002Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.3%
*-commutative98.3%
Simplified98.3%
if -0.52000000000000002 < z < 0.650000000000000022Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.8%
if 0.650000000000000022 < z Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 97.1%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.56) (not (<= z 0.58))) (* z (* (- y x) -6.0)) (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.56) || !(z <= 0.58)) {
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.56d0)) .or. (.not. (z <= 0.58d0))) 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.56) || !(z <= 0.58)) {
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.56) or not (z <= 0.58): 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.56) || !(z <= 0.58)) 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.56) || ~((z <= 0.58))) 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.56], N[Not[LessEqual[z, 0.58]], $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.56 \lor \neg \left(z \leq 0.58\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.56000000000000005 or 0.57999999999999996 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.7%
*-commutative97.7%
Simplified97.7%
if -0.56000000000000005 < z < 0.57999999999999996Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.8%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.7e-25) (not (<= x 3.9e-23))) (* x (+ -3.0 (* z 6.0))) (* y (+ 4.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e-25) || !(x <= 3.9e-23)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.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 ((x <= (-3.7d-25)) .or. (.not. (x <= 3.9d-23))) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else
tmp = y * (4.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e-25) || !(x <= 3.9e-23)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.7e-25) or not (x <= 3.9e-23): tmp = x * (-3.0 + (z * 6.0)) else: tmp = y * (4.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.7e-25) || !(x <= 3.9e-23)) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = Float64(y * Float64(4.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.7e-25) || ~((x <= 3.9e-23))) tmp = x * (-3.0 + (z * 6.0)); else tmp = y * (4.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.7e-25], N[Not[LessEqual[x, 3.9e-23]], $MachinePrecision]], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-25} \lor \neg \left(x \leq 3.9 \cdot 10^{-23}\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\end{array}
\end{array}
if x < -3.70000000000000009e-25 or 3.9e-23 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 79.1%
sub-neg79.1%
distribute-rgt-in79.1%
metadata-eval79.1%
distribute-lft-neg-in79.1%
associate-+r+79.1%
metadata-eval79.1%
distribute-rgt-neg-in79.1%
metadata-eval79.1%
Simplified79.1%
if -3.70000000000000009e-25 < x < 3.9e-23Initial program 99.6%
+-commutative99.6%
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 79.4%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.1e-25) (not (<= x 1.04e-29))) (* x (+ -3.0 (* z 6.0))) (* 6.0 (* y (- 0.6666666666666666 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.1e-25) || !(x <= 1.04e-29)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = 6.0 * (y * (0.6666666666666666 - z));
}
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 <= (-7.1d-25)) .or. (.not. (x <= 1.04d-29))) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else
tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7.1e-25) || !(x <= 1.04e-29)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = 6.0 * (y * (0.6666666666666666 - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.1e-25) or not (x <= 1.04e-29): tmp = x * (-3.0 + (z * 6.0)) else: tmp = 6.0 * (y * (0.6666666666666666 - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.1e-25) || !(x <= 1.04e-29)) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7.1e-25) || ~((x <= 1.04e-29))) tmp = x * (-3.0 + (z * 6.0)); else tmp = 6.0 * (y * (0.6666666666666666 - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.1e-25], N[Not[LessEqual[x, 1.04e-29]], $MachinePrecision]], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-25} \lor \neg \left(x \leq 1.04 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\end{array}
\end{array}
if x < -7.1000000000000001e-25 or 1.03999999999999995e-29 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 79.1%
sub-neg79.1%
distribute-rgt-in79.1%
metadata-eval79.1%
distribute-lft-neg-in79.1%
associate-+r+79.1%
metadata-eval79.1%
distribute-rgt-neg-in79.1%
metadata-eval79.1%
Simplified79.1%
if -7.1000000000000001e-25 < x < 1.03999999999999995e-29Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
fma-define99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 79.2%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.08) (not (<= z 0.65))) (* -6.0 (* y z)) (* x -3.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 0.65)) {
tmp = -6.0 * (y * z);
} else {
tmp = x * -3.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.08d0)) .or. (.not. (z <= 0.65d0))) then
tmp = (-6.0d0) * (y * z)
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 0.65)) {
tmp = -6.0 * (y * z);
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.08) or not (z <= 0.65): tmp = -6.0 * (y * z) else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.08) || !(z <= 0.65)) tmp = Float64(-6.0 * Float64(y * z)); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.08) || ~((z <= 0.65))) tmp = -6.0 * (y * z); else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.08], N[Not[LessEqual[z, 0.65]], $MachinePrecision]], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.08 \lor \neg \left(z \leq 0.65\right):\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if z < -0.0800000000000000017 or 0.650000000000000022 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in y around inf 56.9%
if -0.0800000000000000017 < z < 0.650000000000000022Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 53.4%
sub-neg53.4%
distribute-rgt-in53.4%
metadata-eval53.4%
distribute-lft-neg-in53.4%
associate-+r+53.4%
metadata-eval53.4%
distribute-rgt-neg-in53.4%
metadata-eval53.4%
Simplified53.4%
Taylor expanded in z around 0 53.4%
*-commutative53.4%
Simplified53.4%
Final simplification55.2%
(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.6%
metadata-eval99.6%
Simplified99.6%
(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.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 52.2%
sub-neg52.2%
distribute-rgt-in52.2%
metadata-eval52.2%
distribute-lft-neg-in52.2%
associate-+r+52.2%
metadata-eval52.2%
distribute-rgt-neg-in52.2%
metadata-eval52.2%
Simplified52.2%
Taylor expanded in z around 0 27.9%
*-commutative27.9%
Simplified27.9%
herbie shell --seed 2024101
(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))))