Average Error: 0.1 → 0.1
Time: 42.5s
Precision: 64
Internal Precision: 128
\[\left(a - \frac{1.0}{3.0}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1.0}{3.0}\right)}} \cdot rand\right)\]
\[\left(1 + {\left(\left(a - \frac{1.0}{3.0}\right) \cdot 9\right)}^{\frac{-1}{2}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)\]

Error

Bits error versus a

Bits error versus rand

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\left(a - \frac{1.0}{3.0}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1.0}{3.0}\right)}} \cdot rand\right)\]
  2. Using strategy rm
  3. Applied *-commutative0.1

    \[\leadsto \color{blue}{\left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1.0}{3.0}\right)}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)}\]
  4. Using strategy rm
  5. Applied pow1/20.1

    \[\leadsto \left(1 + \frac{1}{\color{blue}{{\left(9 \cdot \left(a - \frac{1.0}{3.0}\right)\right)}^{\frac{1}{2}}}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)\]
  6. Applied pow-flip0.1

    \[\leadsto \left(1 + \color{blue}{{\left(9 \cdot \left(a - \frac{1.0}{3.0}\right)\right)}^{\left(-\frac{1}{2}\right)}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)\]
  7. Simplified0.1

    \[\leadsto \left(1 + {\left(9 \cdot \left(a - \frac{1.0}{3.0}\right)\right)}^{\color{blue}{\frac{-1}{2}}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)\]
  8. Final simplification0.1

    \[\leadsto \left(1 + {\left(\left(a - \frac{1.0}{3.0}\right) \cdot 9\right)}^{\frac{-1}{2}} \cdot rand\right) \cdot \left(a - \frac{1.0}{3.0}\right)\]

Reproduce

herbie shell --seed 2019022 +o rules:numerics
(FPCore (a rand)
  :name "Octave 3.8, oct_fill_randg"
  (* (- a (/ 1.0 3.0)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand))))

Details

Time bar (total: 41.9s)Debug log

sample166.0ms

Algorithm
intervals
Results
100.0ms758×body80nan
35.0ms284×body80valid

simplify181.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
180.0ms
(* (- a (/ 1.0 3.0)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.1b

localize43.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))
0.2b
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
0.1b
(sqrt (* 9 (- a (/ 1.0 3.0))))
0.1b
(* (- a (/ 1.0 3.0)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l*
add-cube-cbrt
associate-*r/
*-un-lft-identity
add-sqr-sqrt
add-exp-log
pow1
flip--
sqrt-div
add-cbrt-cube
flip3--
add-log-exp
log1p-expm1-u
associate-/r/
associate-/r*
frac-times
expm1-log1p-u
flip-+
associate-*l/
associate-*r*
flip3-+
pow-flip
div-inv
sqrt-prod
*-commutative
pow1/2
inv-pow
cbrt-unprod
prod-exp
pow-prod-down
distribute-lft-in
frac-2neg
clear-num
rec-exp
distribute-rgt-in
Counts
4 → 81
Calls
4 calls:
Slowest
4.0ms
(* (- a (/ 1.0 3.0)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))
4.0ms
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
2.0ms
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))
2.0ms
(sqrt (* 9 (- a (/ 1.0 3.0))))

series196.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
74.0ms
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
59.0ms
(* (- a (/ 1.0 3.0)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))
34.0ms
(sqrt (* 9 (- a (/ 1.0 3.0))))
28.0ms
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))

simplify7.0s

Counts
50 → 93
Calls
50 calls:
Slowest
588.0ms
(* (- (* a a) (* (/ 1.0 3.0) (/ 1.0 3.0))) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))
475.0ms
(* (+ a (/ 1.0 3.0)) (- 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))
434.0ms
(* (- (* a a) (* (/ 1.0 3.0) (/ 1.0 3.0))) (- (* 1 1) (* (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand) (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand))))
420.0ms
(sqrt (* 9 (- (pow a 3) (pow (/ 1.0 3.0) 3))))
413.0ms
(* (- (pow a 3) (pow (/ 1.0 3.0) 3)) (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))

prune955.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

localize7.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))
0.2b
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
0.1b
(sqrt (* 9 (- a (/ 1.0 3.0))))
0.1b
(* (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)) (- a (/ 1.0 3.0)))

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l*
add-cube-cbrt
associate-*r/
*-un-lft-identity
add-sqr-sqrt
add-exp-log
pow1
flip--
sqrt-div
add-cbrt-cube
flip3--
add-log-exp
log1p-expm1-u
associate-/r/
associate-/r*
frac-times
expm1-log1p-u
flip-+
associate-*l/
associate-*r*
flip3-+
pow-flip
div-inv
sqrt-prod
*-commutative
pow1/2
distribute-lft-in
sub-neg
distribute-rgt-in
inv-pow
cbrt-unprod
prod-exp
pow-prod-down
frac-2neg
clear-num
rec-exp
Counts
4 → 83
Calls
4 calls:
Slowest
9.0ms
(* (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)) (- a (/ 1.0 3.0)))
7.0ms
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
4.0ms
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))
4.0ms
(sqrt (* 9 (- a (/ 1.0 3.0))))

series220.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
104.0ms
(* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)
48.0ms
(/ 1 (sqrt (* 9 (- a (/ 1.0 3.0)))))
43.0ms
(* (+ 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)) (- a (/ 1.0 3.0)))
24.0ms
(sqrt (* 9 (- a (/ 1.0 3.0))))

simplify7.7s

Counts
52 → 95
Calls
52 calls:
Slowest
904.0ms
(* (+ (pow 1 3) (pow (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand) 3)) (- (* a a) (* (/ 1.0 3.0) (/ 1.0 3.0))))
514.0ms
(* (- 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)) (+ (* a a) (+ (* (/ 1.0 3.0) (/ 1.0 3.0)) (* a (/ 1.0 3.0)))))
513.0ms
(* (+ (* 1 1) (- (* (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand) (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)) (* 1 (* (/ 1 (sqrt (* 9 (- a (/ 1.0 3.0))))) rand)))) (+ a (/ 1.0 3.0)))
424.0ms
(/ 1 (sqrt (* 9 (- (pow a 3) (pow (/ 1.0 3.0) 3)))))
355.0ms
(- (* 1/3 (* (sqrt -3.0) rand)) (+ (* 4.5 (/ (* (pow a 2) rand) (sqrt -3.0))) (+ (* 1.5 (/ (* a rand) (sqrt -3.0))) (* 3.375 (/ (* (pow a 2) rand) (pow (sqrt -3.0) 3))))))

prune951.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize33.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)
0.2b
(pow (* 9 (- a (/ 1.0 3.0))) -1/2)
0.1b
(* (+ 1 (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)) (- a (/ 1.0 3.0)))
0.0b
(* 9 (- a (/ 1.0 3.0)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
associate-*l*
pow1
associate-*r*
add-cbrt-cube
add-log-exp
flip--
log1p-expm1-u
associate-*r/
flip3--
distribute-lft-in
sub-neg
frac-times
expm1-log1p-u
distribute-rgt-in
flip-+
*-commutative
flip3-+
associate-*l/
unpow-prod-down
cbrt-unprod
prod-exp
pow-exp
pow-prod-down
pow-pow
pow-to-exp
Counts
4 → 77
Calls
4 calls:
Slowest
6.0ms
(* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)
5.0ms
(* (+ 1 (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)) (- a (/ 1.0 3.0)))
2.0ms
(pow (* 9 (- a (/ 1.0 3.0))) -1/2)
2.0ms
(* 9 (- a (/ 1.0 3.0)))

series197.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
78.0ms
(* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)
53.0ms
(pow (* 9 (- a (/ 1.0 3.0))) -1/2)
42.0ms
(* (+ 1 (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)) (- a (/ 1.0 3.0)))
23.0ms
(* 9 (- a (/ 1.0 3.0)))

simplify6.0s

Counts
51 → 89
Calls
51 calls:
Slowest
464.0ms
(* (- 1 (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)) (+ (* a a) (+ (* (/ 1.0 3.0) (/ 1.0 3.0)) (* a (/ 1.0 3.0)))))
453.0ms
(* (+ (* 1 1) (- (* (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand) (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)) (* 1 (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand)))) (+ a (/ 1.0 3.0)))
369.0ms
(+ (* 0.041666666666666664 (/ (exp (* -1/2 (- (log 9) (log (/ 1 a))))) (pow a 2))) (+ (exp (* -1/2 (- (log 9) (log (/ 1 a))))) (* 0.16666666666666666 (/ (exp (* -1/2 (- (log 9) (log (/ 1 a))))) a))))
364.0ms
(* (+ (pow 1 3) (pow (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand) 3)) (- (* a a) (* (/ 1.0 3.0) (/ 1.0 3.0))))
359.0ms
(* (- (* 1 1) (* (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand) (* (pow (* 9 (- a (/ 1.0 3.0))) -1/2) rand))) (- (* a a) (* (/ 1.0 3.0) (/ 1.0 3.0))))

prune859.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

localize20.0ms

Local error

Found 3 expressions with local error:

0.4b
(/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0))))
0.2b
(* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)
0.1b
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- a (/ 1.0 3.0)))

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
48×times-frac
37×add-cube-cbrt
37×*-un-lft-identity
37×add-sqr-sqrt
33×associate-*l*
27×sqrt-prod
15×div-inv
add-exp-log
add-cbrt-cube
associate-/r*
flip--
flip3--
pow1
associate-/l*
associate-/r/
sqrt-div
frac-times
add-log-exp
log1p-expm1-u
flip-+
associate-*l/
associate-*r*
flip3-+
expm1-log1p-u
*-commutative
associate-*r/
div-exp
distribute-lft-in
sub-neg
distribute-rgt-in
associate-/l/
cbrt-unprod
prod-exp
pow-prod-down
frac-2neg
clear-num
rec-exp
cbrt-undiv
Counts
3 → 124
Calls
3 calls:
Slowest
11.0ms
(* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)
9.0ms
(/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0))))
4.0ms
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- a (/ 1.0 3.0)))

series160.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
77.0ms
(* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)
54.0ms
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- a (/ 1.0 3.0)))
28.0ms
(/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0))))

simplify8.7s

Counts
124 → 133
Calls
124 calls:
Slowest
920.0ms
(* (+ (pow 1 3) (pow (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand) 3)) (- a (/ 1.0 3.0)))
738.0ms
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- (/ 1.0 3.0)))
690.0ms
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- (/ 1.0 3.0)))
628.0ms
(* (- (* 1 1) (* (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand) (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand))) (- a (/ 1.0 3.0)))
591.0ms
(* (+ 1 (* (/ (/ 1 (sqrt 9)) (sqrt (- a (/ 1.0 3.0)))) rand)) (- a (/ 1.0 3.0)))

prune2.0s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0b

regimes172.0ms

Accuracy

0% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 0.1b

bsearch3.0ms

end0.0ms

sample6.3s

Algorithm
intervals
Results
4.3s27997×body80nan
1.3s9181×body80valid