
(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 10 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(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}
Initial program 99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -9.4e+213)
(* 6.0 (* y z))
(if (<= z -165000.0)
(* -6.0 (* x z))
(if (or (<= z -3.3e-105) (not (<= z 1.52e-28))) (* y (* 6.0 z)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.4e+213) {
tmp = 6.0 * (y * z);
} else if (z <= -165000.0) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.3e-105) || !(z <= 1.52e-28)) {
tmp = y * (6.0 * 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 <= (-9.4d+213)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-165000.0d0)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-3.3d-105)) .or. (.not. (z <= 1.52d-28))) then
tmp = y * (6.0d0 * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9.4e+213) {
tmp = 6.0 * (y * z);
} else if (z <= -165000.0) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.3e-105) || !(z <= 1.52e-28)) {
tmp = y * (6.0 * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.4e+213: tmp = 6.0 * (y * z) elif z <= -165000.0: tmp = -6.0 * (x * z) elif (z <= -3.3e-105) or not (z <= 1.52e-28): tmp = y * (6.0 * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.4e+213) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -165000.0) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -3.3e-105) || !(z <= 1.52e-28)) tmp = Float64(y * Float64(6.0 * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.4e+213) tmp = 6.0 * (y * z); elseif (z <= -165000.0) tmp = -6.0 * (x * z); elseif ((z <= -3.3e-105) || ~((z <= 1.52e-28))) tmp = y * (6.0 * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.4e+213], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -165000.0], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.3e-105], N[Not[LessEqual[z, 1.52e-28]], $MachinePrecision]], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.4 \cdot 10^{+213}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -165000:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-105} \lor \neg \left(z \leq 1.52 \cdot 10^{-28}\right):\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.3999999999999995e213Initial program 99.8%
Taylor expanded in y around inf 66.0%
*-commutative66.0%
Simplified66.0%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
fma-define65.9%
Simplified65.9%
Taylor expanded in y around inf 65.8%
if -9.3999999999999995e213 < z < -165000Initial program 99.9%
Taylor expanded in y around 0 64.0%
Taylor expanded in z around inf 62.7%
if -165000 < z < -3.2999999999999999e-105 or 1.5199999999999999e-28 < z Initial program 99.8%
Taylor expanded in y around inf 70.6%
*-commutative70.6%
Simplified70.6%
Taylor expanded in y around inf 68.7%
*-commutative68.7%
fma-define68.7%
Simplified68.7%
Taylor expanded in y around inf 64.1%
*-commutative64.1%
associate-*r*64.2%
*-commutative64.2%
Simplified64.2%
if -3.2999999999999999e-105 < z < 1.5199999999999999e-28Initial program 99.9%
Taylor expanded in z around 0 72.3%
Final simplification67.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -4.3e+206)
t_0
(if (<= z -400000.0)
(* -6.0 (* x z))
(if (or (<= z -2.4e-103) (not (<= z 2.15e-21))) t_0 x)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -4.3e+206) {
tmp = t_0;
} else if (z <= -400000.0) {
tmp = -6.0 * (x * z);
} else if ((z <= -2.4e-103) || !(z <= 2.15e-21)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-4.3d+206)) then
tmp = t_0
else if (z <= (-400000.0d0)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-2.4d-103)) .or. (.not. (z <= 2.15d-21))) then
tmp = t_0
else
tmp = x
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 <= -4.3e+206) {
tmp = t_0;
} else if (z <= -400000.0) {
tmp = -6.0 * (x * z);
} else if ((z <= -2.4e-103) || !(z <= 2.15e-21)) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -4.3e+206: tmp = t_0 elif z <= -400000.0: tmp = -6.0 * (x * z) elif (z <= -2.4e-103) or not (z <= 2.15e-21): tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -4.3e+206) tmp = t_0; elseif (z <= -400000.0) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -2.4e-103) || !(z <= 2.15e-21)) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -4.3e+206) tmp = t_0; elseif (z <= -400000.0) tmp = -6.0 * (x * z); elseif ((z <= -2.4e-103) || ~((z <= 2.15e-21))) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+206], t$95$0, If[LessEqual[z, -400000.0], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.4e-103], N[Not[LessEqual[z, 2.15e-21]], $MachinePrecision]], t$95$0, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+206}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -400000:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-103} \lor \neg \left(z \leq 2.15 \cdot 10^{-21}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.29999999999999988e206 or -4e5 < z < -2.4000000000000002e-103 or 2.1499999999999999e-21 < z Initial program 99.8%
Taylor expanded in y around inf 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in y around inf 68.1%
*-commutative68.1%
fma-define68.1%
Simplified68.1%
Taylor expanded in y around inf 64.5%
if -4.29999999999999988e206 < z < -4e5Initial program 99.9%
Taylor expanded in y around 0 64.0%
Taylor expanded in z around inf 62.7%
if -2.4000000000000002e-103 < z < 2.1499999999999999e-21Initial program 99.9%
Taylor expanded in z around 0 72.3%
Final simplification67.2%
(FPCore (x y z)
:precision binary64
(if (<= z -8.2e+207)
(* 6.0 (* y z))
(if (<= z -390000.0)
(* z (* x -6.0))
(if (<= z -3.7e-104)
(* y (* 6.0 z))
(if (<= z 2.15e-25) x (* z (* y 6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e+207) {
tmp = 6.0 * (y * z);
} else if (z <= -390000.0) {
tmp = z * (x * -6.0);
} else if (z <= -3.7e-104) {
tmp = y * (6.0 * z);
} else if (z <= 2.15e-25) {
tmp = x;
} else {
tmp = z * (y * 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.2d+207)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-390000.0d0)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-3.7d-104)) then
tmp = y * (6.0d0 * z)
else if (z <= 2.15d-25) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e+207) {
tmp = 6.0 * (y * z);
} else if (z <= -390000.0) {
tmp = z * (x * -6.0);
} else if (z <= -3.7e-104) {
tmp = y * (6.0 * z);
} else if (z <= 2.15e-25) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.2e+207: tmp = 6.0 * (y * z) elif z <= -390000.0: tmp = z * (x * -6.0) elif z <= -3.7e-104: tmp = y * (6.0 * z) elif z <= 2.15e-25: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.2e+207) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -390000.0) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -3.7e-104) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 2.15e-25) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.2e+207) tmp = 6.0 * (y * z); elseif (z <= -390000.0) tmp = z * (x * -6.0); elseif (z <= -3.7e-104) tmp = y * (6.0 * z); elseif (z <= 2.15e-25) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.2e+207], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -390000.0], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.7e-104], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e-25], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+207}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -390000:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-104}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -8.2e207Initial program 99.8%
Taylor expanded in y around inf 66.0%
*-commutative66.0%
Simplified66.0%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
fma-define65.9%
Simplified65.9%
Taylor expanded in y around inf 65.8%
if -8.2e207 < z < -3.9e5Initial program 99.9%
Taylor expanded in y around 0 64.0%
Taylor expanded in z around inf 62.7%
associate-*r*62.8%
*-commutative62.8%
*-commutative62.8%
Simplified62.8%
if -3.9e5 < z < -3.6999999999999999e-104Initial program 99.7%
Taylor expanded in y around inf 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 94.2%
*-commutative94.2%
fma-define94.1%
Simplified94.1%
Taylor expanded in y around inf 77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
Simplified77.1%
if -3.6999999999999999e-104 < z < 2.14999999999999988e-25Initial program 99.9%
Taylor expanded in z around 0 72.3%
if 2.14999999999999988e-25 < z Initial program 99.8%
Taylor expanded in y around inf 63.8%
*-commutative63.8%
Simplified63.8%
Taylor expanded in y around inf 62.7%
*-commutative62.7%
fma-define62.8%
Simplified62.8%
Taylor expanded in y around inf 61.1%
*-commutative61.1%
associate-*r*61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around 0 61.1%
associate-*r*61.2%
*-commutative61.2%
Simplified61.2%
Final simplification67.3%
(FPCore (x y z)
:precision binary64
(if (<= z -1.16e+208)
(* 6.0 (* y z))
(if (<= z -400000.0)
(* -6.0 (* x z))
(if (<= z -3.8e-103)
(* y (* 6.0 z))
(if (<= z 1.65e-25) x (* z (* y 6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.16e+208) {
tmp = 6.0 * (y * z);
} else if (z <= -400000.0) {
tmp = -6.0 * (x * z);
} else if (z <= -3.8e-103) {
tmp = y * (6.0 * z);
} else if (z <= 1.65e-25) {
tmp = x;
} else {
tmp = z * (y * 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.16d+208)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-400000.0d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-3.8d-103)) then
tmp = y * (6.0d0 * z)
else if (z <= 1.65d-25) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.16e+208) {
tmp = 6.0 * (y * z);
} else if (z <= -400000.0) {
tmp = -6.0 * (x * z);
} else if (z <= -3.8e-103) {
tmp = y * (6.0 * z);
} else if (z <= 1.65e-25) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.16e+208: tmp = 6.0 * (y * z) elif z <= -400000.0: tmp = -6.0 * (x * z) elif z <= -3.8e-103: tmp = y * (6.0 * z) elif z <= 1.65e-25: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.16e+208) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -400000.0) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -3.8e-103) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 1.65e-25) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.16e+208) tmp = 6.0 * (y * z); elseif (z <= -400000.0) tmp = -6.0 * (x * z); elseif (z <= -3.8e-103) tmp = y * (6.0 * z); elseif (z <= 1.65e-25) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.16e+208], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -400000.0], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.8e-103], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e-25], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{+208}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -400000:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-103}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.15999999999999999e208Initial program 99.8%
Taylor expanded in y around inf 66.0%
*-commutative66.0%
Simplified66.0%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
fma-define65.9%
Simplified65.9%
Taylor expanded in y around inf 65.8%
if -1.15999999999999999e208 < z < -4e5Initial program 99.9%
Taylor expanded in y around 0 64.0%
Taylor expanded in z around inf 62.7%
if -4e5 < z < -3.8000000000000001e-103Initial program 99.7%
Taylor expanded in y around inf 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 94.2%
*-commutative94.2%
fma-define94.1%
Simplified94.1%
Taylor expanded in y around inf 77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
Simplified77.1%
if -3.8000000000000001e-103 < z < 1.6499999999999999e-25Initial program 99.9%
Taylor expanded in z around 0 72.3%
if 1.6499999999999999e-25 < z Initial program 99.8%
Taylor expanded in y around inf 63.8%
*-commutative63.8%
Simplified63.8%
Taylor expanded in y around inf 62.7%
*-commutative62.7%
fma-define62.8%
Simplified62.8%
Taylor expanded in y around inf 61.1%
*-commutative61.1%
associate-*r*61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around 0 61.1%
associate-*r*61.2%
*-commutative61.2%
Simplified61.2%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.55e-116) (not (<= y 4.9e-82))) (+ x (* z (* y 6.0))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.55e-116) || !(y <= 4.9e-82)) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (-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 ((y <= (-1.55d-116)) .or. (.not. (y <= 4.9d-82))) then
tmp = x + (z * (y * 6.0d0))
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.55e-116) || !(y <= 4.9e-82)) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.55e-116) or not (y <= 4.9e-82): tmp = x + (z * (y * 6.0)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.55e-116) || !(y <= 4.9e-82)) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.55e-116) || ~((y <= 4.9e-82))) tmp = x + (z * (y * 6.0)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.55e-116], N[Not[LessEqual[y, 4.9e-82]], $MachinePrecision]], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{-116} \lor \neg \left(y \leq 4.9 \cdot 10^{-82}\right):\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -1.55000000000000009e-116 or 4.9000000000000003e-82 < y Initial program 99.8%
Taylor expanded in y around inf 88.1%
if -1.55000000000000009e-116 < y < 4.9000000000000003e-82Initial program 99.8%
Taylor expanded in y around 0 88.6%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e-116) (not (<= y 5.1e-82))) (+ x (* 6.0 (* y z))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-116) || !(y <= 5.1e-82)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-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 ((y <= (-1d-116)) .or. (.not. (y <= 5.1d-82))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-116) || !(y <= 5.1e-82)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e-116) or not (y <= 5.1e-82): tmp = x + (6.0 * (y * z)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e-116) || !(y <= 5.1e-82)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1e-116) || ~((y <= 5.1e-82))) tmp = x + (6.0 * (y * z)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e-116], N[Not[LessEqual[y, 5.1e-82]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-116} \lor \neg \left(y \leq 5.1 \cdot 10^{-82}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -9.9999999999999999e-117 or 5.09999999999999992e-82 < y Initial program 99.8%
Taylor expanded in y around inf 88.0%
*-commutative88.0%
Simplified88.0%
if -9.9999999999999999e-117 < y < 5.09999999999999992e-82Initial program 99.8%
Taylor expanded in y around 0 88.6%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e-14) (* 6.0 (* y z)) (if (<= y 1.9e+15) (+ x (* -6.0 (* x z))) (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e-14) {
tmp = 6.0 * (y * z);
} else if (y <= 1.9e+15) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * (y * 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 (y <= (-1.15d-14)) then
tmp = 6.0d0 * (y * z)
else if (y <= 1.9d+15) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e-14) {
tmp = 6.0 * (y * z);
} else if (y <= 1.9e+15) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e-14: tmp = 6.0 * (y * z) elif y <= 1.9e+15: tmp = x + (-6.0 * (x * z)) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e-14) tmp = Float64(6.0 * Float64(y * z)); elseif (y <= 1.9e+15) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e-14) tmp = 6.0 * (y * z); elseif (y <= 1.9e+15) tmp = x + (-6.0 * (x * z)); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e-14], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+15], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-14}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+15}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -1.14999999999999999e-14Initial program 99.9%
Taylor expanded in y around inf 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in y around inf 89.7%
*-commutative89.7%
fma-define89.7%
Simplified89.7%
Taylor expanded in y around inf 73.3%
if -1.14999999999999999e-14 < y < 1.9e15Initial program 99.8%
Taylor expanded in y around 0 81.9%
if 1.9e15 < y Initial program 99.8%
Taylor expanded in y around inf 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in y around inf 92.2%
*-commutative92.2%
fma-define92.2%
Simplified92.2%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
associate-*r*74.0%
*-commutative74.0%
Simplified74.0%
Taylor expanded in y around 0 74.0%
associate-*r*74.1%
*-commutative74.1%
Simplified74.1%
Final simplification77.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e-13) (not (<= z 0.0068))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-13) || !(z <= 0.0068)) {
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 <= (-4.2d-13)) .or. (.not. (z <= 0.0068d0))) 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 <= -4.2e-13) || !(z <= 0.0068)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e-13) or not (z <= 0.0068): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e-13) || !(z <= 0.0068)) 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 <= -4.2e-13) || ~((z <= 0.0068))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e-13], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-13} \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.19999999999999977e-13 or 0.00679999999999999962 < z Initial program 99.8%
Taylor expanded in y around 0 50.7%
Taylor expanded in z around inf 50.3%
if -4.19999999999999977e-13 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around 0 64.4%
Final simplification57.0%
(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 32.3%
(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 2024170
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))