\[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)
\]
↓
\[\left(a + -0.3333333333333333\right) \cdot \left(1 + {\left(a \cdot 9 + -3\right)}^{-0.5} \cdot rand\right)
\]
(FPCore (a rand)
:precision binary64
(*
(- a (/ 1.0 3.0))
(+ 1.0 (* (/ 1.0 (sqrt (* 9.0 (- a (/ 1.0 3.0))))) rand))))
↓
(FPCore (a rand)
:precision binary64
(* (+ a -0.3333333333333333) (+ 1.0 (* (pow (+ (* a 9.0) -3.0) -0.5) rand))))
double code(double a, double rand) {
return (a - (1.0 / 3.0)) * (1.0 + ((1.0 / sqrt((9.0 * (a - (1.0 / 3.0))))) * rand));
}
↓
double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (pow(((a * 9.0) + -3.0), -0.5) * rand));
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = (a - (1.0d0 / 3.0d0)) * (1.0d0 + ((1.0d0 / sqrt((9.0d0 * (a - (1.0d0 / 3.0d0))))) * rand))
end function
↓
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = (a + (-0.3333333333333333d0)) * (1.0d0 + ((((a * 9.0d0) + (-3.0d0)) ** (-0.5d0)) * rand))
end function
public static double code(double a, double rand) {
return (a - (1.0 / 3.0)) * (1.0 + ((1.0 / Math.sqrt((9.0 * (a - (1.0 / 3.0))))) * rand));
}
↓
public static double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (Math.pow(((a * 9.0) + -3.0), -0.5) * rand));
}
def code(a, rand):
return (a - (1.0 / 3.0)) * (1.0 + ((1.0 / math.sqrt((9.0 * (a - (1.0 / 3.0))))) * rand))
↓
def code(a, rand):
return (a + -0.3333333333333333) * (1.0 + (math.pow(((a * 9.0) + -3.0), -0.5) * rand))
function code(a, rand)
return Float64(Float64(a - Float64(1.0 / 3.0)) * Float64(1.0 + Float64(Float64(1.0 / sqrt(Float64(9.0 * Float64(a - Float64(1.0 / 3.0))))) * rand)))
end
↓
function code(a, rand)
return Float64(Float64(a + -0.3333333333333333) * Float64(1.0 + Float64((Float64(Float64(a * 9.0) + -3.0) ^ -0.5) * rand)))
end
function tmp = code(a, rand)
tmp = (a - (1.0 / 3.0)) * (1.0 + ((1.0 / sqrt((9.0 * (a - (1.0 / 3.0))))) * rand));
end
↓
function tmp = code(a, rand)
tmp = (a + -0.3333333333333333) * (1.0 + ((((a * 9.0) + -3.0) ^ -0.5) * rand));
end
code[a_, rand_] := N[(N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / N[Sqrt[N[(9.0 * N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[a_, rand_] := N[(N[(a + -0.3333333333333333), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(N[(a * 9.0), $MachinePrecision] + -3.0), $MachinePrecision], -0.5], $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)
↓
\left(a + -0.3333333333333333\right) \cdot \left(1 + {\left(a \cdot 9 + -3\right)}^{-0.5} \cdot rand\right)
Alternatives
| Alternative 1 |
|---|
| Error | 1.88% |
|---|
| Cost | 7241 |
|---|
\[\begin{array}{l}
\mathbf{if}\;rand \leq -2.1 \cdot 10^{+15} \lor \neg \left(rand \leq 2 \cdot 10^{-145}\right):\\
\;\;\;\;a \cdot \left(1 + \frac{rand}{\sqrt{a \cdot 9}}\right)\\
\mathbf{else}:\\
\;\;\;\;a + -0.3333333333333333\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.19% |
|---|
| Cost | 7232 |
|---|
\[\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{a \cdot 9 + -3}}\right)
\]
| Alternative 3 |
|---|
| Error | 8.78% |
|---|
| Cost | 7113 |
|---|
\[\begin{array}{l}
\mathbf{if}\;rand \leq -5.5 \cdot 10^{+66} \lor \neg \left(rand \leq 1.35 \cdot 10^{+101}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a + -0.3333333333333333}\right)\\
\mathbf{else}:\\
\;\;\;\;a + -0.3333333333333333\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 8.61% |
|---|
| Cost | 7113 |
|---|
\[\begin{array}{l}
\mathbf{if}\;rand \leq -6.5 \cdot 10^{+70} \lor \neg \left(rand \leq 4.6 \cdot 10^{+101}\right):\\
\;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\
\mathbf{else}:\\
\;\;\;\;a + -0.3333333333333333\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 1.34% |
|---|
| Cost | 7104 |
|---|
\[\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{a \cdot 9}}\right)
\]
| Alternative 6 |
|---|
| Error | 1.35% |
|---|
| Cost | 7104 |
|---|
\[\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\frac{rand}{\sqrt{a}}}{3}\right)
\]
| Alternative 7 |
|---|
| Error | 0.28% |
|---|
| Cost | 7104 |
|---|
\[-0.3333333333333333 + \left(a + 0.3333333333333333 \cdot \left(rand \cdot \sqrt{a + -0.3333333333333333}\right)\right)
\]
| Alternative 8 |
|---|
| Error | 0.2% |
|---|
| Cost | 7104 |
|---|
\[-0.3333333333333333 + \left(a + rand \cdot \left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)\right)
\]
| Alternative 9 |
|---|
| Error | 9.65% |
|---|
| Cost | 6985 |
|---|
\[\begin{array}{l}
\mathbf{if}\;rand \leq -3.6 \cdot 10^{+68} \lor \neg \left(rand \leq 1.35 \cdot 10^{+101}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\
\mathbf{else}:\\
\;\;\;\;a + -0.3333333333333333\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 9.39% |
|---|
| Cost | 6985 |
|---|
\[\begin{array}{l}
\mathbf{if}\;rand \leq -7 \cdot 10^{+70} \lor \neg \left(rand \leq 1.6 \cdot 10^{+101}\right):\\
\;\;\;\;rand \cdot \sqrt{a \cdot 0.1111111111111111}\\
\mathbf{else}:\\
\;\;\;\;a + -0.3333333333333333\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 1.43% |
|---|
| Cost | 6976 |
|---|
\[-0.3333333333333333 + \left(a + 0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\right)
\]
| Alternative 12 |
|---|
| Error | 27.91% |
|---|
| Cost | 192 |
|---|
\[a + -0.3333333333333333
\]
| Alternative 13 |
|---|
| Error | 98.53% |
|---|
| Cost | 64 |
|---|
\[-0.3333333333333333
\]
| Alternative 14 |
|---|
| Error | 29.15% |
|---|
| Cost | 64 |
|---|
\[a
\]