
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.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 * z))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
def code(x, y, z): return x + ((y - x) * (6.0 * z))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * z)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= y -1.5e-39)
t_0
(if (<= y 1.3e-152) (* -6.0 (* x z)) (if (<= y 9500.0) x t_0)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (y <= -1.5e-39) {
tmp = t_0;
} else if (y <= 1.3e-152) {
tmp = -6.0 * (x * z);
} else if (y <= 9500.0) {
tmp = x;
} 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 (y <= (-1.5d-39)) then
tmp = t_0
else if (y <= 1.3d-152) then
tmp = (-6.0d0) * (x * z)
else if (y <= 9500.0d0) then
tmp = x
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 (y <= -1.5e-39) {
tmp = t_0;
} else if (y <= 1.3e-152) {
tmp = -6.0 * (x * z);
} else if (y <= 9500.0) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if y <= -1.5e-39: tmp = t_0 elif y <= 1.3e-152: tmp = -6.0 * (x * z) elif y <= 9500.0: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (y <= -1.5e-39) tmp = t_0; elseif (y <= 1.3e-152) tmp = Float64(-6.0 * Float64(x * z)); elseif (y <= 9500.0) tmp = x; 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 (y <= -1.5e-39) tmp = t_0; elseif (y <= 1.3e-152) tmp = -6.0 * (x * z); elseif (y <= 9500.0) tmp = x; 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[y, -1.5e-39], t$95$0, If[LessEqual[y, 1.3e-152], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9500.0], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{-39}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-152}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;y \leq 9500:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.50000000000000014e-39 or 9500 < y Initial program 99.0%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 68.9%
*-commutative68.9%
Simplified68.9%
if -1.50000000000000014e-39 < y < 1.30000000000000006e-152Initial program 99.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*r*65.1%
Simplified65.1%
Taylor expanded in y around 0 58.9%
if 1.30000000000000006e-152 < y < 9500Initial program 99.9%
Taylor expanded in z around 0 54.6%
Final simplification64.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= y -1.7e-37)
t_0
(if (<= y 1.45e-153) (* x (* z -6.0)) (if (<= y 13200.0) x t_0)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (y <= -1.7e-37) {
tmp = t_0;
} else if (y <= 1.45e-153) {
tmp = x * (z * -6.0);
} else if (y <= 13200.0) {
tmp = x;
} 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 (y <= (-1.7d-37)) then
tmp = t_0
else if (y <= 1.45d-153) then
tmp = x * (z * (-6.0d0))
else if (y <= 13200.0d0) then
tmp = x
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 (y <= -1.7e-37) {
tmp = t_0;
} else if (y <= 1.45e-153) {
tmp = x * (z * -6.0);
} else if (y <= 13200.0) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if y <= -1.7e-37: tmp = t_0 elif y <= 1.45e-153: tmp = x * (z * -6.0) elif y <= 13200.0: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (y <= -1.7e-37) tmp = t_0; elseif (y <= 1.45e-153) tmp = Float64(x * Float64(z * -6.0)); elseif (y <= 13200.0) tmp = x; 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 (y <= -1.7e-37) tmp = t_0; elseif (y <= 1.45e-153) tmp = x * (z * -6.0); elseif (y <= 13200.0) tmp = x; 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[y, -1.7e-37], t$95$0, If[LessEqual[y, 1.45e-153], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 13200.0], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{-37}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-153}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;y \leq 13200:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.70000000000000009e-37 or 13200 < y Initial program 99.0%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 68.9%
*-commutative68.9%
Simplified68.9%
if -1.70000000000000009e-37 < y < 1.45000000000000001e-153Initial program 99.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*r*65.1%
Simplified65.1%
Taylor expanded in y around 0 58.9%
*-commutative58.9%
associate-*r*58.9%
Simplified58.9%
if 1.45000000000000001e-153 < y < 13200Initial program 99.9%
Taylor expanded in z around 0 54.6%
Final simplification64.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* 6.0 z))))
(if (<= y -1.05e-32)
t_0
(if (<= y 3.6e-151) (* x (* z -6.0)) (if (<= y 6200.0) x t_0)))))
double code(double x, double y, double z) {
double t_0 = y * (6.0 * z);
double tmp;
if (y <= -1.05e-32) {
tmp = t_0;
} else if (y <= 3.6e-151) {
tmp = x * (z * -6.0);
} else if (y <= 6200.0) {
tmp = x;
} 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 * (6.0d0 * z)
if (y <= (-1.05d-32)) then
tmp = t_0
else if (y <= 3.6d-151) then
tmp = x * (z * (-6.0d0))
else if (y <= 6200.0d0) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (6.0 * z);
double tmp;
if (y <= -1.05e-32) {
tmp = t_0;
} else if (y <= 3.6e-151) {
tmp = x * (z * -6.0);
} else if (y <= 6200.0) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (6.0 * z) tmp = 0 if y <= -1.05e-32: tmp = t_0 elif y <= 3.6e-151: tmp = x * (z * -6.0) elif y <= 6200.0: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(6.0 * z)) tmp = 0.0 if (y <= -1.05e-32) tmp = t_0; elseif (y <= 3.6e-151) tmp = Float64(x * Float64(z * -6.0)); elseif (y <= 6200.0) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (6.0 * z); tmp = 0.0; if (y <= -1.05e-32) tmp = t_0; elseif (y <= 3.6e-151) tmp = x * (z * -6.0); elseif (y <= 6200.0) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e-32], t$95$0, If[LessEqual[y, 3.6e-151], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6200.0], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(6 \cdot z\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{-32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-151}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;y \leq 6200:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.05e-32 or 6200 < y Initial program 99.0%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in z around inf 68.9%
*-commutative68.9%
associate-*r*68.9%
*-commutative68.9%
Simplified68.9%
if -1.05e-32 < y < 3.60000000000000032e-151Initial program 99.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*r*65.1%
Simplified65.1%
Taylor expanded in y around 0 58.9%
*-commutative58.9%
associate-*r*58.9%
Simplified58.9%
if 3.60000000000000032e-151 < y < 6200Initial program 99.9%
Taylor expanded in z around 0 54.6%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e-115) (not (<= z 2.06e-81))) (* -6.0 (* z (- x y))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-115) || !(z <= 2.06e-81)) {
tmp = -6.0 * (z * (x - y));
} else {
tmp = x;
}
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 <= (-1.7d-115)) .or. (.not. (z <= 2.06d-81))) then
tmp = (-6.0d0) * (z * (x - y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-115) || !(z <= 2.06e-81)) {
tmp = -6.0 * (z * (x - y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-115) or not (z <= 2.06e-81): tmp = -6.0 * (z * (x - y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-115) || !(z <= 2.06e-81)) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-115) || ~((z <= 2.06e-81))) tmp = -6.0 * (z * (x - y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-115], N[Not[LessEqual[z, 2.06e-81]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-115} \lor \neg \left(z \leq 2.06 \cdot 10^{-81}\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.6999999999999999e-115 or 2.0600000000000001e-81 < z Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
fma-define99.7%
remove-double-neg99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 91.8%
if -1.6999999999999999e-115 < z < 2.0600000000000001e-81Initial program 98.7%
Taylor expanded in z around 0 76.7%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -4.9e-117) (* -6.0 (* z (- x y))) (if (<= z 1.06e-81) x (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.9e-117) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 1.06e-81) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * 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 <= (-4.9d-117)) then
tmp = (-6.0d0) * (z * (x - y))
else if (z <= 1.06d-81) then
tmp = x
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.9e-117) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 1.06e-81) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.9e-117: tmp = -6.0 * (z * (x - y)) elif z <= 1.06e-81: tmp = x else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.9e-117) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); elseif (z <= 1.06e-81) tmp = x; else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.9e-117) tmp = -6.0 * (z * (x - y)); elseif (z <= 1.06e-81) tmp = x; else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.9e-117], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e-81], x, N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{-117}:\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -4.8999999999999998e-117Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
fma-define99.7%
remove-double-neg99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 91.3%
if -4.8999999999999998e-117 < z < 1.05999999999999991e-81Initial program 98.7%
Taylor expanded in z around 0 76.7%
if 1.05999999999999991e-81 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 92.3%
*-commutative92.3%
*-commutative92.3%
associate-*r*92.4%
Simplified92.4%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -5.5e-115) (* -6.0 (* z (- x y))) (if (<= z 9e-8) (+ x (* -6.0 (* x z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e-115) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 9e-8) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = (y - x) * (6.0 * 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 <= (-5.5d-115)) then
tmp = (-6.0d0) * (z * (x - y))
else if (z <= 9d-8) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e-115) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 9e-8) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e-115: tmp = -6.0 * (z * (x - y)) elif z <= 9e-8: tmp = x + (-6.0 * (x * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e-115) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); elseif (z <= 9e-8) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e-115) tmp = -6.0 * (z * (x - y)); elseif (z <= 9e-8) tmp = x + (-6.0 * (x * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e-115], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-8], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-115}:\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-8}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -5.50000000000000028e-115Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
fma-define99.7%
remove-double-neg99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 91.3%
if -5.50000000000000028e-115 < z < 8.99999999999999986e-8Initial program 98.9%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 73.0%
if 8.99999999999999986e-8 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
Simplified99.7%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (<= z -430000.0) (* -6.0 (* z (- x y))) (if (<= z 0.0135) (+ x (* 6.0 (* y z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -430000.0) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 0.0135) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * 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 <= (-430000.0d0)) then
tmp = (-6.0d0) * (z * (x - y))
else if (z <= 0.0135d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -430000.0) {
tmp = -6.0 * (z * (x - y));
} else if (z <= 0.0135) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -430000.0: tmp = -6.0 * (z * (x - y)) elif z <= 0.0135: tmp = x + (6.0 * (y * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -430000.0) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); elseif (z <= 0.0135) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -430000.0) tmp = -6.0 * (z * (x - y)); elseif (z <= 0.0135) tmp = x + (6.0 * (y * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -430000.0], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0135], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -430000:\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;z \leq 0.0135:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -4.3e5Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
fma-define99.7%
remove-double-neg99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 99.2%
if -4.3e5 < z < 0.0134999999999999998Initial program 99.0%
Taylor expanded in y around inf 99.5%
*-commutative99.5%
Simplified99.5%
if 0.0134999999999999998 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
Simplified99.7%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.0135))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.0135)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
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.165d0)) .or. (.not. (z <= 0.0135d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.0135)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.0135): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.0135)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 0.0135))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.0135]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.0135\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.0134999999999999998 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.5%
Simplified99.5%
Taylor expanded in y around 0 50.8%
if -0.165000000000000008 < z < 0.0134999999999999998Initial program 99.0%
Taylor expanded in z around 0 67.5%
Final simplification58.2%
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 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 + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.4%
Final simplification99.4%
(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.4%
Taylor expanded in z around 0 31.6%
Final simplification31.6%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
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 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2024075
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))