Average Error: 14.4 → 1.9
Time: 4.7s
Precision: 64
Internal Precision: 128
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.325383903299805 \cdot 10^{+174}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -2.440607682399938 \cdot 10^{-278}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 1.1418486332470455 \cdot 10^{-208}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \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 3 regimes
  2. if (/ y z) < -6.325383903299805e+174

    1. Initial program 36.6

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

      \[\leadsto y \cdot \frac{x}{z}\]

    if -6.325383903299805e+174 < (/ y z) < -2.440607682399938e-278 or 1.1418486332470455e-208 < (/ y z)

    1. Initial program 11.0

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Initial simplification8.0

      \[\leadsto y \cdot \frac{x}{z}\]
    3. Using strategy rm
    4. Applied associate-*r/8.9

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}}\]
    7. Using strategy rm
    8. Applied associate-/r/2.4

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

    if -2.440607682399938e-278 < (/ y z) < 1.1418486332470455e-208

    1. Initial program 17.8

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

      \[\leadsto y \cdot \frac{x}{z}\]
    3. Using strategy rm
    4. Applied associate-*r/0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.325383903299805 \cdot 10^{+174}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -2.440607682399938 \cdot 10^{-278}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 1.1418486332470455 \cdot 10^{-208}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2018362 +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: 1.5s)Debug log

start44.0ms

Algorithm
intervals

setup292.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.6b

localize13.0ms

Local error

Found 1 expressions with local error:

6.2b
(* y (/ x z))

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

2.0ms
(* y (/ x z))

series12.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

12.0ms
(* y (/ x z))

simplify22.0ms

Counts
7 → 18
Calls

7 calls. Slowest were:

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

prune171.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 1 expressions with local error:

6.8b
(/ (* y x) z)

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
1 → 13
Calls

1 calls. Slowest were:

4.0ms
(/ (* y x) z)

series19.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

19.0ms
(/ (* y x) z)

simplify16.0ms

Counts
3 → 16
Calls

3 calls. Slowest were:

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

prune154.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 1 expressions with local error:

6.5b
(/ y (/ z x))

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
1 → 17
Calls

1 calls. Slowest were:

1.0ms
(/ y (/ z x))

series13.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

13.0ms
(/ y (/ z x))

simplify23.0ms

Counts
7 → 20
Calls

7 calls. Slowest were:

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

prune174.0ms

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0b

localize5.0ms

Local error

Found 1 expressions with local error:

6.9b
(* (/ y z) x)

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

2.0ms
(* (/ y z) x)

series14.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

13.0ms
(* (/ y z) x)

simplify19.0ms

Counts
6 → 18
Calls

6 calls. Slowest were:

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

prune121.0ms

Pruning

7 alts after pruning (3 fresh and 4 done)

Merged error: 0b

regimes382.0ms

Accuracy

67.7% (1.9b remaining)

Error of 1.9b against oracle of 0.0b and baseline of 5.8b

bsearch3.0ms