
(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 12 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 (+ x (* (- y x) (+ 4.0 (* z -6.0)))))
double code(double x, double y, double z) {
return x + ((y - x) * (4.0 + (z * -6.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 + ((y - x) * (4.0d0 + (z * (-6.0d0))))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (4.0 + (z * -6.0)));
}
def code(x, y, z): return x + ((y - x) * (4.0 + (z * -6.0)))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(4.0 + Float64(z * -6.0)))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (4.0 + (z * -6.0))); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(4 + z \cdot -6\right)
\end{array}
Initial program 99.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* x 6.0))))
(if (<= z -0.5)
t_0
(if (<= z -3.2e-297) (* x -3.0) (if (<= z 0.65) (* y 4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (x * 6.0);
double tmp;
if (z <= -0.5) {
tmp = t_0;
} else if (z <= -3.2e-297) {
tmp = x * -3.0;
} else if (z <= 0.65) {
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 = z * (x * 6.0d0)
if (z <= (-0.5d0)) then
tmp = t_0
else if (z <= (-3.2d-297)) then
tmp = x * (-3.0d0)
else if (z <= 0.65d0) 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 = z * (x * 6.0);
double tmp;
if (z <= -0.5) {
tmp = t_0;
} else if (z <= -3.2e-297) {
tmp = x * -3.0;
} else if (z <= 0.65) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * 6.0) tmp = 0 if z <= -0.5: tmp = t_0 elif z <= -3.2e-297: tmp = x * -3.0 elif z <= 0.65: tmp = y * 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * 6.0)) tmp = 0.0 if (z <= -0.5) tmp = t_0; elseif (z <= -3.2e-297) tmp = Float64(x * -3.0); elseif (z <= 0.65) tmp = Float64(y * 4.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * 6.0); tmp = 0.0; if (z <= -0.5) tmp = t_0; elseif (z <= -3.2e-297) tmp = x * -3.0; elseif (z <= 0.65) tmp = y * 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.5], t$95$0, If[LessEqual[z, -3.2e-297], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot 6\right)\\
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-297}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.5 or 0.650000000000000022 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
Simplified99.8%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6456.4%
Simplified56.4%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f6456.3%
Simplified56.3%
if -0.5 < z < -3.19999999999999972e-297Initial program 99.3%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0
Simplified96.1%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6465.1%
Simplified65.1%
if -3.19999999999999972e-297 < z < 0.650000000000000022Initial program 99.5%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6460.7%
Simplified60.7%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6458.5%
Simplified58.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z 6.0))))
(if (<= z -0.5)
t_0
(if (<= z -4.2e-297) (* x -3.0) (if (<= z 0.52) (* y 4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (z * 6.0);
double tmp;
if (z <= -0.5) {
tmp = t_0;
} else if (z <= -4.2e-297) {
tmp = x * -3.0;
} else if (z <= 0.52) {
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 = x * (z * 6.0d0)
if (z <= (-0.5d0)) then
tmp = t_0
else if (z <= (-4.2d-297)) then
tmp = x * (-3.0d0)
else if (z <= 0.52d0) 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 = x * (z * 6.0);
double tmp;
if (z <= -0.5) {
tmp = t_0;
} else if (z <= -4.2e-297) {
tmp = x * -3.0;
} else if (z <= 0.52) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * 6.0) tmp = 0 if z <= -0.5: tmp = t_0 elif z <= -4.2e-297: tmp = x * -3.0 elif z <= 0.52: tmp = y * 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * 6.0)) tmp = 0.0 if (z <= -0.5) tmp = t_0; elseif (z <= -4.2e-297) tmp = Float64(x * -3.0); elseif (z <= 0.52) tmp = Float64(y * 4.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * 6.0); tmp = 0.0; if (z <= -0.5) tmp = t_0; elseif (z <= -4.2e-297) tmp = x * -3.0; elseif (z <= 0.52) tmp = y * 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.5], t$95$0, If[LessEqual[z, -4.2e-297], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.52], N[(y * 4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-297}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.52:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.5 or 0.52000000000000002 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
Simplified99.8%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6456.4%
Simplified56.4%
Taylor expanded in z around inf
metadata-evalN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
*-lowering-*.f6456.2%
Simplified56.2%
if -0.5 < z < -4.20000000000000027e-297Initial program 99.3%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0
Simplified96.1%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6465.1%
Simplified65.1%
if -4.20000000000000027e-297 < z < 0.52000000000000002Initial program 99.5%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6460.7%
Simplified60.7%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6458.5%
Simplified58.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* (- y x) -6.0)))) (if (<= z -0.58) t_0 (if (<= z 0.64) (+ (* y 4.0) (* x -3.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * ((y - x) * -6.0);
double tmp;
if (z <= -0.58) {
tmp = t_0;
} else if (z <= 0.64) {
tmp = (y * 4.0) + (x * -3.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 = z * ((y - x) * (-6.0d0))
if (z <= (-0.58d0)) then
tmp = t_0
else if (z <= 0.64d0) then
tmp = (y * 4.0d0) + (x * (-3.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((y - x) * -6.0);
double tmp;
if (z <= -0.58) {
tmp = t_0;
} else if (z <= 0.64) {
tmp = (y * 4.0) + (x * -3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * ((y - x) * -6.0) tmp = 0 if z <= -0.58: tmp = t_0 elif z <= 0.64: tmp = (y * 4.0) + (x * -3.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(y - x) * -6.0)) tmp = 0.0 if (z <= -0.58) tmp = t_0; elseif (z <= 0.64) tmp = Float64(Float64(y * 4.0) + Float64(x * -3.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((y - x) * -6.0); tmp = 0.0; if (z <= -0.58) tmp = t_0; elseif (z <= 0.64) tmp = (y * 4.0) + (x * -3.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.58], t$95$0, If[LessEqual[z, 0.64], N[(N[(y * 4.0), $MachinePrecision] + N[(x * -3.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.64:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.57999999999999996 or 0.640000000000000013 < z Initial program 99.8%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.3%
Simplified99.3%
if -0.57999999999999996 < z < 0.640000000000000013Initial program 99.4%
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0
+-commutativeN/A
sub-negN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6495.8%
Simplified95.8%
Final simplification97.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* (- y x) -6.0)))) (if (<= z -0.58) t_0 (if (<= z 0.5) (+ x (* (- y x) 4.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * ((y - x) * -6.0);
double tmp;
if (z <= -0.58) {
tmp = t_0;
} else if (z <= 0.5) {
tmp = x + ((y - x) * 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 = z * ((y - x) * (-6.0d0))
if (z <= (-0.58d0)) then
tmp = t_0
else if (z <= 0.5d0) then
tmp = x + ((y - x) * 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 = z * ((y - x) * -6.0);
double tmp;
if (z <= -0.58) {
tmp = t_0;
} else if (z <= 0.5) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * ((y - x) * -6.0) tmp = 0 if z <= -0.58: tmp = t_0 elif z <= 0.5: tmp = x + ((y - x) * 4.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(y - x) * -6.0)) tmp = 0.0 if (z <= -0.58) tmp = t_0; elseif (z <= 0.5) tmp = Float64(x + Float64(Float64(y - x) * 4.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((y - x) * -6.0); tmp = 0.0; if (z <= -0.58) tmp = t_0; elseif (z <= 0.5) tmp = x + ((y - x) * 4.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.58], t$95$0, If[LessEqual[z, 0.5], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.57999999999999996 or 0.5 < z Initial program 99.8%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.3%
Simplified99.3%
if -0.57999999999999996 < z < 0.5Initial program 99.4%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0
Simplified95.8%
Final simplification97.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (+ 4.0 (* z -6.0))))) (if (<= y -6.5e+51) t_0 (if (<= y 2.1e+58) (* x (+ -3.0 (* z 6.0))) t_0))))
double code(double x, double y, double z) {
double t_0 = y * (4.0 + (z * -6.0));
double tmp;
if (y <= -6.5e+51) {
tmp = t_0;
} else if (y <= 2.1e+58) {
tmp = x * (-3.0 + (z * 6.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 = y * (4.0d0 + (z * (-6.0d0)))
if (y <= (-6.5d+51)) then
tmp = t_0
else if (y <= 2.1d+58) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (4.0 + (z * -6.0));
double tmp;
if (y <= -6.5e+51) {
tmp = t_0;
} else if (y <= 2.1e+58) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (4.0 + (z * -6.0)) tmp = 0 if y <= -6.5e+51: tmp = t_0 elif y <= 2.1e+58: tmp = x * (-3.0 + (z * 6.0)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(4.0 + Float64(z * -6.0))) tmp = 0.0 if (y <= -6.5e+51) tmp = t_0; elseif (y <= 2.1e+58) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (4.0 + (z * -6.0)); tmp = 0.0; if (y <= -6.5e+51) tmp = t_0; elseif (y <= 2.1e+58) tmp = x * (-3.0 + (z * 6.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+51], t$95$0, If[LessEqual[y, 2.1e+58], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(4 + z \cdot -6\right)\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+58}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.5e51 or 2.10000000000000012e58 < y Initial program 99.6%
Taylor expanded in y around inf
Simplified91.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.1%
Simplified84.1%
if -6.5e51 < y < 2.10000000000000012e58Initial program 99.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
associate-+l+N/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval75.1%
Simplified75.1%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))) (if (<= y -6.4e+51) t_0 (if (<= y 2.2e+59) (* x (+ -3.0 (* z 6.0))) t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * (0.6666666666666666 - z));
double tmp;
if (y <= -6.4e+51) {
tmp = t_0;
} else if (y <= 2.2e+59) {
tmp = x * (-3.0 + (z * 6.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 * (0.6666666666666666d0 - z))
if (y <= (-6.4d+51)) then
tmp = t_0
else if (y <= 2.2d+59) then
tmp = x * ((-3.0d0) + (z * 6.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 * (0.6666666666666666 - z));
double tmp;
if (y <= -6.4e+51) {
tmp = t_0;
} else if (y <= 2.2e+59) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * (0.6666666666666666 - z)) tmp = 0 if y <= -6.4e+51: tmp = t_0 elif y <= 2.2e+59: tmp = x * (-3.0 + (z * 6.0)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))) tmp = 0.0 if (y <= -6.4e+51) tmp = t_0; elseif (y <= 2.2e+59) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * (0.6666666666666666 - z)); tmp = 0.0; if (y <= -6.4e+51) tmp = t_0; elseif (y <= 2.2e+59) tmp = x * (-3.0 + (z * 6.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.4e+51], t$95$0, If[LessEqual[y, 2.2e+59], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{if}\;y \leq -6.4 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.4000000000000005e51 or 2.2e59 < y Initial program 99.6%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6483.9%
Simplified83.9%
if -6.4000000000000005e51 < y < 2.2e59Initial program 99.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
associate-+l+N/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval75.1%
Simplified75.1%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (if (<= x -2.6e+145) (* x -3.0) (if (<= x 1.06e-36) (* 6.0 (* y (- 0.6666666666666666 z))) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.6e+145) {
tmp = x * -3.0;
} else if (x <= 1.06e-36) {
tmp = 6.0 * (y * (0.6666666666666666 - 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 (x <= (-2.6d+145)) then
tmp = x * (-3.0d0)
else if (x <= 1.06d-36) then
tmp = 6.0d0 * (y * (0.6666666666666666d0 - 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 (x <= -2.6e+145) {
tmp = x * -3.0;
} else if (x <= 1.06e-36) {
tmp = 6.0 * (y * (0.6666666666666666 - z));
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.6e+145: tmp = x * -3.0 elif x <= 1.06e-36: tmp = 6.0 * (y * (0.6666666666666666 - z)) else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.6e+145) tmp = Float64(x * -3.0); elseif (x <= 1.06e-36) tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.6e+145) tmp = x * -3.0; elseif (x <= 1.06e-36) tmp = 6.0 * (y * (0.6666666666666666 - z)); else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.6e+145], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 1.06e-36], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+145}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-36}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if x < -2.60000000000000003e145 or 1.05999999999999999e-36 < x Initial program 99.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0
Simplified56.5%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6451.3%
Simplified51.3%
if -2.60000000000000003e145 < x < 1.05999999999999999e-36Initial program 99.6%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6470.0%
Simplified70.0%
(FPCore (x y z) :precision binary64 (if (<= x -6e+136) (* x -3.0) (if (<= x 5.5e-41) (* y 4.0) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e+136) {
tmp = x * -3.0;
} else if (x <= 5.5e-41) {
tmp = y * 4.0;
} 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 (x <= (-6d+136)) then
tmp = x * (-3.0d0)
else if (x <= 5.5d-41) then
tmp = y * 4.0d0
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6e+136) {
tmp = x * -3.0;
} else if (x <= 5.5e-41) {
tmp = y * 4.0;
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e+136: tmp = x * -3.0 elif x <= 5.5e-41: tmp = y * 4.0 else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e+136) tmp = Float64(x * -3.0); elseif (x <= 5.5e-41) tmp = Float64(y * 4.0); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e+136) tmp = x * -3.0; elseif (x <= 5.5e-41) tmp = y * 4.0; else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e+136], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 5.5e-41], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+136}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-41}:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if x < -5.99999999999999958e136 or 5.50000000000000022e-41 < x Initial program 99.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0
Simplified54.0%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6449.1%
Simplified49.1%
if -5.99999999999999958e136 < x < 5.50000000000000022e-41Initial program 99.6%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6471.5%
Simplified71.5%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6443.2%
Simplified43.2%
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) (- 0.6666666666666666 z)) 6.0)))
double code(double x, double y, double z) {
return x + (((y - x) * (0.6666666666666666 - z)) * 6.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 + (((y - x) * (0.6666666666666666d0 - z)) * 6.0d0)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * (0.6666666666666666 - z)) * 6.0);
}
def code(x, y, z): return x + (((y - x) * (0.6666666666666666 - z)) * 6.0)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * Float64(0.6666666666666666 - z)) * 6.0)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * (0.6666666666666666 - z)) * 6.0); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot 6
\end{array}
Initial program 99.6%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
--lowering--.f6499.5%
Applied egg-rr99.5%
Final simplification99.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.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0
Simplified54.1%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6429.3%
Simplified29.3%
(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.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0
Simplified54.1%
Taylor expanded in y around inf
Simplified26.4%
Taylor expanded in x around inf
Simplified2.5%
herbie shell --seed 2024140
(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))))