
(FPCore (a rand) :precision binary64 (let* ((t_0 (- a (/ 1.0 3.0)))) (* t_0 (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 t_0))) rand)))))
double code(double a, double rand) {
double t_0 = a - (1.0 / 3.0);
return t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: t_0
t_0 = a - (1.0d0 / 3.0d0)
code = t_0 * (1.0d0 + ((1.0d0 / sqrt((9.0d0 * t_0))) * rand))
end function
public static double code(double a, double rand) {
double t_0 = a - (1.0 / 3.0);
return t_0 * (1.0 + ((1.0 / Math.sqrt((9.0 * t_0))) * rand));
}
def code(a, rand): t_0 = a - (1.0 / 3.0) return t_0 * (1.0 + ((1.0 / math.sqrt((9.0 * t_0))) * rand))
function code(a, rand) t_0 = Float64(a - Float64(1.0 / 3.0)) return Float64(t_0 * Float64(1.0 + Float64(Float64(1.0 / sqrt(Float64(9.0 * t_0))) * rand))) end
function tmp = code(a, rand) t_0 = a - (1.0 / 3.0); tmp = t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand)); end
code[a_, rand_] := Block[{t$95$0 = N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(1.0 + N[(N[(1.0 / N[Sqrt[N[(9.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a - \frac{1}{3}\\
t_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t_0}} \cdot rand\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a rand) :precision binary64 (let* ((t_0 (- a (/ 1.0 3.0)))) (* t_0 (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 t_0))) rand)))))
double code(double a, double rand) {
double t_0 = a - (1.0 / 3.0);
return t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: t_0
t_0 = a - (1.0d0 / 3.0d0)
code = t_0 * (1.0d0 + ((1.0d0 / sqrt((9.0d0 * t_0))) * rand))
end function
public static double code(double a, double rand) {
double t_0 = a - (1.0 / 3.0);
return t_0 * (1.0 + ((1.0 / Math.sqrt((9.0 * t_0))) * rand));
}
def code(a, rand): t_0 = a - (1.0 / 3.0) return t_0 * (1.0 + ((1.0 / math.sqrt((9.0 * t_0))) * rand))
function code(a, rand) t_0 = Float64(a - Float64(1.0 / 3.0)) return Float64(t_0 * Float64(1.0 + Float64(Float64(1.0 / sqrt(Float64(9.0 * t_0))) * rand))) end
function tmp = code(a, rand) t_0 = a - (1.0 / 3.0); tmp = t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand)); end
code[a_, rand_] := Block[{t$95$0 = N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(1.0 + N[(N[(1.0 / N[Sqrt[N[(9.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a - \frac{1}{3}\\
t_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t_0}} \cdot rand\right)
\end{array}
\end{array}
(FPCore (a rand) :precision binary64 (* (+ a -0.3333333333333333) (+ 1.0 (/ rand (sqrt (+ (* a 9.0) -3.0))))))
double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (rand / sqrt(((a * 9.0) + -3.0))));
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = (a + (-0.3333333333333333d0)) * (1.0d0 + (rand / sqrt(((a * 9.0d0) + (-3.0d0)))))
end function
public static double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (rand / Math.sqrt(((a * 9.0) + -3.0))));
}
def code(a, rand): return (a + -0.3333333333333333) * (1.0 + (rand / math.sqrt(((a * 9.0) + -3.0))))
function code(a, rand) return Float64(Float64(a + -0.3333333333333333) * Float64(1.0 + Float64(rand / sqrt(Float64(Float64(a * 9.0) + -3.0))))) end
function tmp = code(a, rand) tmp = (a + -0.3333333333333333) * (1.0 + (rand / sqrt(((a * 9.0) + -3.0)))); end
code[a_, rand_] := N[(N[(a + -0.3333333333333333), $MachinePrecision] * N[(1.0 + N[(rand / N[Sqrt[N[(N[(a * 9.0), $MachinePrecision] + -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{a \cdot 9 + -3}}\right)
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*l/99.9%
*-lft-identity99.9%
sub-neg99.9%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (a rand) :precision binary64 (if (or (<= rand -2.45e+67) (not (<= rand 4.2e+55))) (* 0.3333333333333333 (* rand (sqrt (- a 0.3333333333333333)))) (- a 0.3333333333333333)))
double code(double a, double rand) {
double tmp;
if ((rand <= -2.45e+67) || !(rand <= 4.2e+55)) {
tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333)));
} else {
tmp = a - 0.3333333333333333;
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if ((rand <= (-2.45d+67)) .or. (.not. (rand <= 4.2d+55))) then
tmp = 0.3333333333333333d0 * (rand * sqrt((a - 0.3333333333333333d0)))
else
tmp = a - 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if ((rand <= -2.45e+67) || !(rand <= 4.2e+55)) {
tmp = 0.3333333333333333 * (rand * Math.sqrt((a - 0.3333333333333333)));
} else {
tmp = a - 0.3333333333333333;
}
return tmp;
}
def code(a, rand): tmp = 0 if (rand <= -2.45e+67) or not (rand <= 4.2e+55): tmp = 0.3333333333333333 * (rand * math.sqrt((a - 0.3333333333333333))) else: tmp = a - 0.3333333333333333 return tmp
function code(a, rand) tmp = 0.0 if ((rand <= -2.45e+67) || !(rand <= 4.2e+55)) tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(Float64(a - 0.3333333333333333)))); else tmp = Float64(a - 0.3333333333333333); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if ((rand <= -2.45e+67) || ~((rand <= 4.2e+55))) tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333))); else tmp = a - 0.3333333333333333; end tmp_2 = tmp; end
code[a_, rand_] := If[Or[LessEqual[rand, -2.45e+67], N[Not[LessEqual[rand, 4.2e+55]], $MachinePrecision]], N[(0.3333333333333333 * N[(rand * N[Sqrt[N[(a - 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -2.45 \cdot 10^{+67} \lor \neg \left(rand \leq 4.2 \cdot 10^{+55}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right)\\
\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\
\end{array}
\end{array}
if rand < -2.44999999999999995e67 or 4.2000000000000001e55 < rand Initial program 99.5%
remove-double-neg99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in rand around inf 86.3%
if -2.44999999999999995e67 < rand < 4.2000000000000001e55Initial program 99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in rand around 0 95.9%
Final simplification92.2%
(FPCore (a rand)
:precision binary64
(if (<= rand -2.25e+67)
(* (sqrt (+ a -0.3333333333333333)) (* rand 0.3333333333333333))
(if (<= rand 2.4e+53)
(- a 0.3333333333333333)
(* 0.3333333333333333 (* rand (sqrt (- a 0.3333333333333333)))))))
double code(double a, double rand) {
double tmp;
if (rand <= -2.25e+67) {
tmp = sqrt((a + -0.3333333333333333)) * (rand * 0.3333333333333333);
} else if (rand <= 2.4e+53) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333)));
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-2.25d+67)) then
tmp = sqrt((a + (-0.3333333333333333d0))) * (rand * 0.3333333333333333d0)
else if (rand <= 2.4d+53) then
tmp = a - 0.3333333333333333d0
else
tmp = 0.3333333333333333d0 * (rand * sqrt((a - 0.3333333333333333d0)))
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -2.25e+67) {
tmp = Math.sqrt((a + -0.3333333333333333)) * (rand * 0.3333333333333333);
} else if (rand <= 2.4e+53) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * Math.sqrt((a - 0.3333333333333333)));
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -2.25e+67: tmp = math.sqrt((a + -0.3333333333333333)) * (rand * 0.3333333333333333) elif rand <= 2.4e+53: tmp = a - 0.3333333333333333 else: tmp = 0.3333333333333333 * (rand * math.sqrt((a - 0.3333333333333333))) return tmp
function code(a, rand) tmp = 0.0 if (rand <= -2.25e+67) tmp = Float64(sqrt(Float64(a + -0.3333333333333333)) * Float64(rand * 0.3333333333333333)); elseif (rand <= 2.4e+53) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(Float64(a - 0.3333333333333333)))); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -2.25e+67) tmp = sqrt((a + -0.3333333333333333)) * (rand * 0.3333333333333333); elseif (rand <= 2.4e+53) tmp = a - 0.3333333333333333; else tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333))); end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -2.25e+67], N[(N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision] * N[(rand * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 2.4e+53], N[(a - 0.3333333333333333), $MachinePrecision], N[(0.3333333333333333 * N[(rand * N[Sqrt[N[(a - 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -2.25 \cdot 10^{+67}:\\
\;\;\;\;\sqrt{a + -0.3333333333333333} \cdot \left(rand \cdot 0.3333333333333333\right)\\
\mathbf{elif}\;rand \leq 2.4 \cdot 10^{+53}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right)\\
\end{array}
\end{array}
if rand < -2.2499999999999999e67Initial program 99.5%
remove-double-neg99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
associate-*l/99.7%
*-un-lft-identity99.7%
frac-2neg99.7%
sqrt-prod99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
Applied egg-rr99.6%
neg-mul-199.6%
*-commutative99.6%
times-frac99.4%
metadata-eval99.4%
metadata-eval99.4%
times-frac99.6%
*-lft-identity99.6%
metadata-eval99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in rand around inf 84.6%
associate-*r*84.6%
sub-neg84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
if -2.2499999999999999e67 < rand < 2.4e53Initial program 99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in rand around 0 95.9%
if 2.4e53 < rand Initial program 99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in rand around inf 88.6%
Final simplification92.2%
(FPCore (a rand) :precision binary64 (* (+ a -0.3333333333333333) (+ 1.0 (/ rand (sqrt (* a 9.0))))))
double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (rand / sqrt((a * 9.0))));
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = (a + (-0.3333333333333333d0)) * (1.0d0 + (rand / sqrt((a * 9.0d0))))
end function
public static double code(double a, double rand) {
return (a + -0.3333333333333333) * (1.0 + (rand / Math.sqrt((a * 9.0))));
}
def code(a, rand): return (a + -0.3333333333333333) * (1.0 + (rand / math.sqrt((a * 9.0))))
function code(a, rand) return Float64(Float64(a + -0.3333333333333333) * Float64(1.0 + Float64(rand / sqrt(Float64(a * 9.0))))) end
function tmp = code(a, rand) tmp = (a + -0.3333333333333333) * (1.0 + (rand / sqrt((a * 9.0)))); end
code[a_, rand_] := N[(N[(a + -0.3333333333333333), $MachinePrecision] * N[(1.0 + N[(rand / N[Sqrt[N[(a * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{a \cdot 9}}\right)
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*l/99.9%
*-lft-identity99.9%
sub-neg99.9%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around inf 98.6%
*-commutative98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (a rand) :precision binary64 (+ a (- (* 0.3333333333333333 (* rand (sqrt (+ a -0.3333333333333333)))) 0.3333333333333333)))
double code(double a, double rand) {
return a + ((0.3333333333333333 * (rand * sqrt((a + -0.3333333333333333)))) - 0.3333333333333333);
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = a + ((0.3333333333333333d0 * (rand * sqrt((a + (-0.3333333333333333d0))))) - 0.3333333333333333d0)
end function
public static double code(double a, double rand) {
return a + ((0.3333333333333333 * (rand * Math.sqrt((a + -0.3333333333333333)))) - 0.3333333333333333);
}
def code(a, rand): return a + ((0.3333333333333333 * (rand * math.sqrt((a + -0.3333333333333333)))) - 0.3333333333333333)
function code(a, rand) return Float64(a + Float64(Float64(0.3333333333333333 * Float64(rand * sqrt(Float64(a + -0.3333333333333333)))) - 0.3333333333333333)) end
function tmp = code(a, rand) tmp = a + ((0.3333333333333333 * (rand * sqrt((a + -0.3333333333333333)))) - 0.3333333333333333); end
code[a_, rand_] := N[(a + N[(N[(0.3333333333333333 * N[(rand * N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a + \left(0.3333333333333333 \cdot \left(rand \cdot \sqrt{a + -0.3333333333333333}\right) - 0.3333333333333333\right)
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (a rand) :precision binary64 (if (<= rand -5.2e+129) (* (- (* a a) 0.1111111111111111) (+ 3.0 (* a -9.0))) (if (<= rand 3e+146) (- a 0.3333333333333333) (* (* a a) 3.0))))
double code(double a, double rand) {
double tmp;
if (rand <= -5.2e+129) {
tmp = ((a * a) - 0.1111111111111111) * (3.0 + (a * -9.0));
} else if (rand <= 3e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-5.2d+129)) then
tmp = ((a * a) - 0.1111111111111111d0) * (3.0d0 + (a * (-9.0d0)))
else if (rand <= 3d+146) then
tmp = a - 0.3333333333333333d0
else
tmp = (a * a) * 3.0d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -5.2e+129) {
tmp = ((a * a) - 0.1111111111111111) * (3.0 + (a * -9.0));
} else if (rand <= 3e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -5.2e+129: tmp = ((a * a) - 0.1111111111111111) * (3.0 + (a * -9.0)) elif rand <= 3e+146: tmp = a - 0.3333333333333333 else: tmp = (a * a) * 3.0 return tmp
function code(a, rand) tmp = 0.0 if (rand <= -5.2e+129) tmp = Float64(Float64(Float64(a * a) - 0.1111111111111111) * Float64(3.0 + Float64(a * -9.0))); elseif (rand <= 3e+146) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(Float64(a * a) * 3.0); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -5.2e+129) tmp = ((a * a) - 0.1111111111111111) * (3.0 + (a * -9.0)); elseif (rand <= 3e+146) tmp = a - 0.3333333333333333; else tmp = (a * a) * 3.0; end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -5.2e+129], N[(N[(N[(a * a), $MachinePrecision] - 0.1111111111111111), $MachinePrecision] * N[(3.0 + N[(a * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 3e+146], N[(a - 0.3333333333333333), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -5.2 \cdot 10^{+129}:\\
\;\;\;\;\left(a \cdot a - 0.1111111111111111\right) \cdot \left(3 + a \cdot -9\right)\\
\mathbf{elif}\;rand \leq 3 \cdot 10^{+146}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 3\\
\end{array}
\end{array}
if rand < -5.20000000000000024e129Initial program 99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
cancel-sign-sub99.5%
remove-double-neg99.5%
neg-mul-199.5%
distribute-lft-neg-out99.5%
distribute-rgt-neg-in99.5%
distribute-rgt-out--99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
metadata-eval99.5%
associate-*l/99.7%
*-lft-identity99.7%
sub-neg99.7%
Simplified99.6%
flip--94.8%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
associate-*r/94.8%
*-rgt-identity94.8%
Simplified94.8%
Taylor expanded in rand around 0 0.4%
associate-*r/0.4%
unpow20.4%
mul-1-neg0.4%
+-commutative0.4%
Simplified0.4%
div-inv0.4%
+-commutative0.4%
Applied egg-rr0.4%
Taylor expanded in a around 0 38.8%
*-commutative38.8%
Simplified38.8%
if -5.20000000000000024e129 < rand < 3.00000000000000002e146Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 84.2%
if 3.00000000000000002e146 < rand Initial program 99.6%
distribute-rgt-in99.6%
*-lft-identity99.6%
cancel-sign-sub99.6%
remove-double-neg99.6%
neg-mul-199.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
distribute-rgt-out--99.6%
neg-sub099.6%
associate-+l-99.6%
neg-sub099.6%
+-commutative99.6%
unsub-neg99.6%
metadata-eval99.6%
associate-*l/99.8%
*-lft-identity99.8%
sub-neg99.8%
Simplified99.8%
flip--76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
associate-*r/76.0%
*-rgt-identity76.0%
Simplified76.0%
Taylor expanded in rand around 0 41.0%
associate-*r/41.0%
unpow241.0%
mul-1-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in a around inf 41.0%
unpow241.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Taylor expanded in a around 0 41.6%
unpow241.6%
Simplified41.6%
Final simplification73.0%
(FPCore (a rand) :precision binary64 (if (<= rand -6.5e+129) (/ (+ 0.1111111111111111 (* a a)) (- (- 0.3333333333333333) a)) (if (<= rand 3.3e+146) (- a 0.3333333333333333) (* (* a a) 3.0))))
double code(double a, double rand) {
double tmp;
if (rand <= -6.5e+129) {
tmp = (0.1111111111111111 + (a * a)) / (-0.3333333333333333 - a);
} else if (rand <= 3.3e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-6.5d+129)) then
tmp = (0.1111111111111111d0 + (a * a)) / (-0.3333333333333333d0 - a)
else if (rand <= 3.3d+146) then
tmp = a - 0.3333333333333333d0
else
tmp = (a * a) * 3.0d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -6.5e+129) {
tmp = (0.1111111111111111 + (a * a)) / (-0.3333333333333333 - a);
} else if (rand <= 3.3e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -6.5e+129: tmp = (0.1111111111111111 + (a * a)) / (-0.3333333333333333 - a) elif rand <= 3.3e+146: tmp = a - 0.3333333333333333 else: tmp = (a * a) * 3.0 return tmp
function code(a, rand) tmp = 0.0 if (rand <= -6.5e+129) tmp = Float64(Float64(0.1111111111111111 + Float64(a * a)) / Float64(Float64(-0.3333333333333333) - a)); elseif (rand <= 3.3e+146) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(Float64(a * a) * 3.0); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -6.5e+129) tmp = (0.1111111111111111 + (a * a)) / (-0.3333333333333333 - a); elseif (rand <= 3.3e+146) tmp = a - 0.3333333333333333; else tmp = (a * a) * 3.0; end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -6.5e+129], N[(N[(0.1111111111111111 + N[(a * a), $MachinePrecision]), $MachinePrecision] / N[((-0.3333333333333333) - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 3.3e+146], N[(a - 0.3333333333333333), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{0.1111111111111111 + a \cdot a}{\left(-0.3333333333333333\right) - a}\\
\mathbf{elif}\;rand \leq 3.3 \cdot 10^{+146}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 3\\
\end{array}
\end{array}
if rand < -6.4999999999999995e129Initial program 99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
cancel-sign-sub99.5%
remove-double-neg99.5%
neg-mul-199.5%
distribute-lft-neg-out99.5%
distribute-rgt-neg-in99.5%
distribute-rgt-out--99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
metadata-eval99.5%
associate-*l/99.7%
*-lft-identity99.7%
sub-neg99.7%
Simplified99.6%
flip--94.8%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
associate-*r/94.8%
*-rgt-identity94.8%
Simplified94.8%
Taylor expanded in rand around 0 0.4%
associate-*r/0.4%
unpow20.4%
mul-1-neg0.4%
+-commutative0.4%
Simplified0.4%
div-inv0.4%
+-commutative0.4%
Applied egg-rr0.4%
un-div-inv0.4%
+-commutative0.4%
frac-2neg0.4%
Applied egg-rr34.8%
if -6.4999999999999995e129 < rand < 3.30000000000000016e146Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 84.2%
if 3.30000000000000016e146 < rand Initial program 99.6%
distribute-rgt-in99.6%
*-lft-identity99.6%
cancel-sign-sub99.6%
remove-double-neg99.6%
neg-mul-199.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
distribute-rgt-out--99.6%
neg-sub099.6%
associate-+l-99.6%
neg-sub099.6%
+-commutative99.6%
unsub-neg99.6%
metadata-eval99.6%
associate-*l/99.8%
*-lft-identity99.8%
sub-neg99.8%
Simplified99.8%
flip--76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
associate-*r/76.0%
*-rgt-identity76.0%
Simplified76.0%
Taylor expanded in rand around 0 41.0%
associate-*r/41.0%
unpow241.0%
mul-1-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in a around inf 41.0%
unpow241.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Taylor expanded in a around 0 41.6%
unpow241.6%
Simplified41.6%
Final simplification72.4%
(FPCore (a rand) :precision binary64 (if (<= rand -5e+129) (/ (* a a) (- -0.3333333333333333 a)) (if (<= rand 3.6e+146) (- a 0.3333333333333333) (* (* a a) 3.0))))
double code(double a, double rand) {
double tmp;
if (rand <= -5e+129) {
tmp = (a * a) / (-0.3333333333333333 - a);
} else if (rand <= 3.6e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-5d+129)) then
tmp = (a * a) / ((-0.3333333333333333d0) - a)
else if (rand <= 3.6d+146) then
tmp = a - 0.3333333333333333d0
else
tmp = (a * a) * 3.0d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -5e+129) {
tmp = (a * a) / (-0.3333333333333333 - a);
} else if (rand <= 3.6e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -5e+129: tmp = (a * a) / (-0.3333333333333333 - a) elif rand <= 3.6e+146: tmp = a - 0.3333333333333333 else: tmp = (a * a) * 3.0 return tmp
function code(a, rand) tmp = 0.0 if (rand <= -5e+129) tmp = Float64(Float64(a * a) / Float64(-0.3333333333333333 - a)); elseif (rand <= 3.6e+146) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(Float64(a * a) * 3.0); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -5e+129) tmp = (a * a) / (-0.3333333333333333 - a); elseif (rand <= 3.6e+146) tmp = a - 0.3333333333333333; else tmp = (a * a) * 3.0; end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -5e+129], N[(N[(a * a), $MachinePrecision] / N[(-0.3333333333333333 - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 3.6e+146], N[(a - 0.3333333333333333), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -5 \cdot 10^{+129}:\\
\;\;\;\;\frac{a \cdot a}{-0.3333333333333333 - a}\\
\mathbf{elif}\;rand \leq 3.6 \cdot 10^{+146}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 3\\
\end{array}
\end{array}
if rand < -5.0000000000000003e129Initial program 99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
cancel-sign-sub99.5%
remove-double-neg99.5%
neg-mul-199.5%
distribute-lft-neg-out99.5%
distribute-rgt-neg-in99.5%
distribute-rgt-out--99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
metadata-eval99.5%
associate-*l/99.7%
*-lft-identity99.7%
sub-neg99.7%
Simplified99.6%
flip--94.8%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
associate-*r/94.8%
*-rgt-identity94.8%
Simplified94.8%
Taylor expanded in rand around 0 0.4%
associate-*r/0.4%
unpow20.4%
mul-1-neg0.4%
+-commutative0.4%
Simplified0.4%
Taylor expanded in a around inf 0.4%
unpow20.4%
neg-mul-10.4%
distribute-rgt-neg-in0.4%
Simplified0.4%
neg-sub00.4%
metadata-eval0.4%
div-sub0.4%
metadata-eval0.4%
add-sqr-sqrt0.4%
times-frac0.5%
add-sqr-sqrt0.5%
sqrt-prod0.4%
sqr-neg0.4%
distribute-lft-neg-in0.4%
distribute-lft-neg-in0.4%
sqrt-prod0.0%
add-sqr-sqrt5.2%
times-frac34.8%
sqr-neg34.8%
add-sqr-sqrt34.8%
Applied egg-rr34.8%
div034.8%
neg-sub034.8%
distribute-neg-frac34.8%
neg-mul-134.8%
*-rgt-identity34.8%
times-frac34.8%
metadata-eval34.8%
associate-/r*34.8%
neg-mul-134.8%
associate-*r/34.8%
/-rgt-identity34.8%
associate-*l/34.8%
*-lft-identity34.8%
neg-sub034.8%
+-commutative34.8%
associate--r+34.8%
metadata-eval34.8%
Simplified34.8%
if -5.0000000000000003e129 < rand < 3.5999999999999998e146Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 84.2%
if 3.5999999999999998e146 < rand Initial program 99.6%
distribute-rgt-in99.6%
*-lft-identity99.6%
cancel-sign-sub99.6%
remove-double-neg99.6%
neg-mul-199.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
distribute-rgt-out--99.6%
neg-sub099.6%
associate-+l-99.6%
neg-sub099.6%
+-commutative99.6%
unsub-neg99.6%
metadata-eval99.6%
associate-*l/99.8%
*-lft-identity99.8%
sub-neg99.8%
Simplified99.8%
flip--76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
associate-*r/76.0%
*-rgt-identity76.0%
Simplified76.0%
Taylor expanded in rand around 0 41.0%
associate-*r/41.0%
unpow241.0%
mul-1-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in a around inf 41.0%
unpow241.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Taylor expanded in a around 0 41.6%
unpow241.6%
Simplified41.6%
Final simplification72.4%
(FPCore (a rand) :precision binary64 (if (<= rand 3.6e+146) (- a 0.3333333333333333) (* (* a a) 3.0)))
double code(double a, double rand) {
double tmp;
if (rand <= 3.6e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= 3.6d+146) then
tmp = a - 0.3333333333333333d0
else
tmp = (a * a) * 3.0d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= 3.6e+146) {
tmp = a - 0.3333333333333333;
} else {
tmp = (a * a) * 3.0;
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= 3.6e+146: tmp = a - 0.3333333333333333 else: tmp = (a * a) * 3.0 return tmp
function code(a, rand) tmp = 0.0 if (rand <= 3.6e+146) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(Float64(a * a) * 3.0); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= 3.6e+146) tmp = a - 0.3333333333333333; else tmp = (a * a) * 3.0; end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, 3.6e+146], N[(a - 0.3333333333333333), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * 3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq 3.6 \cdot 10^{+146}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 3\\
\end{array}
\end{array}
if rand < 3.5999999999999998e146Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 70.3%
if 3.5999999999999998e146 < rand Initial program 99.6%
distribute-rgt-in99.6%
*-lft-identity99.6%
cancel-sign-sub99.6%
remove-double-neg99.6%
neg-mul-199.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
distribute-rgt-out--99.6%
neg-sub099.6%
associate-+l-99.6%
neg-sub099.6%
+-commutative99.6%
unsub-neg99.6%
metadata-eval99.6%
associate-*l/99.8%
*-lft-identity99.8%
sub-neg99.8%
Simplified99.8%
flip--76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
associate-*r/76.0%
*-rgt-identity76.0%
Simplified76.0%
Taylor expanded in rand around 0 41.0%
associate-*r/41.0%
unpow241.0%
mul-1-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in a around inf 41.0%
unpow241.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Taylor expanded in a around 0 41.6%
unpow241.6%
Simplified41.6%
Final simplification67.3%
(FPCore (a rand) :precision binary64 (- a 0.3333333333333333))
double code(double a, double rand) {
return a - 0.3333333333333333;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = a - 0.3333333333333333d0
end function
public static double code(double a, double rand) {
return a - 0.3333333333333333;
}
def code(a, rand): return a - 0.3333333333333333
function code(a, rand) return Float64(a - 0.3333333333333333) end
function tmp = code(a, rand) tmp = a - 0.3333333333333333; end
code[a_, rand_] := N[(a - 0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
a - 0.3333333333333333
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 63.6%
Final simplification63.6%
(FPCore (a rand) :precision binary64 -0.3333333333333333)
double code(double a, double rand) {
return -0.3333333333333333;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = -0.3333333333333333d0
end function
public static double code(double a, double rand) {
return -0.3333333333333333;
}
def code(a, rand): return -0.3333333333333333
function code(a, rand) return -0.3333333333333333 end
function tmp = code(a, rand) tmp = -0.3333333333333333; end
code[a_, rand_] := -0.3333333333333333
\begin{array}{l}
\\
-0.3333333333333333
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in rand around 0 63.6%
Taylor expanded in a around 0 1.6%
Final simplification1.6%
(FPCore (a rand) :precision binary64 a)
double code(double a, double rand) {
return a;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = a
end function
public static double code(double a, double rand) {
return a;
}
def code(a, rand): return a
function code(a, rand) return a end
function tmp = code(a, rand) tmp = a; end
code[a_, rand_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 99.8%
remove-double-neg99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around inf 62.3%
Final simplification62.3%
herbie shell --seed 2023287
(FPCore (a rand)
:name "Octave 3.8, oct_fill_randg"
:precision binary64
(* (- a (/ 1.0 3.0)) (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 (- a (/ 1.0 3.0))))) rand))))