(vel-velAxis)*0.05+(pos-poxAxis)*300

Percentage Accurate: 99.9% → 99.9%
Time: 6.1s
Alternatives: 14
Speedup: 1.1×

Specification

?
\[\left(\left(\left(-10000000000 \leq vel \land vel \leq 10000000000\right) \land \left(-10000000000 \leq velAxis \land velAxis \leq 10000000000\right)\right) \land \left(-10000000000 \leq pos \land pos \leq 10000000000\right)\right) \land \left(-10000000000 \leq poxAxis \land poxAxis \leq 10000000000\right)\]
\[\begin{array}{l} \\ \left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (+ (* (- vel velAxis) 0.05) (* (- pos poxAxis) 300.0)))
double code(double vel, double velAxis, double pos, double poxAxis) {
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
}
real(8) function code(vel, velaxis, pos, poxaxis)
    real(8), intent (in) :: vel
    real(8), intent (in) :: velaxis
    real(8), intent (in) :: pos
    real(8), intent (in) :: poxaxis
    code = ((vel - velaxis) * 0.05d0) + ((pos - poxaxis) * 300.0d0)
end function
public static double code(double vel, double velAxis, double pos, double poxAxis) {
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
}
def code(vel, velAxis, pos, poxAxis):
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0)
function code(vel, velAxis, pos, poxAxis)
	return Float64(Float64(Float64(vel - velAxis) * 0.05) + Float64(Float64(pos - poxAxis) * 300.0))
end
function tmp = code(vel, velAxis, pos, poxAxis)
	tmp = ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
end
code[vel_, velAxis_, pos_, poxAxis_] := N[(N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision] + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (+ (* (- vel velAxis) 0.05) (* (- pos poxAxis) 300.0)))
double code(double vel, double velAxis, double pos, double poxAxis) {
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
}
real(8) function code(vel, velaxis, pos, poxaxis)
    real(8), intent (in) :: vel
    real(8), intent (in) :: velaxis
    real(8), intent (in) :: pos
    real(8), intent (in) :: poxaxis
    code = ((vel - velaxis) * 0.05d0) + ((pos - poxaxis) * 300.0d0)
end function
public static double code(double vel, double velAxis, double pos, double poxAxis) {
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
}
def code(vel, velAxis, pos, poxAxis):
	return ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0)
function code(vel, velAxis, pos, poxAxis)
	return Float64(Float64(Float64(vel - velAxis) * 0.05) + Float64(Float64(pos - poxAxis) * 300.0))
end
function tmp = code(vel, velAxis, pos, poxAxis)
	tmp = ((vel - velAxis) * 0.05) + ((pos - poxAxis) * 300.0);
end
code[vel_, velAxis_, pos_, poxAxis_] := N[(N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision] + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (fma vel 0.05 (fma -0.05 velAxis (* (- pos poxAxis) 300.0))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	return fma(vel, 0.05, fma(-0.05, velAxis, ((pos - poxAxis) * 300.0)));
}
function code(vel, velAxis, pos, poxAxis)
	return fma(vel, 0.05, fma(-0.05, velAxis, Float64(Float64(pos - poxAxis) * 300.0)))
end
code[vel_, velAxis_, pos_, poxAxis_] := N[(vel * 0.05 + N[(-0.05 * velAxis + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
    2. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
    3. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
    4. lift--.f64N/A

      \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
    5. sub-negN/A

      \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel + \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
    6. distribute-lft-inN/A

      \[\leadsto \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot vel + \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
    7. associate-+l+N/A

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
    8. *-commutativeN/A

      \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right) \]
    9. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
    10. neg-mul-1N/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(-1 \cdot velAxis\right)} + \left(pos - poxAxis\right) \cdot 300\right) \]
    11. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot -1\right) \cdot velAxis} + \left(pos - poxAxis\right) \cdot 300\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936}} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right)\right)} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
    14. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right), velAxis, \left(pos - poxAxis\right) \cdot 300\right)}\right) \]
    15. metadata-eval100.0

      \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(\color{blue}{-0.05}, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
    16. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right)\right) \]
    17. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
    18. lower-*.f64100.0

      \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, 300 \cdot \left(pos - poxAxis\right)\right)\right)} \]
  5. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
  6. Add Preprocessing

Alternative 2: 41.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{elif}\;pos \leq 4.9 \cdot 10^{-279}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-175}:\\ \;\;\;\;0.05 \cdot vel\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (if (<= pos -9.8e-118)
   (* pos 300.0)
   (if (<= pos -2.5e-144)
     (* -300.0 poxAxis)
     (if (<= pos -1.8e-253)
       (* velAxis -0.05)
       (if (<= pos 4.9e-279)
         (* -300.0 poxAxis)
         (if (<= pos 3.5e-175)
           (* 0.05 vel)
           (if (<= pos 3.5e-112) (* velAxis -0.05) (* pos 300.0))))))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (pos <= -9.8e-118) {
		tmp = pos * 300.0;
	} else if (pos <= -2.5e-144) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= -1.8e-253) {
		tmp = velAxis * -0.05;
	} else if (pos <= 4.9e-279) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= 3.5e-175) {
		tmp = 0.05 * vel;
	} else if (pos <= 3.5e-112) {
		tmp = velAxis * -0.05;
	} else {
		tmp = pos * 300.0;
	}
	return tmp;
}
real(8) function code(vel, velaxis, pos, poxaxis)
    real(8), intent (in) :: vel
    real(8), intent (in) :: velaxis
    real(8), intent (in) :: pos
    real(8), intent (in) :: poxaxis
    real(8) :: tmp
    if (pos <= (-9.8d-118)) then
        tmp = pos * 300.0d0
    else if (pos <= (-2.5d-144)) then
        tmp = (-300.0d0) * poxaxis
    else if (pos <= (-1.8d-253)) then
        tmp = velaxis * (-0.05d0)
    else if (pos <= 4.9d-279) then
        tmp = (-300.0d0) * poxaxis
    else if (pos <= 3.5d-175) then
        tmp = 0.05d0 * vel
    else if (pos <= 3.5d-112) then
        tmp = velaxis * (-0.05d0)
    else
        tmp = pos * 300.0d0
    end if
    code = tmp
end function
public static double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (pos <= -9.8e-118) {
		tmp = pos * 300.0;
	} else if (pos <= -2.5e-144) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= -1.8e-253) {
		tmp = velAxis * -0.05;
	} else if (pos <= 4.9e-279) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= 3.5e-175) {
		tmp = 0.05 * vel;
	} else if (pos <= 3.5e-112) {
		tmp = velAxis * -0.05;
	} else {
		tmp = pos * 300.0;
	}
	return tmp;
}
def code(vel, velAxis, pos, poxAxis):
	tmp = 0
	if pos <= -9.8e-118:
		tmp = pos * 300.0
	elif pos <= -2.5e-144:
		tmp = -300.0 * poxAxis
	elif pos <= -1.8e-253:
		tmp = velAxis * -0.05
	elif pos <= 4.9e-279:
		tmp = -300.0 * poxAxis
	elif pos <= 3.5e-175:
		tmp = 0.05 * vel
	elif pos <= 3.5e-112:
		tmp = velAxis * -0.05
	else:
		tmp = pos * 300.0
	return tmp
function code(vel, velAxis, pos, poxAxis)
	tmp = 0.0
	if (pos <= -9.8e-118)
		tmp = Float64(pos * 300.0);
	elseif (pos <= -2.5e-144)
		tmp = Float64(-300.0 * poxAxis);
	elseif (pos <= -1.8e-253)
		tmp = Float64(velAxis * -0.05);
	elseif (pos <= 4.9e-279)
		tmp = Float64(-300.0 * poxAxis);
	elseif (pos <= 3.5e-175)
		tmp = Float64(0.05 * vel);
	elseif (pos <= 3.5e-112)
		tmp = Float64(velAxis * -0.05);
	else
		tmp = Float64(pos * 300.0);
	end
	return tmp
end
function tmp_2 = code(vel, velAxis, pos, poxAxis)
	tmp = 0.0;
	if (pos <= -9.8e-118)
		tmp = pos * 300.0;
	elseif (pos <= -2.5e-144)
		tmp = -300.0 * poxAxis;
	elseif (pos <= -1.8e-253)
		tmp = velAxis * -0.05;
	elseif (pos <= 4.9e-279)
		tmp = -300.0 * poxAxis;
	elseif (pos <= 3.5e-175)
		tmp = 0.05 * vel;
	elseif (pos <= 3.5e-112)
		tmp = velAxis * -0.05;
	else
		tmp = pos * 300.0;
	end
	tmp_2 = tmp;
end
code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[pos, -9.8e-118], N[(pos * 300.0), $MachinePrecision], If[LessEqual[pos, -2.5e-144], N[(-300.0 * poxAxis), $MachinePrecision], If[LessEqual[pos, -1.8e-253], N[(velAxis * -0.05), $MachinePrecision], If[LessEqual[pos, 4.9e-279], N[(-300.0 * poxAxis), $MachinePrecision], If[LessEqual[pos, 3.5e-175], N[(0.05 * vel), $MachinePrecision], If[LessEqual[pos, 3.5e-112], N[(velAxis * -0.05), $MachinePrecision], N[(pos * 300.0), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\
\;\;\;\;pos \cdot 300\\

\mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\
\;\;\;\;-300 \cdot poxAxis\\

\mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\
\;\;\;\;velAxis \cdot -0.05\\

\mathbf{elif}\;pos \leq 4.9 \cdot 10^{-279}:\\
\;\;\;\;-300 \cdot poxAxis\\

\mathbf{elif}\;pos \leq 3.5 \cdot 10^{-175}:\\
\;\;\;\;0.05 \cdot vel\\

\mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\
\;\;\;\;velAxis \cdot -0.05\\

\mathbf{else}:\\
\;\;\;\;pos \cdot 300\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if pos < -9.7999999999999995e-118 or 3.49999999999999994e-112 < pos

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around inf

      \[\leadsto \color{blue}{300 \cdot pos} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{pos \cdot 300} \]
      2. lower-*.f6459.2

        \[\leadsto \color{blue}{pos \cdot 300} \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{pos \cdot 300} \]

    if -9.7999999999999995e-118 < pos < -2.4999999999999999e-144 or -1.8e-253 < pos < 4.89999999999999974e-279

    1. Initial program 100.0%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in poxAxis around inf

      \[\leadsto \color{blue}{-300 \cdot poxAxis} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} \]
      2. lower-*.f6454.9

        \[\leadsto \color{blue}{poxAxis \cdot -300} \]
    5. Applied rewrites54.9%

      \[\leadsto \color{blue}{poxAxis \cdot -300} \]

    if -2.4999999999999999e-144 < pos < -1.8e-253 or 3.49999999999999999e-175 < pos < 3.49999999999999994e-112

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in velAxis around inf

      \[\leadsto \color{blue}{\frac{-3602879701896397}{72057594037927936} \cdot velAxis} \]
    4. Step-by-step derivation
      1. lower-*.f6457.4

        \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
    5. Applied rewrites57.4%

      \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]

    if 4.89999999999999974e-279 < pos < 3.49999999999999999e-175

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in vel around inf

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} \]
      2. lower-*.f6452.8

        \[\leadsto \color{blue}{vel \cdot 0.05} \]
    5. Applied rewrites52.8%

      \[\leadsto \color{blue}{vel \cdot 0.05} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification57.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{elif}\;pos \leq 4.9 \cdot 10^{-279}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-175}:\\ \;\;\;\;0.05 \cdot vel\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 41.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{elif}\;pos \leq 3.4 \cdot 10^{-190}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (if (<= pos -9.8e-118)
   (* pos 300.0)
   (if (<= pos -2.5e-144)
     (* -300.0 poxAxis)
     (if (<= pos -1.8e-253)
       (* velAxis -0.05)
       (if (<= pos 3.4e-190)
         (* -300.0 poxAxis)
         (if (<= pos 3.5e-112) (* velAxis -0.05) (* pos 300.0)))))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (pos <= -9.8e-118) {
		tmp = pos * 300.0;
	} else if (pos <= -2.5e-144) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= -1.8e-253) {
		tmp = velAxis * -0.05;
	} else if (pos <= 3.4e-190) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= 3.5e-112) {
		tmp = velAxis * -0.05;
	} else {
		tmp = pos * 300.0;
	}
	return tmp;
}
real(8) function code(vel, velaxis, pos, poxaxis)
    real(8), intent (in) :: vel
    real(8), intent (in) :: velaxis
    real(8), intent (in) :: pos
    real(8), intent (in) :: poxaxis
    real(8) :: tmp
    if (pos <= (-9.8d-118)) then
        tmp = pos * 300.0d0
    else if (pos <= (-2.5d-144)) then
        tmp = (-300.0d0) * poxaxis
    else if (pos <= (-1.8d-253)) then
        tmp = velaxis * (-0.05d0)
    else if (pos <= 3.4d-190) then
        tmp = (-300.0d0) * poxaxis
    else if (pos <= 3.5d-112) then
        tmp = velaxis * (-0.05d0)
    else
        tmp = pos * 300.0d0
    end if
    code = tmp
end function
public static double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (pos <= -9.8e-118) {
		tmp = pos * 300.0;
	} else if (pos <= -2.5e-144) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= -1.8e-253) {
		tmp = velAxis * -0.05;
	} else if (pos <= 3.4e-190) {
		tmp = -300.0 * poxAxis;
	} else if (pos <= 3.5e-112) {
		tmp = velAxis * -0.05;
	} else {
		tmp = pos * 300.0;
	}
	return tmp;
}
def code(vel, velAxis, pos, poxAxis):
	tmp = 0
	if pos <= -9.8e-118:
		tmp = pos * 300.0
	elif pos <= -2.5e-144:
		tmp = -300.0 * poxAxis
	elif pos <= -1.8e-253:
		tmp = velAxis * -0.05
	elif pos <= 3.4e-190:
		tmp = -300.0 * poxAxis
	elif pos <= 3.5e-112:
		tmp = velAxis * -0.05
	else:
		tmp = pos * 300.0
	return tmp
function code(vel, velAxis, pos, poxAxis)
	tmp = 0.0
	if (pos <= -9.8e-118)
		tmp = Float64(pos * 300.0);
	elseif (pos <= -2.5e-144)
		tmp = Float64(-300.0 * poxAxis);
	elseif (pos <= -1.8e-253)
		tmp = Float64(velAxis * -0.05);
	elseif (pos <= 3.4e-190)
		tmp = Float64(-300.0 * poxAxis);
	elseif (pos <= 3.5e-112)
		tmp = Float64(velAxis * -0.05);
	else
		tmp = Float64(pos * 300.0);
	end
	return tmp
end
function tmp_2 = code(vel, velAxis, pos, poxAxis)
	tmp = 0.0;
	if (pos <= -9.8e-118)
		tmp = pos * 300.0;
	elseif (pos <= -2.5e-144)
		tmp = -300.0 * poxAxis;
	elseif (pos <= -1.8e-253)
		tmp = velAxis * -0.05;
	elseif (pos <= 3.4e-190)
		tmp = -300.0 * poxAxis;
	elseif (pos <= 3.5e-112)
		tmp = velAxis * -0.05;
	else
		tmp = pos * 300.0;
	end
	tmp_2 = tmp;
end
code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[pos, -9.8e-118], N[(pos * 300.0), $MachinePrecision], If[LessEqual[pos, -2.5e-144], N[(-300.0 * poxAxis), $MachinePrecision], If[LessEqual[pos, -1.8e-253], N[(velAxis * -0.05), $MachinePrecision], If[LessEqual[pos, 3.4e-190], N[(-300.0 * poxAxis), $MachinePrecision], If[LessEqual[pos, 3.5e-112], N[(velAxis * -0.05), $MachinePrecision], N[(pos * 300.0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\
\;\;\;\;pos \cdot 300\\

\mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\
\;\;\;\;-300 \cdot poxAxis\\

\mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\
\;\;\;\;velAxis \cdot -0.05\\

\mathbf{elif}\;pos \leq 3.4 \cdot 10^{-190}:\\
\;\;\;\;-300 \cdot poxAxis\\

\mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\
\;\;\;\;velAxis \cdot -0.05\\

\mathbf{else}:\\
\;\;\;\;pos \cdot 300\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if pos < -9.7999999999999995e-118 or 3.49999999999999994e-112 < pos

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around inf

      \[\leadsto \color{blue}{300 \cdot pos} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{pos \cdot 300} \]
      2. lower-*.f6459.2

        \[\leadsto \color{blue}{pos \cdot 300} \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{pos \cdot 300} \]

    if -9.7999999999999995e-118 < pos < -2.4999999999999999e-144 or -1.8e-253 < pos < 3.39999999999999981e-190

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in poxAxis around inf

      \[\leadsto \color{blue}{-300 \cdot poxAxis} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} \]
      2. lower-*.f6445.9

        \[\leadsto \color{blue}{poxAxis \cdot -300} \]
    5. Applied rewrites45.9%

      \[\leadsto \color{blue}{poxAxis \cdot -300} \]

    if -2.4999999999999999e-144 < pos < -1.8e-253 or 3.39999999999999981e-190 < pos < 3.49999999999999994e-112

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in velAxis around inf

      \[\leadsto \color{blue}{\frac{-3602879701896397}{72057594037927936} \cdot velAxis} \]
    4. Step-by-step derivation
      1. lower-*.f6454.3

        \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
    5. Applied rewrites54.3%

      \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;pos \leq -9.8 \cdot 10^{-118}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq -2.5 \cdot 10^{-144}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq -1.8 \cdot 10^{-253}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{elif}\;pos \leq 3.4 \cdot 10^{-190}:\\ \;\;\;\;-300 \cdot poxAxis\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 90.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\ \;\;\;\;\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, pos \cdot 300\right)\right)\\ \mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(vel, 0.05, \left(pos - poxAxis\right) \cdot 300\right)\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (if (<= pos -2.5e-116)
   (fma vel 0.05 (fma -0.05 velAxis (* pos 300.0)))
   (if (<= pos 1.65e-112)
     (fma poxAxis -300.0 (* (- vel velAxis) 0.05))
     (fma vel 0.05 (* (- pos poxAxis) 300.0)))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (pos <= -2.5e-116) {
		tmp = fma(vel, 0.05, fma(-0.05, velAxis, (pos * 300.0)));
	} else if (pos <= 1.65e-112) {
		tmp = fma(poxAxis, -300.0, ((vel - velAxis) * 0.05));
	} else {
		tmp = fma(vel, 0.05, ((pos - poxAxis) * 300.0));
	}
	return tmp;
}
function code(vel, velAxis, pos, poxAxis)
	tmp = 0.0
	if (pos <= -2.5e-116)
		tmp = fma(vel, 0.05, fma(-0.05, velAxis, Float64(pos * 300.0)));
	elseif (pos <= 1.65e-112)
		tmp = fma(poxAxis, -300.0, Float64(Float64(vel - velAxis) * 0.05));
	else
		tmp = fma(vel, 0.05, Float64(Float64(pos - poxAxis) * 300.0));
	end
	return tmp
end
code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[pos, -2.5e-116], N[(vel * 0.05 + N[(-0.05 * velAxis + N[(pos * 300.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[pos, 1.65e-112], N[(poxAxis * -300.0 + N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]), $MachinePrecision], N[(vel * 0.05 + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, pos \cdot 300\right)\right)\\

\mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\
\;\;\;\;\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(vel, 0.05, \left(pos - poxAxis\right) \cdot 300\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if pos < -2.5000000000000001e-116

    1. Initial program 99.8%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      4. lift--.f64N/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      5. sub-negN/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel + \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      6. distribute-lft-inN/A

        \[\leadsto \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot vel + \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(-1 \cdot velAxis\right)} + \left(pos - poxAxis\right) \cdot 300\right) \]
      11. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot -1\right) \cdot velAxis} + \left(pos - poxAxis\right) \cdot 300\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936}} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right)\right)} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right), velAxis, \left(pos - poxAxis\right) \cdot 300\right)}\right) \]
      15. metadata-eval99.9

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(\color{blue}{-0.05}, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
      18. lower-*.f6499.9

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, 300 \cdot \left(pos - poxAxis\right)\right)\right)} \]
    5. Taylor expanded in poxAxis around 0

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot pos}\right)\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{pos \cdot 300}\right)\right) \]
      2. lower-*.f6491.7

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{pos \cdot 300}\right)\right) \]
    7. Applied rewrites91.7%

      \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{pos \cdot 300}\right)\right) \]

    if -2.5000000000000001e-116 < pos < 1.65e-112

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around 0

      \[\leadsto \color{blue}{-300 \cdot poxAxis + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower--.f6496.9

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if 1.65e-112 < pos

    1. Initial program 100.0%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      4. lift--.f64N/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      5. sub-negN/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel + \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      6. distribute-lft-inN/A

        \[\leadsto \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot vel + \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(-1 \cdot velAxis\right)} + \left(pos - poxAxis\right) \cdot 300\right) \]
      11. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot -1\right) \cdot velAxis} + \left(pos - poxAxis\right) \cdot 300\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936}} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right)\right)} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right), velAxis, \left(pos - poxAxis\right) \cdot 300\right)}\right) \]
      15. metadata-eval100.0

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(\color{blue}{-0.05}, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
      18. lower-*.f64100.0

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, 300 \cdot \left(pos - poxAxis\right)\right)\right)} \]
    5. Taylor expanded in velAxis around 0

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
      3. lower--.f6490.3

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{\left(pos - poxAxis\right)} \cdot 300\right) \]
    7. Applied rewrites90.3%

      \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 90.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(vel - velAxis\right) \cdot 0.05\\ \mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\ \;\;\;\;\mathsf{fma}\left(pos, 300, t\_0\right)\\ \mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(vel, 0.05, \left(pos - poxAxis\right) \cdot 300\right)\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (let* ((t_0 (* (- vel velAxis) 0.05)))
   (if (<= pos -2.5e-116)
     (fma pos 300.0 t_0)
     (if (<= pos 1.65e-112)
       (fma poxAxis -300.0 t_0)
       (fma vel 0.05 (* (- pos poxAxis) 300.0))))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double t_0 = (vel - velAxis) * 0.05;
	double tmp;
	if (pos <= -2.5e-116) {
		tmp = fma(pos, 300.0, t_0);
	} else if (pos <= 1.65e-112) {
		tmp = fma(poxAxis, -300.0, t_0);
	} else {
		tmp = fma(vel, 0.05, ((pos - poxAxis) * 300.0));
	}
	return tmp;
}
function code(vel, velAxis, pos, poxAxis)
	t_0 = Float64(Float64(vel - velAxis) * 0.05)
	tmp = 0.0
	if (pos <= -2.5e-116)
		tmp = fma(pos, 300.0, t_0);
	elseif (pos <= 1.65e-112)
		tmp = fma(poxAxis, -300.0, t_0);
	else
		tmp = fma(vel, 0.05, Float64(Float64(pos - poxAxis) * 300.0));
	end
	return tmp
end
code[vel_, velAxis_, pos_, poxAxis_] := Block[{t$95$0 = N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]}, If[LessEqual[pos, -2.5e-116], N[(pos * 300.0 + t$95$0), $MachinePrecision], If[LessEqual[pos, 1.65e-112], N[(poxAxis * -300.0 + t$95$0), $MachinePrecision], N[(vel * 0.05 + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(vel - velAxis\right) \cdot 0.05\\
\mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(pos, 300, t\_0\right)\\

\mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\
\;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(vel, 0.05, \left(pos - poxAxis\right) \cdot 300\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if pos < -2.5000000000000001e-116

    1. Initial program 99.8%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in poxAxis around 0

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      6. lower--.f6491.6

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites91.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if -2.5000000000000001e-116 < pos < 1.65e-112

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around 0

      \[\leadsto \color{blue}{-300 \cdot poxAxis + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower--.f6496.9

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if 1.65e-112 < pos

    1. Initial program 100.0%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      4. lift--.f64N/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      5. sub-negN/A

        \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel + \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      6. distribute-lft-inN/A

        \[\leadsto \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot vel + \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(-1 \cdot velAxis\right)} + \left(pos - poxAxis\right) \cdot 300\right) \]
      11. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot -1\right) \cdot velAxis} + \left(pos - poxAxis\right) \cdot 300\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936}} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right)\right)} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right), velAxis, \left(pos - poxAxis\right) \cdot 300\right)}\right) \]
      15. metadata-eval100.0

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(\color{blue}{-0.05}, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
      18. lower-*.f64100.0

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, 300 \cdot \left(pos - poxAxis\right)\right)\right)} \]
    5. Taylor expanded in velAxis around 0

      \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
      3. lower--.f6490.3

        \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{\left(pos - poxAxis\right)} \cdot 300\right) \]
    7. Applied rewrites90.3%

      \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 90.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(vel - velAxis\right) \cdot 0.05\\ \mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\ \;\;\;\;\mathsf{fma}\left(pos, 300, t\_0\right)\\ \mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(pos - poxAxis, 300, 0.05 \cdot vel\right)\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (let* ((t_0 (* (- vel velAxis) 0.05)))
   (if (<= pos -2.5e-116)
     (fma pos 300.0 t_0)
     (if (<= pos 1.65e-112)
       (fma poxAxis -300.0 t_0)
       (fma (- pos poxAxis) 300.0 (* 0.05 vel))))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double t_0 = (vel - velAxis) * 0.05;
	double tmp;
	if (pos <= -2.5e-116) {
		tmp = fma(pos, 300.0, t_0);
	} else if (pos <= 1.65e-112) {
		tmp = fma(poxAxis, -300.0, t_0);
	} else {
		tmp = fma((pos - poxAxis), 300.0, (0.05 * vel));
	}
	return tmp;
}
function code(vel, velAxis, pos, poxAxis)
	t_0 = Float64(Float64(vel - velAxis) * 0.05)
	tmp = 0.0
	if (pos <= -2.5e-116)
		tmp = fma(pos, 300.0, t_0);
	elseif (pos <= 1.65e-112)
		tmp = fma(poxAxis, -300.0, t_0);
	else
		tmp = fma(Float64(pos - poxAxis), 300.0, Float64(0.05 * vel));
	end
	return tmp
end
code[vel_, velAxis_, pos_, poxAxis_] := Block[{t$95$0 = N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]}, If[LessEqual[pos, -2.5e-116], N[(pos * 300.0 + t$95$0), $MachinePrecision], If[LessEqual[pos, 1.65e-112], N[(poxAxis * -300.0 + t$95$0), $MachinePrecision], N[(N[(pos - poxAxis), $MachinePrecision] * 300.0 + N[(0.05 * vel), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(vel - velAxis\right) \cdot 0.05\\
\mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(pos, 300, t\_0\right)\\

\mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\
\;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(pos - poxAxis, 300, 0.05 \cdot vel\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if pos < -2.5000000000000001e-116

    1. Initial program 99.8%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in poxAxis around 0

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      6. lower--.f6491.6

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites91.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if -2.5000000000000001e-116 < pos < 1.65e-112

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around 0

      \[\leadsto \color{blue}{-300 \cdot poxAxis + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower--.f6496.9

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if 1.65e-112 < pos

    1. Initial program 100.0%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in velAxis around 0

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + 300 \cdot \left(pos - poxAxis\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{300 \cdot \left(pos - poxAxis\right) + \frac{3602879701896397}{72057594037927936} \cdot vel} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(pos - poxAxis\right) \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot vel \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right)} \]
      4. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{pos - poxAxis}, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      6. lower-*.f6490.3

        \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot 0.05}\right) \]
    5. Applied rewrites90.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, vel \cdot 0.05\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\ \;\;\;\;\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)\\ \mathbf{elif}\;pos \leq 1.65 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(pos - poxAxis, 300, 0.05 \cdot vel\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 90.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(vel - velAxis\right) \cdot 0.05\\ t_1 := \mathsf{fma}\left(pos, 300, t\_0\right)\\ \mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;pos \leq 7.5 \cdot 10^{-120}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (let* ((t_0 (* (- vel velAxis) 0.05)) (t_1 (fma pos 300.0 t_0)))
   (if (<= pos -2.5e-116)
     t_1
     (if (<= pos 7.5e-120) (fma poxAxis -300.0 t_0) t_1))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double t_0 = (vel - velAxis) * 0.05;
	double t_1 = fma(pos, 300.0, t_0);
	double tmp;
	if (pos <= -2.5e-116) {
		tmp = t_1;
	} else if (pos <= 7.5e-120) {
		tmp = fma(poxAxis, -300.0, t_0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(vel, velAxis, pos, poxAxis)
	t_0 = Float64(Float64(vel - velAxis) * 0.05)
	t_1 = fma(pos, 300.0, t_0)
	tmp = 0.0
	if (pos <= -2.5e-116)
		tmp = t_1;
	elseif (pos <= 7.5e-120)
		tmp = fma(poxAxis, -300.0, t_0);
	else
		tmp = t_1;
	end
	return tmp
end
code[vel_, velAxis_, pos_, poxAxis_] := Block[{t$95$0 = N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]}, Block[{t$95$1 = N[(pos * 300.0 + t$95$0), $MachinePrecision]}, If[LessEqual[pos, -2.5e-116], t$95$1, If[LessEqual[pos, 7.5e-120], N[(poxAxis * -300.0 + t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(vel - velAxis\right) \cdot 0.05\\
t_1 := \mathsf{fma}\left(pos, 300, t\_0\right)\\
\mathbf{if}\;pos \leq -2.5 \cdot 10^{-116}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;pos \leq 7.5 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(poxAxis, -300, t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if pos < -2.5000000000000001e-116 or 7.5000000000000004e-120 < pos

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in poxAxis around 0

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      6. lower--.f6490.0

        \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites90.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

    if -2.5000000000000001e-116 < pos < 7.5000000000000004e-120

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in pos around 0

      \[\leadsto \color{blue}{-300 \cdot poxAxis + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{poxAxis \cdot -300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      5. lower--.f6496.9

        \[\leadsto \mathsf{fma}\left(poxAxis, -300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
    5. Applied rewrites96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(poxAxis, -300, \left(vel - velAxis\right) \cdot 0.05\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 84.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;poxAxis \leq -7.6 \cdot 10^{-49}:\\ \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\ \mathbf{elif}\;poxAxis \leq 4.15 \cdot 10^{-88}:\\ \;\;\;\;\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, 0.05 \cdot vel\right)\\ \end{array} \end{array} \]
(FPCore (vel velAxis pos poxAxis)
 :precision binary64
 (if (<= poxAxis -7.6e-49)
   (* (- pos poxAxis) 300.0)
   (if (<= poxAxis 4.15e-88)
     (fma pos 300.0 (* (- vel velAxis) 0.05))
     (fma poxAxis -300.0 (* 0.05 vel)))))
double code(double vel, double velAxis, double pos, double poxAxis) {
	double tmp;
	if (poxAxis <= -7.6e-49) {
		tmp = (pos - poxAxis) * 300.0;
	} else if (poxAxis <= 4.15e-88) {
		tmp = fma(pos, 300.0, ((vel - velAxis) * 0.05));
	} else {
		tmp = fma(poxAxis, -300.0, (0.05 * vel));
	}
	return tmp;
}
function code(vel, velAxis, pos, poxAxis)
	tmp = 0.0
	if (poxAxis <= -7.6e-49)
		tmp = Float64(Float64(pos - poxAxis) * 300.0);
	elseif (poxAxis <= 4.15e-88)
		tmp = fma(pos, 300.0, Float64(Float64(vel - velAxis) * 0.05));
	else
		tmp = fma(poxAxis, -300.0, Float64(0.05 * vel));
	end
	return tmp
end
code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[poxAxis, -7.6e-49], N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision], If[LessEqual[poxAxis, 4.15e-88], N[(pos * 300.0 + N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]), $MachinePrecision], N[(poxAxis * -300.0 + N[(0.05 * vel), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;poxAxis \leq -7.6 \cdot 10^{-49}:\\
\;\;\;\;\left(pos - poxAxis\right) \cdot 300\\

\mathbf{elif}\;poxAxis \leq 4.15 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(poxAxis, -300, 0.05 \cdot vel\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if poxAxis < -7.5999999999999994e-49

    1. Initial program 99.9%

      \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
    2. Add Preprocessing
    3. Taylor expanded in velAxis around 0

      \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + 300 \cdot \left(pos - poxAxis\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{300 \cdot \left(pos - poxAxis\right) + \frac{3602879701896397}{72057594037927936} \cdot vel} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(pos - poxAxis\right) \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot vel \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right)} \]
      4. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{pos - poxAxis}, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
      6. lower-*.f6489.6

        \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot 0.05}\right) \]
    5. Applied rewrites89.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, vel \cdot 0.05\right)} \]
    6. Taylor expanded in vel around 0

      \[\leadsto 300 \cdot \color{blue}{\left(pos - poxAxis\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites89.6%

        \[\leadsto \left(pos - poxAxis\right) \cdot \color{blue}{300} \]

      if -7.5999999999999994e-49 < poxAxis < 4.15e-88

      1. Initial program 99.9%

        \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
      2. Add Preprocessing
      3. Taylor expanded in poxAxis around 0

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
        3. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
        5. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
        6. lower--.f6489.7

          \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
      5. Applied rewrites89.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]

      if 4.15e-88 < poxAxis

      1. Initial program 99.9%

        \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
      2. Add Preprocessing
      3. Taylor expanded in velAxis around 0

        \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + 300 \cdot \left(pos - poxAxis\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{300 \cdot \left(pos - poxAxis\right) + \frac{3602879701896397}{72057594037927936} \cdot vel} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\left(pos - poxAxis\right) \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot vel \]
        3. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right)} \]
        4. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{pos - poxAxis}, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
        6. lower-*.f6497.1

          \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot 0.05}\right) \]
      5. Applied rewrites97.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, vel \cdot 0.05\right)} \]
      6. Taylor expanded in pos around 0

        \[\leadsto -300 \cdot poxAxis + \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel} \]
      7. Step-by-step derivation
        1. Applied rewrites78.3%

          \[\leadsto \mathsf{fma}\left(poxAxis, \color{blue}{-300}, vel \cdot 0.05\right) \]
      8. Recombined 3 regimes into one program.
      9. Final simplification88.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;poxAxis \leq -7.6 \cdot 10^{-49}:\\ \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\ \mathbf{elif}\;poxAxis \leq 4.15 \cdot 10^{-88}:\\ \;\;\;\;\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(poxAxis, -300, 0.05 \cdot vel\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 9: 72.4% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;vel - velAxis \leq -5 \cdot 10^{-73}:\\ \;\;\;\;\mathsf{fma}\left(vel, 0.05, velAxis \cdot -0.05\right)\\ \mathbf{elif}\;vel - velAxis \leq 4 \cdot 10^{-95}:\\ \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\ \mathbf{else}:\\ \;\;\;\;\left(vel - velAxis\right) \cdot 0.05\\ \end{array} \end{array} \]
      (FPCore (vel velAxis pos poxAxis)
       :precision binary64
       (if (<= (- vel velAxis) -5e-73)
         (fma vel 0.05 (* velAxis -0.05))
         (if (<= (- vel velAxis) 4e-95)
           (* (- pos poxAxis) 300.0)
           (* (- vel velAxis) 0.05))))
      double code(double vel, double velAxis, double pos, double poxAxis) {
      	double tmp;
      	if ((vel - velAxis) <= -5e-73) {
      		tmp = fma(vel, 0.05, (velAxis * -0.05));
      	} else if ((vel - velAxis) <= 4e-95) {
      		tmp = (pos - poxAxis) * 300.0;
      	} else {
      		tmp = (vel - velAxis) * 0.05;
      	}
      	return tmp;
      }
      
      function code(vel, velAxis, pos, poxAxis)
      	tmp = 0.0
      	if (Float64(vel - velAxis) <= -5e-73)
      		tmp = fma(vel, 0.05, Float64(velAxis * -0.05));
      	elseif (Float64(vel - velAxis) <= 4e-95)
      		tmp = Float64(Float64(pos - poxAxis) * 300.0);
      	else
      		tmp = Float64(Float64(vel - velAxis) * 0.05);
      	end
      	return tmp
      end
      
      code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[N[(vel - velAxis), $MachinePrecision], -5e-73], N[(vel * 0.05 + N[(velAxis * -0.05), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(vel - velAxis), $MachinePrecision], 4e-95], N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision], N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;vel - velAxis \leq -5 \cdot 10^{-73}:\\
      \;\;\;\;\mathsf{fma}\left(vel, 0.05, velAxis \cdot -0.05\right)\\
      
      \mathbf{elif}\;vel - velAxis \leq 4 \cdot 10^{-95}:\\
      \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(vel - velAxis\right) \cdot 0.05\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (-.f64 vel velAxis) < -4.9999999999999998e-73

        1. Initial program 99.9%

          \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
          2. lift-*.f64N/A

            \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
          4. lift--.f64N/A

            \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} + \left(pos - poxAxis\right) \cdot 300 \]
          5. sub-negN/A

            \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel + \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
          6. distribute-lft-inN/A

            \[\leadsto \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot vel + \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right)\right)} + \left(pos - poxAxis\right) \cdot 300 \]
          7. associate-+l+N/A

            \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
          8. *-commutativeN/A

            \[\leadsto \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}} + \left(\frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right) \]
          9. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \left(\mathsf{neg}\left(velAxis\right)\right) + \left(pos - poxAxis\right) \cdot 300\right)} \]
          10. neg-mul-1N/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(-1 \cdot velAxis\right)} + \left(pos - poxAxis\right) \cdot 300\right) \]
          11. associate-*r*N/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\frac{3602879701896397}{72057594037927936} \cdot -1\right) \cdot velAxis} + \left(pos - poxAxis\right) \cdot 300\right) \]
          12. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936}} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
          13. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right)\right)} \cdot velAxis + \left(pos - poxAxis\right) \cdot 300\right) \]
          14. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{3602879701896397}{72057594037927936}\right), velAxis, \left(pos - poxAxis\right) \cdot 300\right)}\right) \]
          15. metadata-eval99.9

            \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(\color{blue}{-0.05}, velAxis, \left(pos - poxAxis\right) \cdot 300\right)\right) \]
          16. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right)\right) \]
          17. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \mathsf{fma}\left(\frac{-3602879701896397}{72057594037927936}, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
          18. lower-*.f6499.9

            \[\leadsto \mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right)\right) \]
        4. Applied rewrites99.9%

          \[\leadsto \color{blue}{\mathsf{fma}\left(vel, 0.05, \mathsf{fma}\left(-0.05, velAxis, 300 \cdot \left(pos - poxAxis\right)\right)\right)} \]
        5. Taylor expanded in velAxis around inf

          \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{\frac{-3602879701896397}{72057594037927936} \cdot velAxis}\right) \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(vel, \frac{3602879701896397}{72057594037927936}, \color{blue}{velAxis \cdot \frac{-3602879701896397}{72057594037927936}}\right) \]
          2. lower-*.f6471.3

            \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{velAxis \cdot -0.05}\right) \]
        7. Applied rewrites71.3%

          \[\leadsto \mathsf{fma}\left(vel, 0.05, \color{blue}{velAxis \cdot -0.05}\right) \]

        if -4.9999999999999998e-73 < (-.f64 vel velAxis) < 3.99999999999999996e-95

        1. Initial program 100.0%

          \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
        2. Add Preprocessing
        3. Taylor expanded in velAxis around 0

          \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + 300 \cdot \left(pos - poxAxis\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{300 \cdot \left(pos - poxAxis\right) + \frac{3602879701896397}{72057594037927936} \cdot vel} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\left(pos - poxAxis\right) \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot vel \]
          3. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right)} \]
          4. lower--.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{pos - poxAxis}, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
          6. lower-*.f6486.8

            \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot 0.05}\right) \]
        5. Applied rewrites86.8%

          \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, vel \cdot 0.05\right)} \]
        6. Taylor expanded in vel around 0

          \[\leadsto 300 \cdot \color{blue}{\left(pos - poxAxis\right)} \]
        7. Step-by-step derivation
          1. Applied rewrites76.8%

            \[\leadsto \left(pos - poxAxis\right) \cdot \color{blue}{300} \]

          if 3.99999999999999996e-95 < (-.f64 vel velAxis)

          1. Initial program 99.9%

            \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
          2. Add Preprocessing
          3. Taylor expanded in poxAxis around 0

            \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
            3. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
            5. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
            6. lower--.f6485.0

              \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
          5. Applied rewrites85.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]
          6. Taylor expanded in pos around 0

            \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} \]
          7. Step-by-step derivation
            1. Applied rewrites76.8%

              \[\leadsto \left(vel - velAxis\right) \cdot \color{blue}{0.05} \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 10: 72.4% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(vel - velAxis\right) \cdot 0.05\\ \mathbf{if}\;vel - velAxis \leq -5 \cdot 10^{-73}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;vel - velAxis \leq 4 \cdot 10^{-95}:\\ \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (vel velAxis pos poxAxis)
           :precision binary64
           (let* ((t_0 (* (- vel velAxis) 0.05)))
             (if (<= (- vel velAxis) -5e-73)
               t_0
               (if (<= (- vel velAxis) 4e-95) (* (- pos poxAxis) 300.0) t_0))))
          double code(double vel, double velAxis, double pos, double poxAxis) {
          	double t_0 = (vel - velAxis) * 0.05;
          	double tmp;
          	if ((vel - velAxis) <= -5e-73) {
          		tmp = t_0;
          	} else if ((vel - velAxis) <= 4e-95) {
          		tmp = (pos - poxAxis) * 300.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(vel, velaxis, pos, poxaxis)
              real(8), intent (in) :: vel
              real(8), intent (in) :: velaxis
              real(8), intent (in) :: pos
              real(8), intent (in) :: poxaxis
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (vel - velaxis) * 0.05d0
              if ((vel - velaxis) <= (-5d-73)) then
                  tmp = t_0
              else if ((vel - velaxis) <= 4d-95) then
                  tmp = (pos - poxaxis) * 300.0d0
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double vel, double velAxis, double pos, double poxAxis) {
          	double t_0 = (vel - velAxis) * 0.05;
          	double tmp;
          	if ((vel - velAxis) <= -5e-73) {
          		tmp = t_0;
          	} else if ((vel - velAxis) <= 4e-95) {
          		tmp = (pos - poxAxis) * 300.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(vel, velAxis, pos, poxAxis):
          	t_0 = (vel - velAxis) * 0.05
          	tmp = 0
          	if (vel - velAxis) <= -5e-73:
          		tmp = t_0
          	elif (vel - velAxis) <= 4e-95:
          		tmp = (pos - poxAxis) * 300.0
          	else:
          		tmp = t_0
          	return tmp
          
          function code(vel, velAxis, pos, poxAxis)
          	t_0 = Float64(Float64(vel - velAxis) * 0.05)
          	tmp = 0.0
          	if (Float64(vel - velAxis) <= -5e-73)
          		tmp = t_0;
          	elseif (Float64(vel - velAxis) <= 4e-95)
          		tmp = Float64(Float64(pos - poxAxis) * 300.0);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(vel, velAxis, pos, poxAxis)
          	t_0 = (vel - velAxis) * 0.05;
          	tmp = 0.0;
          	if ((vel - velAxis) <= -5e-73)
          		tmp = t_0;
          	elseif ((vel - velAxis) <= 4e-95)
          		tmp = (pos - poxAxis) * 300.0;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[vel_, velAxis_, pos_, poxAxis_] := Block[{t$95$0 = N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision]}, If[LessEqual[N[(vel - velAxis), $MachinePrecision], -5e-73], t$95$0, If[LessEqual[N[(vel - velAxis), $MachinePrecision], 4e-95], N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(vel - velAxis\right) \cdot 0.05\\
          \mathbf{if}\;vel - velAxis \leq -5 \cdot 10^{-73}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;vel - velAxis \leq 4 \cdot 10^{-95}:\\
          \;\;\;\;\left(pos - poxAxis\right) \cdot 300\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (-.f64 vel velAxis) < -4.9999999999999998e-73 or 3.99999999999999996e-95 < (-.f64 vel velAxis)

            1. Initial program 99.9%

              \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
            2. Add Preprocessing
            3. Taylor expanded in poxAxis around 0

              \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
              3. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
              5. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
              6. lower--.f6487.1

                \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
            5. Applied rewrites87.1%

              \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]
            6. Taylor expanded in pos around 0

              \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} \]
            7. Step-by-step derivation
              1. Applied rewrites74.4%

                \[\leadsto \left(vel - velAxis\right) \cdot \color{blue}{0.05} \]

              if -4.9999999999999998e-73 < (-.f64 vel velAxis) < 3.99999999999999996e-95

              1. Initial program 100.0%

                \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
              2. Add Preprocessing
              3. Taylor expanded in velAxis around 0

                \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot vel + 300 \cdot \left(pos - poxAxis\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \color{blue}{300 \cdot \left(pos - poxAxis\right) + \frac{3602879701896397}{72057594037927936} \cdot vel} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(pos - poxAxis\right) \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot vel \]
                3. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right)} \]
                4. lower--.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{pos - poxAxis}, 300, \frac{3602879701896397}{72057594037927936} \cdot vel\right) \]
                5. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
                6. lower-*.f6486.8

                  \[\leadsto \mathsf{fma}\left(pos - poxAxis, 300, \color{blue}{vel \cdot 0.05}\right) \]
              5. Applied rewrites86.8%

                \[\leadsto \color{blue}{\mathsf{fma}\left(pos - poxAxis, 300, vel \cdot 0.05\right)} \]
              6. Taylor expanded in vel around 0

                \[\leadsto 300 \cdot \color{blue}{\left(pos - poxAxis\right)} \]
              7. Step-by-step derivation
                1. Applied rewrites76.8%

                  \[\leadsto \left(pos - poxAxis\right) \cdot \color{blue}{300} \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 11: 59.9% accurate, 1.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;pos \leq -3.5 \cdot 10^{-61}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq 1.4 \cdot 10^{-103}:\\ \;\;\;\;\left(vel - velAxis\right) \cdot 0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \end{array} \]
              (FPCore (vel velAxis pos poxAxis)
               :precision binary64
               (if (<= pos -3.5e-61)
                 (* pos 300.0)
                 (if (<= pos 1.4e-103) (* (- vel velAxis) 0.05) (* pos 300.0))))
              double code(double vel, double velAxis, double pos, double poxAxis) {
              	double tmp;
              	if (pos <= -3.5e-61) {
              		tmp = pos * 300.0;
              	} else if (pos <= 1.4e-103) {
              		tmp = (vel - velAxis) * 0.05;
              	} else {
              		tmp = pos * 300.0;
              	}
              	return tmp;
              }
              
              real(8) function code(vel, velaxis, pos, poxaxis)
                  real(8), intent (in) :: vel
                  real(8), intent (in) :: velaxis
                  real(8), intent (in) :: pos
                  real(8), intent (in) :: poxaxis
                  real(8) :: tmp
                  if (pos <= (-3.5d-61)) then
                      tmp = pos * 300.0d0
                  else if (pos <= 1.4d-103) then
                      tmp = (vel - velaxis) * 0.05d0
                  else
                      tmp = pos * 300.0d0
                  end if
                  code = tmp
              end function
              
              public static double code(double vel, double velAxis, double pos, double poxAxis) {
              	double tmp;
              	if (pos <= -3.5e-61) {
              		tmp = pos * 300.0;
              	} else if (pos <= 1.4e-103) {
              		tmp = (vel - velAxis) * 0.05;
              	} else {
              		tmp = pos * 300.0;
              	}
              	return tmp;
              }
              
              def code(vel, velAxis, pos, poxAxis):
              	tmp = 0
              	if pos <= -3.5e-61:
              		tmp = pos * 300.0
              	elif pos <= 1.4e-103:
              		tmp = (vel - velAxis) * 0.05
              	else:
              		tmp = pos * 300.0
              	return tmp
              
              function code(vel, velAxis, pos, poxAxis)
              	tmp = 0.0
              	if (pos <= -3.5e-61)
              		tmp = Float64(pos * 300.0);
              	elseif (pos <= 1.4e-103)
              		tmp = Float64(Float64(vel - velAxis) * 0.05);
              	else
              		tmp = Float64(pos * 300.0);
              	end
              	return tmp
              end
              
              function tmp_2 = code(vel, velAxis, pos, poxAxis)
              	tmp = 0.0;
              	if (pos <= -3.5e-61)
              		tmp = pos * 300.0;
              	elseif (pos <= 1.4e-103)
              		tmp = (vel - velAxis) * 0.05;
              	else
              		tmp = pos * 300.0;
              	end
              	tmp_2 = tmp;
              end
              
              code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[pos, -3.5e-61], N[(pos * 300.0), $MachinePrecision], If[LessEqual[pos, 1.4e-103], N[(N[(vel - velAxis), $MachinePrecision] * 0.05), $MachinePrecision], N[(pos * 300.0), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;pos \leq -3.5 \cdot 10^{-61}:\\
              \;\;\;\;pos \cdot 300\\
              
              \mathbf{elif}\;pos \leq 1.4 \cdot 10^{-103}:\\
              \;\;\;\;\left(vel - velAxis\right) \cdot 0.05\\
              
              \mathbf{else}:\\
              \;\;\;\;pos \cdot 300\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if pos < -3.5000000000000003e-61 or 1.40000000000000011e-103 < pos

                1. Initial program 99.9%

                  \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                2. Add Preprocessing
                3. Taylor expanded in pos around inf

                  \[\leadsto \color{blue}{300 \cdot pos} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \color{blue}{pos \cdot 300} \]
                  2. lower-*.f6473.0

                    \[\leadsto \color{blue}{pos \cdot 300} \]
                5. Applied rewrites73.0%

                  \[\leadsto \color{blue}{pos \cdot 300} \]

                if -3.5000000000000003e-61 < pos < 1.40000000000000011e-103

                1. Initial program 99.9%

                  \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                2. Add Preprocessing
                3. Taylor expanded in poxAxis around 0

                  \[\leadsto \color{blue}{\frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) + 300 \cdot pos} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{300 \cdot pos + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)} \]
                  2. *-commutativeN/A

                    \[\leadsto \color{blue}{pos \cdot 300} + \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right) \]
                  3. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \frac{3602879701896397}{72057594037927936} \cdot \left(vel - velAxis\right)\right)} \]
                  4. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
                  5. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}}\right) \]
                  6. lower--.f6470.6

                    \[\leadsto \mathsf{fma}\left(pos, 300, \color{blue}{\left(vel - velAxis\right)} \cdot 0.05\right) \]
                5. Applied rewrites70.6%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(pos, 300, \left(vel - velAxis\right) \cdot 0.05\right)} \]
                6. Taylor expanded in pos around 0

                  \[\leadsto \frac{3602879701896397}{72057594037927936} \cdot \color{blue}{\left(vel - velAxis\right)} \]
                7. Step-by-step derivation
                  1. Applied rewrites61.1%

                    \[\leadsto \left(vel - velAxis\right) \cdot \color{blue}{0.05} \]
                8. Recombined 2 regimes into one program.
                9. Add Preprocessing

                Alternative 12: 41.3% accurate, 1.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;pos \leq -2.85 \cdot 10^{-108}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \end{array} \]
                (FPCore (vel velAxis pos poxAxis)
                 :precision binary64
                 (if (<= pos -2.85e-108)
                   (* pos 300.0)
                   (if (<= pos 3.5e-112) (* velAxis -0.05) (* pos 300.0))))
                double code(double vel, double velAxis, double pos, double poxAxis) {
                	double tmp;
                	if (pos <= -2.85e-108) {
                		tmp = pos * 300.0;
                	} else if (pos <= 3.5e-112) {
                		tmp = velAxis * -0.05;
                	} else {
                		tmp = pos * 300.0;
                	}
                	return tmp;
                }
                
                real(8) function code(vel, velaxis, pos, poxaxis)
                    real(8), intent (in) :: vel
                    real(8), intent (in) :: velaxis
                    real(8), intent (in) :: pos
                    real(8), intent (in) :: poxaxis
                    real(8) :: tmp
                    if (pos <= (-2.85d-108)) then
                        tmp = pos * 300.0d0
                    else if (pos <= 3.5d-112) then
                        tmp = velaxis * (-0.05d0)
                    else
                        tmp = pos * 300.0d0
                    end if
                    code = tmp
                end function
                
                public static double code(double vel, double velAxis, double pos, double poxAxis) {
                	double tmp;
                	if (pos <= -2.85e-108) {
                		tmp = pos * 300.0;
                	} else if (pos <= 3.5e-112) {
                		tmp = velAxis * -0.05;
                	} else {
                		tmp = pos * 300.0;
                	}
                	return tmp;
                }
                
                def code(vel, velAxis, pos, poxAxis):
                	tmp = 0
                	if pos <= -2.85e-108:
                		tmp = pos * 300.0
                	elif pos <= 3.5e-112:
                		tmp = velAxis * -0.05
                	else:
                		tmp = pos * 300.0
                	return tmp
                
                function code(vel, velAxis, pos, poxAxis)
                	tmp = 0.0
                	if (pos <= -2.85e-108)
                		tmp = Float64(pos * 300.0);
                	elseif (pos <= 3.5e-112)
                		tmp = Float64(velAxis * -0.05);
                	else
                		tmp = Float64(pos * 300.0);
                	end
                	return tmp
                end
                
                function tmp_2 = code(vel, velAxis, pos, poxAxis)
                	tmp = 0.0;
                	if (pos <= -2.85e-108)
                		tmp = pos * 300.0;
                	elseif (pos <= 3.5e-112)
                		tmp = velAxis * -0.05;
                	else
                		tmp = pos * 300.0;
                	end
                	tmp_2 = tmp;
                end
                
                code[vel_, velAxis_, pos_, poxAxis_] := If[LessEqual[pos, -2.85e-108], N[(pos * 300.0), $MachinePrecision], If[LessEqual[pos, 3.5e-112], N[(velAxis * -0.05), $MachinePrecision], N[(pos * 300.0), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;pos \leq -2.85 \cdot 10^{-108}:\\
                \;\;\;\;pos \cdot 300\\
                
                \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\
                \;\;\;\;velAxis \cdot -0.05\\
                
                \mathbf{else}:\\
                \;\;\;\;pos \cdot 300\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if pos < -2.85e-108 or 3.49999999999999994e-112 < pos

                  1. Initial program 99.9%

                    \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                  2. Add Preprocessing
                  3. Taylor expanded in pos around inf

                    \[\leadsto \color{blue}{300 \cdot pos} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \color{blue}{pos \cdot 300} \]
                    2. lower-*.f6460.9

                      \[\leadsto \color{blue}{pos \cdot 300} \]
                  5. Applied rewrites60.9%

                    \[\leadsto \color{blue}{pos \cdot 300} \]

                  if -2.85e-108 < pos < 3.49999999999999994e-112

                  1. Initial program 99.9%

                    \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                  2. Add Preprocessing
                  3. Taylor expanded in velAxis around inf

                    \[\leadsto \color{blue}{\frac{-3602879701896397}{72057594037927936} \cdot velAxis} \]
                  4. Step-by-step derivation
                    1. lower-*.f6437.0

                      \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
                  5. Applied rewrites37.0%

                    \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification47.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;pos \leq -2.85 \cdot 10^{-108}:\\ \;\;\;\;pos \cdot 300\\ \mathbf{elif}\;pos \leq 3.5 \cdot 10^{-112}:\\ \;\;\;\;velAxis \cdot -0.05\\ \mathbf{else}:\\ \;\;\;\;pos \cdot 300\\ \end{array} \]
                5. Add Preprocessing

                Alternative 13: 99.9% accurate, 1.1× speedup?

                \[\begin{array}{l} \\ \mathsf{fma}\left(vel - velAxis, 0.05, \left(pos - poxAxis\right) \cdot 300\right) \end{array} \]
                (FPCore (vel velAxis pos poxAxis)
                 :precision binary64
                 (fma (- vel velAxis) 0.05 (* (- pos poxAxis) 300.0)))
                double code(double vel, double velAxis, double pos, double poxAxis) {
                	return fma((vel - velAxis), 0.05, ((pos - poxAxis) * 300.0));
                }
                
                function code(vel, velAxis, pos, poxAxis)
                	return fma(Float64(vel - velAxis), 0.05, Float64(Float64(pos - poxAxis) * 300.0))
                end
                
                code[vel_, velAxis_, pos_, poxAxis_] := N[(N[(vel - velAxis), $MachinePrecision] * 0.05 + N[(N[(pos - poxAxis), $MachinePrecision] * 300.0), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                \mathsf{fma}\left(vel - velAxis, 0.05, \left(pos - poxAxis\right) \cdot 300\right)
                \end{array}
                
                Derivation
                1. Initial program 99.9%

                  \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936} + \left(pos - poxAxis\right) \cdot 300} \]
                  2. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left(vel - velAxis\right) \cdot \frac{3602879701896397}{72057594037927936}} + \left(pos - poxAxis\right) \cdot 300 \]
                  3. lower-fma.f6499.9

                    \[\leadsto \color{blue}{\mathsf{fma}\left(vel - velAxis, 0.05, \left(pos - poxAxis\right) \cdot 300\right)} \]
                  4. lift-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(vel - velAxis, \frac{3602879701896397}{72057594037927936}, \color{blue}{\left(pos - poxAxis\right) \cdot 300}\right) \]
                  5. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(vel - velAxis, \frac{3602879701896397}{72057594037927936}, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right) \]
                  6. lower-*.f6499.9

                    \[\leadsto \mathsf{fma}\left(vel - velAxis, 0.05, \color{blue}{300 \cdot \left(pos - poxAxis\right)}\right) \]
                4. Applied rewrites99.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(vel - velAxis, 0.05, 300 \cdot \left(pos - poxAxis\right)\right)} \]
                5. Final simplification99.9%

                  \[\leadsto \mathsf{fma}\left(vel - velAxis, 0.05, \left(pos - poxAxis\right) \cdot 300\right) \]
                6. Add Preprocessing

                Alternative 14: 26.7% accurate, 3.3× speedup?

                \[\begin{array}{l} \\ velAxis \cdot -0.05 \end{array} \]
                (FPCore (vel velAxis pos poxAxis) :precision binary64 (* velAxis -0.05))
                double code(double vel, double velAxis, double pos, double poxAxis) {
                	return velAxis * -0.05;
                }
                
                real(8) function code(vel, velaxis, pos, poxaxis)
                    real(8), intent (in) :: vel
                    real(8), intent (in) :: velaxis
                    real(8), intent (in) :: pos
                    real(8), intent (in) :: poxaxis
                    code = velaxis * (-0.05d0)
                end function
                
                public static double code(double vel, double velAxis, double pos, double poxAxis) {
                	return velAxis * -0.05;
                }
                
                def code(vel, velAxis, pos, poxAxis):
                	return velAxis * -0.05
                
                function code(vel, velAxis, pos, poxAxis)
                	return Float64(velAxis * -0.05)
                end
                
                function tmp = code(vel, velAxis, pos, poxAxis)
                	tmp = velAxis * -0.05;
                end
                
                code[vel_, velAxis_, pos_, poxAxis_] := N[(velAxis * -0.05), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                velAxis \cdot -0.05
                \end{array}
                
                Derivation
                1. Initial program 99.9%

                  \[\left(vel - velAxis\right) \cdot 0.05 + \left(pos - poxAxis\right) \cdot 300 \]
                2. Add Preprocessing
                3. Taylor expanded in velAxis around inf

                  \[\leadsto \color{blue}{\frac{-3602879701896397}{72057594037927936} \cdot velAxis} \]
                4. Step-by-step derivation
                  1. lower-*.f6427.9

                    \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
                5. Applied rewrites27.9%

                  \[\leadsto \color{blue}{-0.05 \cdot velAxis} \]
                6. Final simplification27.9%

                  \[\leadsto velAxis \cdot -0.05 \]
                7. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 1 
                (FPCore (vel velAxis pos poxAxis)
                  :name "(vel-velAxis)*0.05+(pos-poxAxis)*300"
                  :precision binary64
                  :pre (and (and (and (and (<= -10000000000.0 vel) (<= vel 10000000000.0)) (and (<= -10000000000.0 velAxis) (<= velAxis 10000000000.0))) (and (<= -10000000000.0 pos) (<= pos 10000000000.0))) (and (<= -10000000000.0 poxAxis) (<= poxAxis 10000000000.0)))
                  (+ (* (- vel velAxis) 0.05) (* (- pos poxAxis) 300.0)))