
(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%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -3.2e+171)
t_0
(if (<= z -5.6e+24)
t_1
(if (<= z -1.2e-21) t_0 (if (<= z 0.17) x t_1))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.2e+171) {
tmp = t_0;
} else if (z <= -5.6e+24) {
tmp = t_1;
} else if (z <= -1.2e-21) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-3.2d+171)) then
tmp = t_0
else if (z <= (-5.6d+24)) then
tmp = t_1
else if (z <= (-1.2d-21)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.2e+171) {
tmp = t_0;
} else if (z <= -5.6e+24) {
tmp = t_1;
} else if (z <= -1.2e-21) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = -6.0 * (x * z) tmp = 0 if z <= -3.2e+171: tmp = t_0 elif z <= -5.6e+24: tmp = t_1 elif z <= -1.2e-21: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -3.2e+171) tmp = t_0; elseif (z <= -5.6e+24) tmp = t_1; elseif (z <= -1.2e-21) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = -6.0 * (x * z); tmp = 0.0; if (z <= -3.2e+171) tmp = t_0; elseif (z <= -5.6e+24) tmp = t_1; elseif (z <= -1.2e-21) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+171], t$95$0, If[LessEqual[z, -5.6e+24], t$95$1, If[LessEqual[z, -1.2e-21], t$95$0, If[LessEqual[z, 0.17], x, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000011e171 or -5.6000000000000003e24 < z < -1.2e-21Initial program 99.8%
associate-*r*97.3%
+-commutative97.3%
*-commutative97.3%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 64.6%
*-commutative64.6%
Simplified64.6%
if -3.20000000000000011e171 < z < -5.6000000000000003e24 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 65.5%
Taylor expanded in z around inf 63.6%
if -1.2e-21 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 75.1%
Final simplification69.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -3.2e+171)
t_0
(if (<= z -1.2e+30)
(* -6.0 (* x z))
(if (<= z -3.7e-17) t_0 (if (<= z 0.17) x (* x (* z -6.0))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3.2e+171) {
tmp = t_0;
} else if (z <= -1.2e+30) {
tmp = -6.0 * (x * z);
} else if (z <= -3.7e-17) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} 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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-3.2d+171)) then
tmp = t_0
else if (z <= (-1.2d+30)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-3.7d-17)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
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.2e+171) {
tmp = t_0;
} else if (z <= -1.2e+30) {
tmp = -6.0 * (x * z);
} else if (z <= -3.7e-17) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -3.2e+171: tmp = t_0 elif z <= -1.2e+30: tmp = -6.0 * (x * z) elif z <= -3.7e-17: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.2e+171) tmp = t_0; elseif (z <= -1.2e+30) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -3.7e-17) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.2e+171) tmp = t_0; elseif (z <= -1.2e+30) tmp = -6.0 * (x * z); elseif (z <= -3.7e-17) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); 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.2e+171], t$95$0, If[LessEqual[z, -1.2e+30], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.7e-17], t$95$0, If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{+30}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -3.20000000000000011e171 or -1.2e30 < z < -3.6999999999999997e-17Initial program 99.8%
associate-*r*97.3%
+-commutative97.3%
*-commutative97.3%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 64.6%
*-commutative64.6%
Simplified64.6%
if -3.20000000000000011e171 < z < -1.2e30Initial program 99.8%
Taylor expanded in y around 0 64.5%
Taylor expanded in z around inf 64.5%
if -3.6999999999999997e-17 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 75.1%
if 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 66.0%
Taylor expanded in z around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
*-commutative63.1%
Simplified63.1%
Final simplification69.0%
(FPCore (x y z)
:precision binary64
(if (<= z -3.1e+171)
(* z (* y 6.0))
(if (<= z -5.8e+28)
(* -6.0 (* x z))
(if (<= z -7.9e-23)
(* 6.0 (* y z))
(if (<= z 0.17) x (* x (* z -6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e+171) {
tmp = z * (y * 6.0);
} else if (z <= -5.8e+28) {
tmp = -6.0 * (x * z);
} else if (z <= -7.9e-23) {
tmp = 6.0 * (y * z);
} else if (z <= 0.17) {
tmp = x;
} 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 <= (-3.1d+171)) then
tmp = z * (y * 6.0d0)
else if (z <= (-5.8d+28)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-7.9d-23)) then
tmp = 6.0d0 * (y * z)
else if (z <= 0.17d0) then
tmp = x
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 <= -3.1e+171) {
tmp = z * (y * 6.0);
} else if (z <= -5.8e+28) {
tmp = -6.0 * (x * z);
} else if (z <= -7.9e-23) {
tmp = 6.0 * (y * z);
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e+171: tmp = z * (y * 6.0) elif z <= -5.8e+28: tmp = -6.0 * (x * z) elif z <= -7.9e-23: tmp = 6.0 * (y * z) elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e+171) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= -5.8e+28) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -7.9e-23) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e+171) tmp = z * (y * 6.0); elseif (z <= -5.8e+28) tmp = -6.0 * (x * z); elseif (z <= -7.9e-23) tmp = 6.0 * (y * z); elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e+171], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.8e+28], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -7.9e-23], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+171}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{+28}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -7.9 \cdot 10^{-23}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -3.0999999999999999e171Initial program 99.8%
associate-*r*96.9%
+-commutative96.9%
*-commutative96.9%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 61.6%
associate-*r*61.7%
*-commutative61.7%
Simplified61.7%
if -3.0999999999999999e171 < z < -5.8000000000000002e28Initial program 99.8%
Taylor expanded in y around 0 64.5%
Taylor expanded in z around inf 64.5%
if -5.8000000000000002e28 < z < -7.90000000000000041e-23Initial program 99.8%
associate-*r*99.3%
+-commutative99.3%
*-commutative99.3%
associate-*r*100.0%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 78.3%
*-commutative78.3%
Simplified78.3%
if -7.90000000000000041e-23 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 75.1%
if 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 66.0%
Taylor expanded in z around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
*-commutative63.1%
Simplified63.1%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.35e-20) (not (<= z 2.3e-35))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.35e-20) || !(z <= 2.3e-35)) {
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 <= (-2.35d-20)) .or. (.not. (z <= 2.3d-35))) 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 <= -2.35e-20) || !(z <= 2.3e-35)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.35e-20) or not (z <= 2.3e-35): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.35e-20) || !(z <= 2.3e-35)) 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 <= -2.35e-20) || ~((z <= 2.3e-35))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.35e-20], N[Not[LessEqual[z, 2.3e-35]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-20} \lor \neg \left(z \leq 2.3 \cdot 10^{-35}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.35000000000000007e-20 or 2.2999999999999999e-35 < z Initial program 99.8%
associate-*r*99.1%
+-commutative99.1%
*-commutative99.1%
associate-*r*99.8%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 97.2%
if -2.35000000000000007e-20 < z < 2.2999999999999999e-35Initial program 99.8%
Taylor expanded in z around 0 77.4%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.6e-17) (* 6.0 (* (- y x) z)) (if (<= z 1.45e-32) x (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e-17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.45e-32) {
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 <= (-1.6d-17)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.45d-32) 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 <= -1.6e-17) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.45e-32) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e-17: tmp = 6.0 * ((y - x) * z) elif z <= 1.45e-32: tmp = x else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e-17) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.45e-32) 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 <= -1.6e-17) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.45e-32) tmp = x; else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e-17], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-32], x, N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-17}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1.6000000000000001e-17Initial program 99.8%
associate-*r*98.5%
+-commutative98.5%
*-commutative98.5%
associate-*r*99.9%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.8%
if -1.6000000000000001e-17 < z < 1.44999999999999998e-32Initial program 99.8%
Taylor expanded in z around 0 77.4%
if 1.44999999999999998e-32 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 95.5%
*-commutative95.5%
*-commutative95.5%
associate-*r*95.7%
Simplified95.7%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= z -1160000000.0) (* 6.0 (* (- y x) z)) (if (<= z 1.05e-23) (+ x (* 6.0 (* y z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1160000000.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-23) {
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 <= (-1160000000.0d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.05d-23) 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 <= -1160000000.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-23) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1160000000.0: tmp = 6.0 * ((y - x) * z) elif z <= 1.05e-23: 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 <= -1160000000.0) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.05e-23) 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 <= -1160000000.0) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.05e-23) 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, -1160000000.0], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e-23], 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 -1160000000:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-23}:\\
\;\;\;\;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 < -1.16e9Initial program 99.8%
associate-*r*98.4%
+-commutative98.4%
*-commutative98.4%
associate-*r*99.9%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.9%
if -1.16e9 < z < 1.05e-23Initial program 99.8%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
Simplified99.2%
if 1.05e-23 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 96.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*96.9%
Simplified96.9%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= z -0.18) (* 6.0 (* (- y x) z)) (if (<= z 1.05e-23) (+ x (* y (* 6.0 z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.18) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-23) {
tmp = x + (y * (6.0 * 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.18d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.05d-23) then
tmp = x + (y * (6.0d0 * 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.18) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-23) {
tmp = x + (y * (6.0 * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.18: tmp = 6.0 * ((y - x) * z) elif z <= 1.05e-23: tmp = x + (y * (6.0 * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.18) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.05e-23) tmp = Float64(x + Float64(y * Float64(6.0 * 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.18) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.05e-23) tmp = x + (y * (6.0 * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.18], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e-23], N[(x + N[(y * N[(6.0 * 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.18:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-23}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -0.17999999999999999Initial program 99.8%
associate-*r*98.4%
+-commutative98.4%
*-commutative98.4%
associate-*r*99.9%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.9%
if -0.17999999999999999 < z < 1.05e-23Initial program 99.9%
Taylor expanded in y around inf 99.2%
Taylor expanded in y around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
if 1.05e-23 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 96.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*96.9%
Simplified96.9%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1160000000.0) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1160000000.0) || !(z <= 0.17)) {
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 <= (-1160000000.0d0)) .or. (.not. (z <= 0.17d0))) 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 <= -1160000000.0) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1160000000.0) or not (z <= 0.17): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1160000000.0) || !(z <= 0.17)) 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 <= -1160000000.0) || ~((z <= 0.17))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1160000000.0], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1160000000 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.16e9 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 60.0%
Taylor expanded in z around inf 58.6%
if -1.16e9 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 72.2%
Final simplification65.1%
(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 35.9%
Final simplification35.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 2024027
(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)))