Average Error: 14.6 → 8.2
Time: 28.3s
Precision: 64
Internal Precision: 2112
\[y1 + \frac{y2 - y1}{x2 - x1} \cdot \left(x - x1\right)\]
\[\begin{array}{l} \mathbf{if}\;\left(x - x1\right) \cdot \frac{y2 - y1}{x2 - x1} + y1 \le -4.437328535837823 \cdot 10^{-151}:\\ \;\;\;\;\sqrt[3]{y2 - y1} \cdot \left(\frac{x - x1}{x2 - x1} \cdot \left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right)\right) + y1\\ \mathbf{elif}\;\left(x - x1\right) \cdot \frac{y2 - y1}{x2 - x1} + y1 \le 0.0:\\ \;\;\;\;y2 + \left(y1 - y2\right) \cdot \frac{x}{x1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{y2 - y1} \cdot \left(\frac{x - x1}{x2 - x1} \cdot \left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right)\right) + y1\\ \end{array}\]

Error

Bits error versus y1

Bits error versus y2

Bits error versus x2

Bits error versus x1

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (+ y1 (* (/ (- y2 y1) (- x2 x1)) (- x x1))) < -4.437328535837823e-151 or 0.0 < (+ y1 (* (/ (- y2 y1) (- x2 x1)) (- x x1)))

    1. Initial program 6.4

      \[y1 + \frac{y2 - y1}{x2 - x1} \cdot \left(x - x1\right)\]
    2. Initial simplification4.0

      \[\leadsto \frac{x - x1}{x2 - x1} \cdot \left(y2 - y1\right) + y1\]
    3. Using strategy rm
    4. Applied add-cube-cbrt4.7

      \[\leadsto \frac{x - x1}{x2 - x1} \cdot \color{blue}{\left(\left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right) \cdot \sqrt[3]{y2 - y1}\right)} + y1\]
    5. Applied associate-*r*4.7

      \[\leadsto \color{blue}{\left(\frac{x - x1}{x2 - x1} \cdot \left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right)\right) \cdot \sqrt[3]{y2 - y1}} + y1\]

    if -4.437328535837823e-151 < (+ y1 (* (/ (- y2 y1) (- x2 x1)) (- x x1))) < 0.0

    1. Initial program 53.4

      \[y1 + \frac{y2 - y1}{x2 - x1} \cdot \left(x - x1\right)\]
    2. Initial simplification49.1

      \[\leadsto \frac{x - x1}{x2 - x1} \cdot \left(y2 - y1\right) + y1\]
    3. Taylor expanded around -inf 28.7

      \[\leadsto \color{blue}{\left(y2 + \frac{x \cdot y1}{x1}\right) - \frac{y2 \cdot x}{x1}}\]
    4. Simplified24.5

      \[\leadsto \color{blue}{y2 + \frac{x}{x1} \cdot \left(y1 - y2\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x - x1\right) \cdot \frac{y2 - y1}{x2 - x1} + y1 \le -4.437328535837823 \cdot 10^{-151}:\\ \;\;\;\;\sqrt[3]{y2 - y1} \cdot \left(\frac{x - x1}{x2 - x1} \cdot \left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right)\right) + y1\\ \mathbf{elif}\;\left(x - x1\right) \cdot \frac{y2 - y1}{x2 - x1} + y1 \le 0.0:\\ \;\;\;\;y2 + \left(y1 - y2\right) \cdot \frac{x}{x1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{y2 - y1} \cdot \left(\frac{x - x1}{x2 - x1} \cdot \left(\sqrt[3]{y2 - y1} \cdot \sqrt[3]{y2 - y1}\right)\right) + y1\\ \end{array}\]

Runtime

Time bar (total: 28.3s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (y1 y2 x2 x1 x)
  :name "y1 + (y2-y1)/(x2-x1) * (x - x1)"
  (+ y1 (* (/ (- y2 y1) (- x2 x1)) (- x x1))))