
(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 12 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 (* (+ (* x -6.0) (* 6.0 y)) z)))
double code(double x, double y, double z) {
return x + (((x * -6.0) + (6.0 * y)) * 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 + (((x * (-6.0d0)) + (6.0d0 * y)) * z)
end function
public static double code(double x, double y, double z) {
return x + (((x * -6.0) + (6.0 * y)) * z);
}
def code(x, y, z): return x + (((x * -6.0) + (6.0 * y)) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(x * -6.0) + Float64(6.0 * y)) * z)) end
function tmp = code(x, y, z) tmp = x + (((x * -6.0) + (6.0 * y)) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(x * -6.0), $MachinePrecision] + N[(6.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(x \cdot -6 + 6 \cdot y\right) \cdot z
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.3e-18)
(and (not (<= z -3.1e-83)) (or (<= z -1.25e-177) (not (<= z 3e-36)))))
(* 6.0 (* z (- y x)))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e-18) || (!(z <= -3.1e-83) && ((z <= -1.25e-177) || !(z <= 3e-36)))) {
tmp = 6.0 * (z * (y - x));
} 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.3d-18)) .or. (.not. (z <= (-3.1d-83))) .and. (z <= (-1.25d-177)) .or. (.not. (z <= 3d-36))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e-18) || (!(z <= -3.1e-83) && ((z <= -1.25e-177) || !(z <= 3e-36)))) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e-18) or (not (z <= -3.1e-83) and ((z <= -1.25e-177) or not (z <= 3e-36))): tmp = 6.0 * (z * (y - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e-18) || (!(z <= -3.1e-83) && ((z <= -1.25e-177) || !(z <= 3e-36)))) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.3e-18) || (~((z <= -3.1e-83)) && ((z <= -1.25e-177) || ~((z <= 3e-36))))) tmp = 6.0 * (z * (y - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e-18], And[N[Not[LessEqual[z, -3.1e-83]], $MachinePrecision], Or[LessEqual[z, -1.25e-177], N[Not[LessEqual[z, 3e-36]], $MachinePrecision]]]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-18} \lor \neg \left(z \leq -3.1 \cdot 10^{-83}\right) \land \left(z \leq -1.25 \cdot 10^{-177} \lor \neg \left(z \leq 3 \cdot 10^{-36}\right)\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.3e-18 or -3.09999999999999992e-83 < z < -1.25e-177 or 3.0000000000000002e-36 < z Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 91.8%
if -1.3e-18 < z < -3.09999999999999992e-83 or -1.25e-177 < z < 3.0000000000000002e-36Initial program 99.9%
Taylor expanded in z around 0 81.9%
Final simplification88.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= z -2.8e-17)
t_0
(if (<= z 1.3e-37)
x
(if (or (<= z 8.5e+101) (not (<= z 4.1e+247))) (* 6.0 (* y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -2.8e-17) {
tmp = t_0;
} else if (z <= 1.3e-37) {
tmp = x;
} else if ((z <= 8.5e+101) || !(z <= 4.1e+247)) {
tmp = 6.0 * (y * 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) * (x * z)
if (z <= (-2.8d-17)) then
tmp = t_0
else if (z <= 1.3d-37) then
tmp = x
else if ((z <= 8.5d+101) .or. (.not. (z <= 4.1d+247))) then
tmp = 6.0d0 * (y * 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 * (x * z);
double tmp;
if (z <= -2.8e-17) {
tmp = t_0;
} else if (z <= 1.3e-37) {
tmp = x;
} else if ((z <= 8.5e+101) || !(z <= 4.1e+247)) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if z <= -2.8e-17: tmp = t_0 elif z <= 1.3e-37: tmp = x elif (z <= 8.5e+101) or not (z <= 4.1e+247): tmp = 6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -2.8e-17) tmp = t_0; elseif (z <= 1.3e-37) tmp = x; elseif ((z <= 8.5e+101) || !(z <= 4.1e+247)) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (z <= -2.8e-17) tmp = t_0; elseif (z <= 1.3e-37) tmp = x; elseif ((z <= 8.5e+101) || ~((z <= 4.1e+247))) tmp = 6.0 * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e-17], t$95$0, If[LessEqual[z, 1.3e-37], x, If[Or[LessEqual[z, 8.5e+101], N[Not[LessEqual[z, 4.1e+247]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-37}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+101} \lor \neg \left(z \leq 4.1 \cdot 10^{+247}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.7999999999999999e-17 or 8.5000000000000001e101 < z < 4.1000000000000002e247Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 98.7%
Taylor expanded in y around 0 57.3%
if -2.7999999999999999e-17 < z < 1.2999999999999999e-37Initial program 99.9%
Taylor expanded in z around 0 73.4%
if 1.2999999999999999e-37 < z < 8.5000000000000001e101 or 4.1000000000000002e247 < z Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 92.5%
Taylor expanded in y around inf 75.0%
*-commutative75.0%
Simplified75.0%
Final simplification68.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= z -2.8e-17)
t_0
(if (<= z 2.5e-39)
x
(if (<= z 2.15e+102)
(* 6.0 (* y z))
(if (<= z 2.15e+245) t_0 (* y (* 6.0 z))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -2.8e-17) {
tmp = t_0;
} else if (z <= 2.5e-39) {
tmp = x;
} else if (z <= 2.15e+102) {
tmp = 6.0 * (y * z);
} else if (z <= 2.15e+245) {
tmp = t_0;
} else {
tmp = y * (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) :: t_0
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
if (z <= (-2.8d-17)) then
tmp = t_0
else if (z <= 2.5d-39) then
tmp = x
else if (z <= 2.15d+102) then
tmp = 6.0d0 * (y * z)
else if (z <= 2.15d+245) then
tmp = t_0
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -2.8e-17) {
tmp = t_0;
} else if (z <= 2.5e-39) {
tmp = x;
} else if (z <= 2.15e+102) {
tmp = 6.0 * (y * z);
} else if (z <= 2.15e+245) {
tmp = t_0;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if z <= -2.8e-17: tmp = t_0 elif z <= 2.5e-39: tmp = x elif z <= 2.15e+102: tmp = 6.0 * (y * z) elif z <= 2.15e+245: tmp = t_0 else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -2.8e-17) tmp = t_0; elseif (z <= 2.5e-39) tmp = x; elseif (z <= 2.15e+102) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 2.15e+245) tmp = t_0; else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (z <= -2.8e-17) tmp = t_0; elseif (z <= 2.5e-39) tmp = x; elseif (z <= 2.15e+102) tmp = 6.0 * (y * z); elseif (z <= 2.15e+245) tmp = t_0; else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e-17], t$95$0, If[LessEqual[z, 2.5e-39], x, If[LessEqual[z, 2.15e+102], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+245], t$95$0, N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+102}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+245}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -2.7999999999999999e-17 or 2.15e102 < z < 2.1499999999999999e245Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 98.7%
Taylor expanded in y around 0 57.3%
if -2.7999999999999999e-17 < z < 2.4999999999999999e-39Initial program 99.9%
Taylor expanded in z around 0 73.4%
if 2.4999999999999999e-39 < z < 2.15e102Initial program 99.6%
Taylor expanded in z around 0 99.5%
Taylor expanded in z around inf 88.9%
Taylor expanded in y around inf 80.7%
*-commutative80.7%
Simplified80.7%
if 2.1499999999999999e245 < z Initial program 99.9%
Taylor expanded in y around inf 62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in y around inf 62.6%
fma-define62.6%
Simplified62.6%
Taylor expanded in z around inf 63.7%
*-commutative63.7%
Simplified63.7%
Final simplification68.1%
(FPCore (x y z)
:precision binary64
(if (<= z -2.8e-17)
(* -6.0 (* x z))
(if (<= z 1.12e-38)
x
(if (<= z 4.8e+101)
(* 6.0 (* y z))
(if (<= z 3.2e+244) (* (* x -6.0) z) (* y (* 6.0 z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e-17) {
tmp = -6.0 * (x * z);
} else if (z <= 1.12e-38) {
tmp = x;
} else if (z <= 4.8e+101) {
tmp = 6.0 * (y * z);
} else if (z <= 3.2e+244) {
tmp = (x * -6.0) * z;
} else {
tmp = y * (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 <= (-2.8d-17)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 1.12d-38) then
tmp = x
else if (z <= 4.8d+101) then
tmp = 6.0d0 * (y * z)
else if (z <= 3.2d+244) then
tmp = (x * (-6.0d0)) * z
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e-17) {
tmp = -6.0 * (x * z);
} else if (z <= 1.12e-38) {
tmp = x;
} else if (z <= 4.8e+101) {
tmp = 6.0 * (y * z);
} else if (z <= 3.2e+244) {
tmp = (x * -6.0) * z;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.8e-17: tmp = -6.0 * (x * z) elif z <= 1.12e-38: tmp = x elif z <= 4.8e+101: tmp = 6.0 * (y * z) elif z <= 3.2e+244: tmp = (x * -6.0) * z else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.8e-17) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 1.12e-38) tmp = x; elseif (z <= 4.8e+101) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 3.2e+244) tmp = Float64(Float64(x * -6.0) * z); else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.8e-17) tmp = -6.0 * (x * z); elseif (z <= 1.12e-38) tmp = x; elseif (z <= 4.8e+101) tmp = 6.0 * (y * z); elseif (z <= 3.2e+244) tmp = (x * -6.0) * z; else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.8e-17], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e-38], x, If[LessEqual[z, 4.8e+101], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+244], N[(N[(x * -6.0), $MachinePrecision] * z), $MachinePrecision], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-17}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+101}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+244}:\\
\;\;\;\;\left(x \cdot -6\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -2.7999999999999999e-17Initial program 99.6%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 98.4%
Taylor expanded in y around 0 56.5%
if -2.7999999999999999e-17 < z < 1.1200000000000001e-38Initial program 99.9%
Taylor expanded in z around 0 73.4%
if 1.1200000000000001e-38 < z < 4.79999999999999977e101Initial program 99.6%
Taylor expanded in z around 0 99.5%
Taylor expanded in z around inf 88.9%
Taylor expanded in y around inf 80.7%
*-commutative80.7%
Simplified80.7%
if 4.79999999999999977e101 < z < 3.2000000000000002e244Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around 0 59.3%
associate-*r*59.4%
Simplified59.4%
if 3.2000000000000002e244 < z Initial program 99.9%
Taylor expanded in y around inf 62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in y around inf 62.6%
fma-define62.6%
Simplified62.6%
Taylor expanded in z around inf 63.7%
*-commutative63.7%
Simplified63.7%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e+45) (not (<= x 1.3e+28))) (* x (+ (* -6.0 z) 1.0)) (* 6.0 (* z (- y x)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+45) || !(x <= 1.3e+28)) {
tmp = x * ((-6.0 * z) + 1.0);
} else {
tmp = 6.0 * (z * (y - 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 ((x <= (-1.9d+45)) .or. (.not. (x <= 1.3d+28))) then
tmp = x * (((-6.0d0) * z) + 1.0d0)
else
tmp = 6.0d0 * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+45) || !(x <= 1.3e+28)) {
tmp = x * ((-6.0 * z) + 1.0);
} else {
tmp = 6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e+45) or not (x <= 1.3e+28): tmp = x * ((-6.0 * z) + 1.0) else: tmp = 6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e+45) || !(x <= 1.3e+28)) tmp = Float64(x * Float64(Float64(-6.0 * z) + 1.0)); else tmp = Float64(6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.9e+45) || ~((x <= 1.3e+28))) tmp = x * ((-6.0 * z) + 1.0); else tmp = 6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e+45], N[Not[LessEqual[x, 1.3e+28]], $MachinePrecision]], N[(x * N[(N[(-6.0 * z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+45} \lor \neg \left(x \leq 1.3 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot \left(-6 \cdot z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if x < -1.9000000000000001e45 or 1.3000000000000001e28 < x Initial program 99.9%
Taylor expanded in x around inf 93.1%
+-commutative93.1%
Simplified93.1%
if -1.9000000000000001e45 < x < 1.3000000000000001e28Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 80.1%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.95e+45) (+ x (* -6.0 (* x z))) (if (<= x 1.16e+32) (* 6.0 (* z (- y x))) (* x (+ (* -6.0 z) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+45) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 1.16e+32) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x * ((-6.0 * z) + 1.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 <= (-1.95d+45)) then
tmp = x + ((-6.0d0) * (x * z))
else if (x <= 1.16d+32) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x * (((-6.0d0) * z) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+45) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 1.16e+32) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x * ((-6.0 * z) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.95e+45: tmp = x + (-6.0 * (x * z)) elif x <= 1.16e+32: tmp = 6.0 * (z * (y - x)) else: tmp = x * ((-6.0 * z) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.95e+45) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); elseif (x <= 1.16e+32) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = Float64(x * Float64(Float64(-6.0 * z) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.95e+45) tmp = x + (-6.0 * (x * z)); elseif (x <= 1.16e+32) tmp = 6.0 * (z * (y - x)); else tmp = x * ((-6.0 * z) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.95e+45], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.16e+32], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-6.0 * z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+45}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{+32}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-6 \cdot z + 1\right)\\
\end{array}
\end{array}
if x < -1.95e45Initial program 99.9%
Taylor expanded in y around 0 93.6%
if -1.95e45 < x < 1.16e32Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 80.1%
if 1.16e32 < x Initial program 99.9%
Taylor expanded in x around inf 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* 6.0 (* z (- y x))) (if (<= z 5.8e-5) (+ x (* 6.0 (* y z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 5.8e-5) {
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 <= (-0.17d0)) then
tmp = 6.0d0 * (z * (y - x))
else if (z <= 5.8d-5) 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 <= -0.17) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 5.8e-5) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = 6.0 * (z * (y - x)) elif z <= 5.8e-5: 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 <= -0.17) tmp = Float64(6.0 * Float64(z * Float64(y - x))); elseif (z <= 5.8e-5) 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 <= -0.17) tmp = 6.0 * (z * (y - x)); elseif (z <= 5.8e-5) 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, -0.17], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-5], 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 -0.17:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-5}:\\
\;\;\;\;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 < -0.170000000000000012Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.4%
if -0.170000000000000012 < z < 5.8e-5Initial program 99.8%
Taylor expanded in y around inf 99.4%
*-commutative99.4%
Simplified99.4%
if 5.8e-5 < z Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around 0 96.6%
metadata-eval96.6%
associate-*r*96.6%
mul-1-neg96.6%
distribute-lft-neg-out96.6%
*-commutative96.6%
associate-*r*96.6%
*-commutative96.6%
associate-*r*96.7%
*-commutative96.7%
associate-*r*96.6%
distribute-rgt-out99.6%
*-commutative99.6%
+-commutative99.6%
sub-neg99.6%
Simplified99.6%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.8e-17) (not (<= z 6800.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-17) || !(z <= 6800.0)) {
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 <= (-2.8d-17)) .or. (.not. (z <= 6800.0d0))) 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 <= -2.8e-17) || !(z <= 6800.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.8e-17) or not (z <= 6800.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.8e-17) || !(z <= 6800.0)) 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 <= -2.8e-17) || ~((z <= 6800.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.8e-17], N[Not[LessEqual[z, 6800.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-17} \lor \neg \left(z \leq 6800\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e-17 or 6800 < z Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.0%
Taylor expanded in y around 0 48.2%
if -2.7999999999999999e-17 < z < 6800Initial program 99.8%
Taylor expanded in z around 0 66.0%
Final simplification57.2%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* z (- y x)))))
double code(double x, double y, double z) {
return x + (6.0 * (z * (y - 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 + (6.0d0 * (z * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * (z * (y - x)));
}
def code(x, y, z): return x + (6.0 * (z * (y - x)))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(z * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (6.0 * (z * (y - x))); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(z \cdot \left(y - x\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (+ x (* z (* 6.0 (- y x)))))
double code(double x, double y, double z) {
return x + (z * (6.0 * (y - 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 + (z * (6.0d0 * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (z * (6.0 * (y - x)));
}
def code(x, y, z): return x + (z * (6.0 * (y - x)))
function code(x, y, z) return Float64(x + Float64(z * Float64(6.0 * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (z * (6.0 * (y - x))); end
code[x_, y_, z_] := N[(x + N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(6 \cdot \left(y - x\right)\right)
\end{array}
Initial program 99.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.9%
Final simplification34.9%
(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 2024067
(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)))