Average Error: 14.0 → 0.4
Time: 5.1s
Precision: 64
Internal Precision: 128
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -7.927867421581339 \cdot 10^{+302}:\\ \;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{elif}\;\frac{y}{z} \le -2.4897062515369744 \cdot 10^{-252}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.8633635984892177 \cdot 10^{-289}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{1}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} \le 4.612678511635868 \cdot 10^{+158}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -7.927867421581339e+302

    1. Initial program 58.6

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]
    3. Taylor expanded around 0 0.3

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    4. Using strategy rm
    5. Applied clear-num0.3

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]

    if -7.927867421581339e+302 < (/ y z) < -2.4897062515369744e-252 or 1.8633635984892177e-289 < (/ y z) < 4.612678511635868e+158

    1. Initial program 9.0

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified8.4

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]
    3. Taylor expanded around 0 8.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    4. Using strategy rm
    5. Applied associate-/l*0.2

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]

    if -2.4897062515369744e-252 < (/ y z) < 1.8633635984892177e-289

    1. Initial program 18.4

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified0.1

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied div-inv0.1

      \[\leadsto y \cdot \color{blue}{\left(x \cdot \frac{1}{z}\right)}\]
    5. Applied associate-*r*0.2

      \[\leadsto \color{blue}{\left(y \cdot x\right) \cdot \frac{1}{z}}\]
    6. Using strategy rm
    7. Applied associate-*l*0.1

      \[\leadsto \color{blue}{y \cdot \left(x \cdot \frac{1}{z}\right)}\]

    if 4.612678511635868e+158 < (/ y z)

    1. Initial program 34.0

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified2.3

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -7.927867421581339 \cdot 10^{+302}:\\ \;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{elif}\;\frac{y}{z} \le -2.4897062515369744 \cdot 10^{-252}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.8633635984892177 \cdot 10^{-289}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{1}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} \le 4.612678511635868 \cdot 10^{+158}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019002 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1"
  (* x (/ (* (/ y z) t) t)))

Details

Time bar (total: 4.4s)Debug log

sample53.0ms

Algorithm
intervals

simplify296.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

295.0ms
(* x (/ (* (/ y z) t) t))

prune19.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 1.0b

localize7.0ms

Local error

Found 1 expressions with local error:

5.9b
(* y (/ x z))

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

1.0ms
(* y (/ x z))

series12.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

12.0ms
(* y (/ x z))

simplify28.0ms

Counts
7 → 18
Calls

7 calls. Slowest were:

10.0ms
(/ (* x y) z)
9.0ms
(/ (* x y) z)
5.0ms
(/ (* x y) z)

prune173.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 1 expressions with local error:

6.1b
(/ (* x y) z)

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
1 → 13
Calls

1 calls. Slowest were:

4.0ms
(/ (* x y) z)

series20.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

20.0ms
(/ (* x y) z)

simplify32.0ms

Counts
3 → 16
Calls

3 calls. Slowest were:

10.0ms
(/ (* x y) z)
10.0ms
(/ (* x y) z)
10.0ms
(/ (* x y) z)

prune176.0ms

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 1 expressions with local error:

6.2b
(* (* y x) (/ 1 z))

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
1 → 20
Calls

1 calls. Slowest were:

3.0ms
(* (* y x) (/ 1 z))

series12.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

12.0ms
(* (* y x) (/ 1 z))

simplify682.0ms

Counts
10 → 23
Calls

10 calls. Slowest were:

575.0ms
(* (* (* (* y x) (* y x)) (* y x)) (* (* (/ 1 z) (/ 1 z)) (/ 1 z)))
31.0ms
(+ (log (* y x)) (log (/ 1 z)))
29.0ms
(* (* y x) (/ 1 z))

prune229.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

localize11.0ms

Local error

Found 2 expressions with local error:

5.9b
(* y (* x (/ 1 z)))
0.2b
(* x (/ 1 z))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
2 → 29
Calls

2 calls. Slowest were:

3.0ms
(* y (* x (/ 1 z)))
2.0ms
(* x (/ 1 z))

series24.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

16.0ms
(* y (* x (/ 1 z)))
8.0ms
(* x (/ 1 z))

simplify25.0ms

Counts
11 → 35
Calls

11 calls. Slowest were:

5.0ms
(/ (* x y) z)
5.0ms
(/ (* x y) z)
5.0ms
(/ (* x y) z)

prune248.0ms

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0b

regimes542.0ms

Accuracy

93.9% (0.4b remaining)

Error of 0.4b against oracle of 0.0b and baseline of 6.1b

bsearch6.0ms

end0.0ms

sample1.8s

Algorithm
intervals