Average Error: 3.2 → 0.3
Time: 15.4s
Precision: 64
Internal Precision: 576
\[\left(\frac{inflow}{lam} + p\right) - \frac{outflow \cdot p}{lam}\]
\[\begin{array}{l} \mathbf{if}\;p \le -4.1600516230761307 \cdot 10^{+113} \lor \neg \left(p \le 1.0818115154476408 \cdot 10^{+35}\right):\\ \;\;\;\;\left(p + \frac{inflow}{lam}\right) - \frac{\frac{1}{\frac{lam}{outflow}}}{\frac{1}{p}}\\ \mathbf{else}:\\ \;\;\;\;\left(p + \frac{inflow}{lam}\right) - \frac{p \cdot outflow}{lam}\\ \end{array}\]

Error

Bits error versus inflow

Bits error versus lam

Bits error versus p

Bits error versus outflow

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if p < -4.1600516230761307e+113 or 1.0818115154476408e+35 < p

    1. Initial program 9.3

      \[\left(\frac{inflow}{lam} + p\right) - \frac{outflow \cdot p}{lam}\]
    2. Initial simplification0.1

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \frac{p}{\frac{lam}{outflow}}\]
    3. Using strategy rm
    4. Applied clear-num0.1

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \color{blue}{\frac{1}{\frac{\frac{lam}{outflow}}{p}}}\]
    5. Using strategy rm
    6. Applied div-inv0.1

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \frac{1}{\color{blue}{\frac{lam}{outflow} \cdot \frac{1}{p}}}\]
    7. Applied associate-/r*0.1

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \color{blue}{\frac{\frac{1}{\frac{lam}{outflow}}}{\frac{1}{p}}}\]

    if -4.1600516230761307e+113 < p < 1.0818115154476408e+35

    1. Initial program 0.4

      \[\left(\frac{inflow}{lam} + p\right) - \frac{outflow \cdot p}{lam}\]
    2. Initial simplification3.2

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \frac{p}{\frac{lam}{outflow}}\]
    3. Using strategy rm
    4. Applied clear-num3.2

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \color{blue}{\frac{1}{\frac{\frac{lam}{outflow}}{p}}}\]
    5. Taylor expanded around 0 0.4

      \[\leadsto \left(p + \frac{inflow}{lam}\right) - \color{blue}{\frac{outflow \cdot p}{lam}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;p \le -4.1600516230761307 \cdot 10^{+113} \lor \neg \left(p \le 1.0818115154476408 \cdot 10^{+35}\right):\\ \;\;\;\;\left(p + \frac{inflow}{lam}\right) - \frac{\frac{1}{\frac{lam}{outflow}}}{\frac{1}{p}}\\ \mathbf{else}:\\ \;\;\;\;\left(p + \frac{inflow}{lam}\right) - \frac{p \cdot outflow}{lam}\\ \end{array}\]

Runtime

Time bar (total: 15.4s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (inflow lam p outflow)
  :name "(inflow/lam + p) - outflow * p / lam"
  (- (+ (/ inflow lam) p) (/ (* outflow p) lam)))