Average Error: 15.2 → 10.6
Time: 15.9s
Precision: 64
\[vA + \frac{vB - vA}{tB - tA} \cdot \left(time - tA\right)\]
\[\begin{array}{l} \mathbf{if}\;tB \le -5.713770916810700989556121380181708627338 \cdot 10^{-97} \lor \neg \left(tB \le 1.063735837846953687152913776383080423202 \cdot 10^{-157}\right):\\ \;\;\;\;vA + \left(vB - vA\right) \cdot \frac{time - tA}{tB - tA}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{time \cdot vA}{tA} + vB\right) - \frac{time \cdot vB}{tA}\\ \end{array}\]
vA + \frac{vB - vA}{tB - tA} \cdot \left(time - tA\right)
\begin{array}{l}
\mathbf{if}\;tB \le -5.713770916810700989556121380181708627338 \cdot 10^{-97} \lor \neg \left(tB \le 1.063735837846953687152913776383080423202 \cdot 10^{-157}\right):\\
\;\;\;\;vA + \left(vB - vA\right) \cdot \frac{time - tA}{tB - tA}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{time \cdot vA}{tA} + vB\right) - \frac{time \cdot vB}{tA}\\

\end{array}
double f(double vA, double vB, double tB, double tA, double time) {
        double r568179 = vA;
        double r568180 = vB;
        double r568181 = r568180 - r568179;
        double r568182 = tB;
        double r568183 = tA;
        double r568184 = r568182 - r568183;
        double r568185 = r568181 / r568184;
        double r568186 = time;
        double r568187 = r568186 - r568183;
        double r568188 = r568185 * r568187;
        double r568189 = r568179 + r568188;
        return r568189;
}

double f(double vA, double vB, double tB, double tA, double time) {
        double r568190 = tB;
        double r568191 = -5.713770916810701e-97;
        bool r568192 = r568190 <= r568191;
        double r568193 = 1.0637358378469537e-157;
        bool r568194 = r568190 <= r568193;
        double r568195 = !r568194;
        bool r568196 = r568192 || r568195;
        double r568197 = vA;
        double r568198 = vB;
        double r568199 = r568198 - r568197;
        double r568200 = time;
        double r568201 = tA;
        double r568202 = r568200 - r568201;
        double r568203 = r568190 - r568201;
        double r568204 = r568202 / r568203;
        double r568205 = r568199 * r568204;
        double r568206 = r568197 + r568205;
        double r568207 = r568200 * r568197;
        double r568208 = r568207 / r568201;
        double r568209 = r568208 + r568198;
        double r568210 = r568200 * r568198;
        double r568211 = r568210 / r568201;
        double r568212 = r568209 - r568211;
        double r568213 = r568196 ? r568206 : r568212;
        return r568213;
}

Error

Bits error versus vA

Bits error versus vB

Bits error versus tB

Bits error versus tA

Bits error versus time

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if tB < -5.713770916810701e-97 or 1.0637358378469537e-157 < tB

    1. Initial program 11.5

      \[vA + \frac{vB - vA}{tB - tA} \cdot \left(time - tA\right)\]
    2. Using strategy rm
    3. Applied div-inv11.6

      \[\leadsto vA + \color{blue}{\left(\left(vB - vA\right) \cdot \frac{1}{tB - tA}\right)} \cdot \left(time - tA\right)\]
    4. Applied associate-*l*9.3

      \[\leadsto vA + \color{blue}{\left(vB - vA\right) \cdot \left(\frac{1}{tB - tA} \cdot \left(time - tA\right)\right)}\]
    5. Simplified9.2

      \[\leadsto vA + \left(vB - vA\right) \cdot \color{blue}{\frac{time - tA}{tB - tA}}\]

    if -5.713770916810701e-97 < tB < 1.0637358378469537e-157

    1. Initial program 25.5

      \[vA + \frac{vB - vA}{tB - tA} \cdot \left(time - tA\right)\]
    2. Using strategy rm
    3. Applied div-inv25.6

      \[\leadsto vA + \color{blue}{\left(\left(vB - vA\right) \cdot \frac{1}{tB - tA}\right)} \cdot \left(time - tA\right)\]
    4. Applied associate-*l*20.1

      \[\leadsto vA + \color{blue}{\left(vB - vA\right) \cdot \left(\frac{1}{tB - tA} \cdot \left(time - tA\right)\right)}\]
    5. Simplified20.0

      \[\leadsto vA + \left(vB - vA\right) \cdot \color{blue}{\frac{time - tA}{tB - tA}}\]
    6. Taylor expanded around inf 14.5

      \[\leadsto \color{blue}{\left(\frac{time \cdot vA}{tA} + vB\right) - \frac{time \cdot vB}{tA}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;tB \le -5.713770916810700989556121380181708627338 \cdot 10^{-97} \lor \neg \left(tB \le 1.063735837846953687152913776383080423202 \cdot 10^{-157}\right):\\ \;\;\;\;vA + \left(vB - vA\right) \cdot \frac{time - tA}{tB - tA}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{time \cdot vA}{tA} + vB\right) - \frac{time \cdot vB}{tA}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (vA vB tB tA time)
  :name "vA + ((vB - vA) / (tB - tA)) * (time - tA)"
  :precision binary64
  (+ vA (* (/ (- vB vA) (- tB tA)) (- time tA))))