
(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 9 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 (* (sqrt (- a 0.3333333333333333)) rand))) 0.3333333333333333))
double code(double a, double rand) {
return (a + (0.3333333333333333 * (sqrt((a - 0.3333333333333333)) * rand))) - 0.3333333333333333;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
code = (a + (0.3333333333333333d0 * (sqrt((a - 0.3333333333333333d0)) * rand))) - 0.3333333333333333d0
end function
public static double code(double a, double rand) {
return (a + (0.3333333333333333 * (Math.sqrt((a - 0.3333333333333333)) * rand))) - 0.3333333333333333;
}
def code(a, rand): return (a + (0.3333333333333333 * (math.sqrt((a - 0.3333333333333333)) * rand))) - 0.3333333333333333
function code(a, rand) return Float64(Float64(a + Float64(0.3333333333333333 * Float64(sqrt(Float64(a - 0.3333333333333333)) * rand))) - 0.3333333333333333) end
function tmp = code(a, rand) tmp = (a + (0.3333333333333333 * (sqrt((a - 0.3333333333333333)) * rand))) - 0.3333333333333333; end
code[a_, rand_] := N[(N[(a + N[(0.3333333333333333 * N[(N[Sqrt[N[(a - 0.3333333333333333), $MachinePrecision]], $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\left(a + 0.3333333333333333 \cdot \left(\sqrt{a - 0.3333333333333333} \cdot rand\right)\right) - 0.3333333333333333
\end{array}
Initial program 99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in rand around 0 99.8%
Final simplification99.8%
(FPCore (a rand) :precision binary64 (if (or (<= rand -1.25e+67) (not (<= rand 8.5e+108))) (* 0.3333333333333333 (* (sqrt (- a 0.3333333333333333)) rand)) (- a 0.3333333333333333)))
double code(double a, double rand) {
double tmp;
if ((rand <= -1.25e+67) || !(rand <= 8.5e+108)) {
tmp = 0.3333333333333333 * (sqrt((a - 0.3333333333333333)) * rand);
} 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 <= (-1.25d+67)) .or. (.not. (rand <= 8.5d+108))) then
tmp = 0.3333333333333333d0 * (sqrt((a - 0.3333333333333333d0)) * rand)
else
tmp = a - 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if ((rand <= -1.25e+67) || !(rand <= 8.5e+108)) {
tmp = 0.3333333333333333 * (Math.sqrt((a - 0.3333333333333333)) * rand);
} else {
tmp = a - 0.3333333333333333;
}
return tmp;
}
def code(a, rand): tmp = 0 if (rand <= -1.25e+67) or not (rand <= 8.5e+108): tmp = 0.3333333333333333 * (math.sqrt((a - 0.3333333333333333)) * rand) else: tmp = a - 0.3333333333333333 return tmp
function code(a, rand) tmp = 0.0 if ((rand <= -1.25e+67) || !(rand <= 8.5e+108)) tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(a - 0.3333333333333333)) * rand)); else tmp = Float64(a - 0.3333333333333333); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if ((rand <= -1.25e+67) || ~((rand <= 8.5e+108))) tmp = 0.3333333333333333 * (sqrt((a - 0.3333333333333333)) * rand); else tmp = a - 0.3333333333333333; end tmp_2 = tmp; end
code[a_, rand_] := If[Or[LessEqual[rand, -1.25e+67], N[Not[LessEqual[rand, 8.5e+108]], $MachinePrecision]], N[(0.3333333333333333 * N[(N[Sqrt[N[(a - 0.3333333333333333), $MachinePrecision]], $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -1.25 \cdot 10^{+67} \lor \neg \left(rand \leq 8.5 \cdot 10^{+108}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(\sqrt{a - 0.3333333333333333} \cdot rand\right)\\
\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\
\end{array}
\end{array}
if rand < -1.24999999999999994e67 or 8.50000000000000016e108 < rand Initial program 98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
*-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in rand around inf 98.2%
if -1.24999999999999994e67 < rand < 8.50000000000000016e108Initial program 100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in rand around 0 96.2%
Final simplification97.0%
(FPCore (a rand) :precision binary64 (if (or (<= rand -4.2e+66) (not (<= rand 8.5e+108))) (* rand (sqrt (* (+ a -0.3333333333333333) 0.1111111111111111))) (- a 0.3333333333333333)))
double code(double a, double rand) {
double tmp;
if ((rand <= -4.2e+66) || !(rand <= 8.5e+108)) {
tmp = rand * sqrt(((a + -0.3333333333333333) * 0.1111111111111111));
} 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 <= (-4.2d+66)) .or. (.not. (rand <= 8.5d+108))) then
tmp = rand * sqrt(((a + (-0.3333333333333333d0)) * 0.1111111111111111d0))
else
tmp = a - 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if ((rand <= -4.2e+66) || !(rand <= 8.5e+108)) {
tmp = rand * Math.sqrt(((a + -0.3333333333333333) * 0.1111111111111111));
} else {
tmp = a - 0.3333333333333333;
}
return tmp;
}
def code(a, rand): tmp = 0 if (rand <= -4.2e+66) or not (rand <= 8.5e+108): tmp = rand * math.sqrt(((a + -0.3333333333333333) * 0.1111111111111111)) else: tmp = a - 0.3333333333333333 return tmp
function code(a, rand) tmp = 0.0 if ((rand <= -4.2e+66) || !(rand <= 8.5e+108)) tmp = Float64(rand * sqrt(Float64(Float64(a + -0.3333333333333333) * 0.1111111111111111))); else tmp = Float64(a - 0.3333333333333333); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if ((rand <= -4.2e+66) || ~((rand <= 8.5e+108))) tmp = rand * sqrt(((a + -0.3333333333333333) * 0.1111111111111111)); else tmp = a - 0.3333333333333333; end tmp_2 = tmp; end
code[a_, rand_] := If[Or[LessEqual[rand, -4.2e+66], N[Not[LessEqual[rand, 8.5e+108]], $MachinePrecision]], N[(rand * N[Sqrt[N[(N[(a + -0.3333333333333333), $MachinePrecision] * 0.1111111111111111), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -4.2 \cdot 10^{+66} \lor \neg \left(rand \leq 8.5 \cdot 10^{+108}\right):\\
\;\;\;\;rand \cdot \sqrt{\left(a + -0.3333333333333333\right) \cdot 0.1111111111111111}\\
\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\
\end{array}
\end{array}
if rand < -4.20000000000000011e66 or 8.50000000000000016e108 < rand Initial program 98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
*-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in rand around inf 98.2%
associate-*r*98.2%
sub-neg98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
add-sqr-sqrt97.9%
sqrt-unprod98.2%
*-commutative98.2%
*-commutative98.2%
swap-sqr98.3%
add-sqr-sqrt98.4%
+-commutative98.4%
metadata-eval98.4%
Applied egg-rr98.4%
if -4.20000000000000011e66 < rand < 8.50000000000000016e108Initial program 100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in rand around 0 96.2%
Final simplification97.0%
(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.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
remove-double-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
sub-neg99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in a around inf 98.9%
*-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (a rand) :precision binary64 (if (or (<= rand -1e+67) (not (<= rand 8.5e+108))) (* 0.3333333333333333 (* rand (sqrt a))) (- a 0.3333333333333333)))
double code(double a, double rand) {
double tmp;
if ((rand <= -1e+67) || !(rand <= 8.5e+108)) {
tmp = 0.3333333333333333 * (rand * sqrt(a));
} 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 <= (-1d+67)) .or. (.not. (rand <= 8.5d+108))) then
tmp = 0.3333333333333333d0 * (rand * sqrt(a))
else
tmp = a - 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if ((rand <= -1e+67) || !(rand <= 8.5e+108)) {
tmp = 0.3333333333333333 * (rand * Math.sqrt(a));
} else {
tmp = a - 0.3333333333333333;
}
return tmp;
}
def code(a, rand): tmp = 0 if (rand <= -1e+67) or not (rand <= 8.5e+108): tmp = 0.3333333333333333 * (rand * math.sqrt(a)) else: tmp = a - 0.3333333333333333 return tmp
function code(a, rand) tmp = 0.0 if ((rand <= -1e+67) || !(rand <= 8.5e+108)) tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(a))); else tmp = Float64(a - 0.3333333333333333); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if ((rand <= -1e+67) || ~((rand <= 8.5e+108))) tmp = 0.3333333333333333 * (rand * sqrt(a)); else tmp = a - 0.3333333333333333; end tmp_2 = tmp; end
code[a_, rand_] := If[Or[LessEqual[rand, -1e+67], N[Not[LessEqual[rand, 8.5e+108]], $MachinePrecision]], N[(0.3333333333333333 * N[(rand * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -1 \cdot 10^{+67} \lor \neg \left(rand \leq 8.5 \cdot 10^{+108}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\
\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\
\end{array}
\end{array}
if rand < -9.99999999999999983e66 or 8.50000000000000016e108 < rand Initial program 98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
*-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in rand around inf 98.2%
associate-*r*98.2%
sub-neg98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
add-sqr-sqrt97.9%
sqrt-unprod98.2%
*-commutative98.2%
*-commutative98.2%
swap-sqr98.3%
add-sqr-sqrt98.4%
+-commutative98.4%
metadata-eval98.4%
Applied egg-rr98.4%
Taylor expanded in a around inf 97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in rand around 0 96.9%
if -9.99999999999999983e66 < rand < 8.50000000000000016e108Initial program 100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in rand around 0 96.2%
Final simplification96.5%
(FPCore (a rand)
:precision binary64
(if (<= rand -4e+66)
(* (sqrt a) (* 0.3333333333333333 rand))
(if (<= rand 8.5e+108)
(- a 0.3333333333333333)
(* 0.3333333333333333 (* rand (sqrt a))))))
double code(double a, double rand) {
double tmp;
if (rand <= -4e+66) {
tmp = sqrt(a) * (0.3333333333333333 * rand);
} else if (rand <= 8.5e+108) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * sqrt(a));
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-4d+66)) then
tmp = sqrt(a) * (0.3333333333333333d0 * rand)
else if (rand <= 8.5d+108) then
tmp = a - 0.3333333333333333d0
else
tmp = 0.3333333333333333d0 * (rand * sqrt(a))
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -4e+66) {
tmp = Math.sqrt(a) * (0.3333333333333333 * rand);
} else if (rand <= 8.5e+108) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * Math.sqrt(a));
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -4e+66: tmp = math.sqrt(a) * (0.3333333333333333 * rand) elif rand <= 8.5e+108: tmp = a - 0.3333333333333333 else: tmp = 0.3333333333333333 * (rand * math.sqrt(a)) return tmp
function code(a, rand) tmp = 0.0 if (rand <= -4e+66) tmp = Float64(sqrt(a) * Float64(0.3333333333333333 * rand)); elseif (rand <= 8.5e+108) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(a))); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -4e+66) tmp = sqrt(a) * (0.3333333333333333 * rand); elseif (rand <= 8.5e+108) tmp = a - 0.3333333333333333; else tmp = 0.3333333333333333 * (rand * sqrt(a)); end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -4e+66], N[(N[Sqrt[a], $MachinePrecision] * N[(0.3333333333333333 * rand), $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 8.5e+108], N[(a - 0.3333333333333333), $MachinePrecision], N[(0.3333333333333333 * N[(rand * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -4 \cdot 10^{+66}:\\
\;\;\;\;\sqrt{a} \cdot \left(0.3333333333333333 \cdot rand\right)\\
\mathbf{elif}\;rand \leq 8.5 \cdot 10^{+108}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\
\end{array}
\end{array}
if rand < -3.99999999999999978e66Initial program 97.4%
sub-neg97.4%
metadata-eval97.4%
metadata-eval97.4%
*-commutative97.4%
sub-neg97.4%
metadata-eval97.4%
metadata-eval97.4%
Simplified97.4%
Taylor expanded in rand around inf 96.9%
associate-*r*96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
Simplified96.9%
add-sqr-sqrt96.6%
sqrt-unprod96.9%
*-commutative96.9%
*-commutative96.9%
swap-sqr97.1%
add-sqr-sqrt97.2%
+-commutative97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Taylor expanded in a around inf 96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in rand around 0 96.2%
associate-*r*96.2%
*-commutative96.2%
associate-*r*96.4%
Simplified96.4%
if -3.99999999999999978e66 < rand < 8.50000000000000016e108Initial program 100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in rand around 0 96.2%
if 8.50000000000000016e108 < rand Initial program 99.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 99.6%
associate-*r*99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
add-sqr-sqrt99.2%
sqrt-unprod99.6%
*-commutative99.6%
*-commutative99.6%
swap-sqr99.4%
add-sqr-sqrt99.6%
+-commutative99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in rand around 0 97.5%
Final simplification96.5%
(FPCore (a rand)
:precision binary64
(if (<= rand -4.2e+66)
(* rand (sqrt (* a 0.1111111111111111)))
(if (<= rand 8.5e+108)
(- a 0.3333333333333333)
(* 0.3333333333333333 (* rand (sqrt a))))))
double code(double a, double rand) {
double tmp;
if (rand <= -4.2e+66) {
tmp = rand * sqrt((a * 0.1111111111111111));
} else if (rand <= 8.5e+108) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * sqrt(a));
}
return tmp;
}
real(8) function code(a, rand)
real(8), intent (in) :: a
real(8), intent (in) :: rand
real(8) :: tmp
if (rand <= (-4.2d+66)) then
tmp = rand * sqrt((a * 0.1111111111111111d0))
else if (rand <= 8.5d+108) then
tmp = a - 0.3333333333333333d0
else
tmp = 0.3333333333333333d0 * (rand * sqrt(a))
end if
code = tmp
end function
public static double code(double a, double rand) {
double tmp;
if (rand <= -4.2e+66) {
tmp = rand * Math.sqrt((a * 0.1111111111111111));
} else if (rand <= 8.5e+108) {
tmp = a - 0.3333333333333333;
} else {
tmp = 0.3333333333333333 * (rand * Math.sqrt(a));
}
return tmp;
}
def code(a, rand): tmp = 0 if rand <= -4.2e+66: tmp = rand * math.sqrt((a * 0.1111111111111111)) elif rand <= 8.5e+108: tmp = a - 0.3333333333333333 else: tmp = 0.3333333333333333 * (rand * math.sqrt(a)) return tmp
function code(a, rand) tmp = 0.0 if (rand <= -4.2e+66) tmp = Float64(rand * sqrt(Float64(a * 0.1111111111111111))); elseif (rand <= 8.5e+108) tmp = Float64(a - 0.3333333333333333); else tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(a))); end return tmp end
function tmp_2 = code(a, rand) tmp = 0.0; if (rand <= -4.2e+66) tmp = rand * sqrt((a * 0.1111111111111111)); elseif (rand <= 8.5e+108) tmp = a - 0.3333333333333333; else tmp = 0.3333333333333333 * (rand * sqrt(a)); end tmp_2 = tmp; end
code[a_, rand_] := If[LessEqual[rand, -4.2e+66], N[(rand * N[Sqrt[N[(a * 0.1111111111111111), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 8.5e+108], N[(a - 0.3333333333333333), $MachinePrecision], N[(0.3333333333333333 * N[(rand * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;rand \leq -4.2 \cdot 10^{+66}:\\
\;\;\;\;rand \cdot \sqrt{a \cdot 0.1111111111111111}\\
\mathbf{elif}\;rand \leq 8.5 \cdot 10^{+108}:\\
\;\;\;\;a - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\
\end{array}
\end{array}
if rand < -4.20000000000000011e66Initial program 97.4%
sub-neg97.4%
metadata-eval97.4%
metadata-eval97.4%
*-commutative97.4%
sub-neg97.4%
metadata-eval97.4%
metadata-eval97.4%
Simplified97.4%
Taylor expanded in rand around inf 96.9%
associate-*r*96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
Simplified96.9%
add-sqr-sqrt96.6%
sqrt-unprod96.9%
*-commutative96.9%
*-commutative96.9%
swap-sqr97.1%
add-sqr-sqrt97.2%
+-commutative97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Taylor expanded in a around inf 96.5%
*-commutative96.5%
Simplified96.5%
if -4.20000000000000011e66 < rand < 8.50000000000000016e108Initial program 100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in rand around 0 96.2%
if 8.50000000000000016e108 < rand Initial program 99.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 99.6%
associate-*r*99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
add-sqr-sqrt99.2%
sqrt-unprod99.6%
*-commutative99.6%
*-commutative99.6%
swap-sqr99.4%
add-sqr-sqrt99.6%
+-commutative99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in rand around 0 97.5%
Final simplification96.5%
(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.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in rand around 0 61.7%
Final simplification61.7%
(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.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in a around inf 60.8%
Final simplification60.8%
herbie shell --seed 2023222
(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))))