
(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 14 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 (fma (- y x) (* 6.0 z) x))
double code(double x, double y, double z) {
return fma((y - x), (6.0 * z), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(6.0 * z), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 6 \cdot z, x\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
associate-*l*99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -3.8e-32)
t_0
(if (<= z 6e-75) x (if (<= z 1.15e+220) t_0 (* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3.8e-32) {
tmp = t_0;
} else if (z <= 6e-75) {
tmp = x;
} else if (z <= 1.15e+220) {
tmp = t_0;
} else {
tmp = -6.0 * (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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-3.8d-32)) then
tmp = t_0
else if (z <= 6d-75) then
tmp = x
else if (z <= 1.15d+220) then
tmp = t_0
else
tmp = (-6.0d0) * (x * z)
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 <= -3.8e-32) {
tmp = t_0;
} else if (z <= 6e-75) {
tmp = x;
} else if (z <= 1.15e+220) {
tmp = t_0;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -3.8e-32: tmp = t_0 elif z <= 6e-75: tmp = x elif z <= 1.15e+220: tmp = t_0 else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.8e-32) tmp = t_0; elseif (z <= 6e-75) tmp = x; elseif (z <= 1.15e+220) tmp = t_0; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.8e-32) tmp = t_0; elseif (z <= 6e-75) tmp = x; elseif (z <= 1.15e+220) tmp = t_0; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e-32], t$95$0, If[LessEqual[z, 6e-75], x, If[LessEqual[z, 1.15e+220], t$95$0, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-75}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+220}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -3.80000000000000008e-32 or 5.9999999999999997e-75 < z < 1.14999999999999998e220Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 92.5%
Taylor expanded in y around inf 58.0%
*-commutative58.0%
Simplified58.0%
if -3.80000000000000008e-32 < z < 5.9999999999999997e-75Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 1.14999999999999998e220 < z Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in z around 0 65.1%
Final simplification64.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1.45e-31)
(* 6.0 (* y z))
(if (<= z 1.5e-70)
x
(if (<= z 1.3e+217) (* z (* y 6.0)) (* -6.0 (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.45e-31) {
tmp = 6.0 * (y * z);
} else if (z <= 1.5e-70) {
tmp = x;
} else if (z <= 1.3e+217) {
tmp = z * (y * 6.0);
} else {
tmp = -6.0 * (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 <= (-1.45d-31)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.5d-70) then
tmp = x
else if (z <= 1.3d+217) then
tmp = z * (y * 6.0d0)
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.45e-31) {
tmp = 6.0 * (y * z);
} else if (z <= 1.5e-70) {
tmp = x;
} else if (z <= 1.3e+217) {
tmp = z * (y * 6.0);
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.45e-31: tmp = 6.0 * (y * z) elif z <= 1.5e-70: tmp = x elif z <= 1.3e+217: tmp = z * (y * 6.0) else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.45e-31) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.5e-70) tmp = x; elseif (z <= 1.3e+217) tmp = Float64(z * Float64(y * 6.0)); else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.45e-31) tmp = 6.0 * (y * z); elseif (z <= 1.5e-70) tmp = x; elseif (z <= 1.3e+217) tmp = z * (y * 6.0); else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.45e-31], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-70], x, If[LessEqual[z, 1.3e+217], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-31}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-70}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+217}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -1.45e-31Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.1%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -1.45e-31 < z < 1.5000000000000001e-70Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 1.5000000000000001e-70 < z < 1.30000000000000006e217Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 86.9%
*-commutative86.9%
associate-*l*86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
if 1.30000000000000006e217 < z Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in z around 0 65.1%
Final simplification64.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1.5e-31)
(* 6.0 (* y z))
(if (<= z 2.4e-69)
x
(if (<= z 2.5e+219) (* z (* y 6.0)) (* x (* z -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.5e-31) {
tmp = 6.0 * (y * z);
} else if (z <= 2.4e-69) {
tmp = x;
} else if (z <= 2.5e+219) {
tmp = z * (y * 6.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) :: tmp
if (z <= (-1.5d-31)) then
tmp = 6.0d0 * (y * z)
else if (z <= 2.4d-69) then
tmp = x
else if (z <= 2.5d+219) then
tmp = z * (y * 6.0d0)
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.5e-31) {
tmp = 6.0 * (y * z);
} else if (z <= 2.4e-69) {
tmp = x;
} else if (z <= 2.5e+219) {
tmp = z * (y * 6.0);
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.5e-31: tmp = 6.0 * (y * z) elif z <= 2.4e-69: tmp = x elif z <= 2.5e+219: tmp = z * (y * 6.0) else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.5e-31) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 2.4e-69) tmp = x; elseif (z <= 2.5e+219) tmp = Float64(z * Float64(y * 6.0)); else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.5e-31) tmp = 6.0 * (y * z); elseif (z <= 2.4e-69) tmp = x; elseif (z <= 2.5e+219) tmp = z * (y * 6.0); else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.5e-31], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.4e-69], x, If[LessEqual[z, 2.5e+219], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-31}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+219}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -1.49999999999999991e-31Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.1%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -1.49999999999999991e-31 < z < 2.4000000000000001e-69Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 2.4000000000000001e-69 < z < 2.5e219Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 86.9%
*-commutative86.9%
associate-*l*86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
if 2.5e219 < z Initial program 99.8%
Taylor expanded in x around inf 65.2%
Taylor expanded in z around inf 65.2%
Final simplification64.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.6e-32) (not (<= z 3.15e-21))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e-32) || !(z <= 3.15e-21)) {
tmp = 6.0 * ((y - 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 <= (-3.6d-32)) .or. (.not. (z <= 3.15d-21))) then
tmp = 6.0d0 * ((y - 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 <= -3.6e-32) || !(z <= 3.15e-21)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.6e-32) or not (z <= 3.15e-21): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.6e-32) || !(z <= 3.15e-21)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.6e-32) || ~((z <= 3.15e-21))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.6e-32], N[Not[LessEqual[z, 3.15e-21]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-32} \lor \neg \left(z \leq 3.15 \cdot 10^{-21}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.59999999999999993e-32 or 3.15e-21 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.6%
if -3.59999999999999993e-32 < z < 3.15e-21Initial program 99.9%
Taylor expanded in z around 0 70.2%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.45e-30) (* 6.0 (* (- y x) z)) (if (<= z 5.1e-21) x (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.45e-30) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 5.1e-21) {
tmp = x;
} else {
tmp = z * ((y - x) * 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 (z <= (-1.45d-30)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 5.1d-21) then
tmp = x
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.45e-30) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 5.1e-21) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.45e-30: tmp = 6.0 * ((y - x) * z) elif z <= 5.1e-21: tmp = x else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.45e-30) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 5.1e-21) tmp = x; else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.45e-30) tmp = 6.0 * ((y - x) * z); elseif (z <= 5.1e-21) tmp = x; else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.45e-30], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.1e-21], x, N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-30}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.44999999999999995e-30Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.1%
if -1.44999999999999995e-30 < z < 5.10000000000000004e-21Initial program 99.9%
Taylor expanded in z around 0 70.2%
if 5.10000000000000004e-21 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= z -6e-32) (* 6.0 (* (- y x) z)) (if (<= z 3.6e-21) (* x (+ 1.0 (* z -6.0))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6e-32) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 3.6e-21) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * ((y - x) * 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 (z <= (-6d-32)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 3.6d-21) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6e-32) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 3.6e-21) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6e-32: tmp = 6.0 * ((y - x) * z) elif z <= 3.6e-21: tmp = x * (1.0 + (z * -6.0)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6e-32) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 3.6e-21) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6e-32) tmp = 6.0 * ((y - x) * z); elseif (z <= 3.6e-21) tmp = x * (1.0 + (z * -6.0)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6e-32], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-21], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-32}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -6.0000000000000001e-32Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.1%
if -6.0000000000000001e-32 < z < 3.59999999999999989e-21Initial program 99.9%
Taylor expanded in x around inf 70.2%
if 3.59999999999999989e-21 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* 6.0 (* (- y x) z)) (if (<= z 1.02e-20) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 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 (z <= (-0.17d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.02d-20) then
tmp = x + (6.0d0 * (y * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = 6.0 * ((y - x) * z) elif z <= 1.02e-20: tmp = x + (6.0 * (y * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.02e-20) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.17) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.02e-20) tmp = x + (6.0 * (y * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-20], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-20}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.9%
if -0.170000000000000012 < z < 1.02000000000000001e-20Initial program 99.9%
Taylor expanded in y around inf 99.8%
if 1.02000000000000001e-20 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* 6.0 (* (- y x) z)) (if (<= z 1.02e-20) (+ x (* y (* 6.0 z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * ((y - x) * 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 (z <= (-0.17d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.02d-20) then
tmp = x + (y * (6.0d0 * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = 6.0 * ((y - x) * z) elif z <= 1.02e-20: tmp = x + (y * (6.0 * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.02e-20) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.17) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.02e-20) tmp = x + (y * (6.0 * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-20], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-20}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.9%
if -0.170000000000000012 < z < 1.02000000000000001e-20Initial program 99.9%
associate-*r*99.9%
*-commutative99.9%
flip--55.9%
associate-*r/55.3%
Applied egg-rr55.3%
associate-/l*55.8%
*-commutative55.8%
associate-/l*55.8%
difference-of-squares56.1%
associate-/r*99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around inf 99.8%
*-commutative99.8%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
if 1.02000000000000001e-20 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= z -8.5e-5) (* 6.0 (* (- y x) z)) (if (<= z 1.02e-20) (+ x (* z (* y 6.0))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e-5) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (z * (y * 6.0));
} else {
tmp = z * ((y - x) * 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 (z <= (-8.5d-5)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.02d-20) then
tmp = x + (z * (y * 6.0d0))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e-5) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.02e-20) {
tmp = x + (z * (y * 6.0));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.5e-5: tmp = 6.0 * ((y - x) * z) elif z <= 1.02e-20: tmp = x + (z * (y * 6.0)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.5e-5) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.02e-20) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.5e-5) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.02e-20) tmp = x + (z * (y * 6.0)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.5e-5], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-20], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-20}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -8.500000000000001e-5Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.9%
if -8.500000000000001e-5 < z < 1.02000000000000001e-20Initial program 99.9%
Taylor expanded in y around inf 99.8%
associate-*r*99.9%
Simplified99.9%
if 1.02000000000000001e-20 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.5e-5) (not (<= z 0.21))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5e-5) || !(z <= 0.21)) {
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 <= (-8.5d-5)) .or. (.not. (z <= 0.21d0))) 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 <= -8.5e-5) || !(z <= 0.21)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.5e-5) or not (z <= 0.21): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.5e-5) || !(z <= 0.21)) 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 <= -8.5e-5) || ~((z <= 0.21))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.5e-5], N[Not[LessEqual[z, 0.21]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-5} \lor \neg \left(z \leq 0.21\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.500000000000001e-5 or 0.209999999999999992 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.6%
*-commutative98.6%
associate-*l*98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 48.7%
*-commutative48.7%
Simplified48.7%
Taylor expanded in z around 0 48.7%
if -8.500000000000001e-5 < z < 0.209999999999999992Initial program 99.9%
Taylor expanded in z around 0 65.6%
Final simplification57.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.8%
Final simplification99.8%
(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.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(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.8%
Taylor expanded in z around 0 34.2%
Final simplification34.2%
(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 2023196
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:herbie-target
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))