Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 8.4s
Alternatives: 9
Speedup: N/A×

Specification

?
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \]
(FPCore (eh ew t)
  :precision binary64
  (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
  (fabs
   (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((eh / ew) / tan(t)))
    code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
	return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((eh / ew) / math.tan(t)))
	return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh / ew) / tan(t)))
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((eh / ew) / tan(t)));
	tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}

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 9 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \]
(FPCore (eh ew t)
  :precision binary64
  (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
  (fabs
   (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((eh / ew) / tan(t)))
    code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
	return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((eh / ew) / math.tan(t)))
	return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh / ew) / tan(t)))
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((eh / ew) / tan(t)));
	tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}

Alternative 1: 99.8% accurate, 1.1× speedup?

\[\begin{array}{l} t_1 := \frac{eh}{\tan t \cdot ew}\\ \left|\frac{\sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}} + \tanh \sinh^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right| \end{array} \]
(FPCore (eh ew t)
  :precision binary64
  (let* ((t_1 (/ eh (* (tan t) ew))))
  (fabs
   (+
    (/ (* (sin t) ew) (sqrt (- (pow t_1 2.0) -1.0)))
    (* (tanh (asinh t_1)) (* (cos t) eh))))))
double code(double eh, double ew, double t) {
	double t_1 = eh / (tan(t) * ew);
	return fabs((((sin(t) * ew) / sqrt((pow(t_1, 2.0) - -1.0))) + (tanh(asinh(t_1)) * (cos(t) * eh))));
}
def code(eh, ew, t):
	t_1 = eh / (math.tan(t) * ew)
	return math.fabs((((math.sin(t) * ew) / math.sqrt((math.pow(t_1, 2.0) - -1.0))) + (math.tanh(math.asinh(t_1)) * (math.cos(t) * eh))))
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(tan(t) * ew))
	return abs(Float64(Float64(Float64(sin(t) * ew) / sqrt(Float64((t_1 ^ 2.0) - -1.0))) + Float64(tanh(asinh(t_1)) * Float64(cos(t) * eh))))
end
function tmp = code(eh, ew, t)
	t_1 = eh / (tan(t) * ew);
	tmp = abs((((sin(t) * ew) / sqrt(((t_1 ^ 2.0) - -1.0))) + (tanh(asinh(t_1)) * (cos(t) * eh))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_1 := \frac{eh}{\tan t \cdot ew}\\
\left|\frac{\sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}} + \tanh \sinh^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. Applied rewrites99.8%

      \[\leadsto \left|\color{blue}{\frac{\sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}} + \tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \left(\cos t \cdot eh\right)}\right| \]
    2. Add Preprocessing

    Alternative 2: 99.1% accurate, 1.4× speedup?

    \[\left|\frac{\sin t}{\sqrt{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    (FPCore (eh ew t)
      :precision binary64
      (fabs
     (+
      (*
       (/ (sin t) (sqrt (- (/ (* (/ eh (* ew t)) eh) (* ew t)) -1.0)))
       ew)
      (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
    double code(double eh, double ew, double t) {
    	return fabs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(eh, ew, t)
    use fmin_fmax_functions
        real(8), intent (in) :: eh
        real(8), intent (in) :: ew
        real(8), intent (in) :: t
        code = abs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - (-1.0d0)))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
    end function
    
    public static double code(double eh, double ew, double t) {
    	return Math.abs((((Math.sin(t) / Math.sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
    }
    
    def code(eh, ew, t):
    	return math.fabs((((math.sin(t) / math.sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
    
    function code(eh, ew, t)
    	return abs(Float64(Float64(Float64(sin(t) / sqrt(Float64(Float64(Float64(Float64(eh / Float64(ew * t)) * eh) / Float64(ew * t)) - -1.0))) * ew) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
    end
    
    function tmp = code(eh, ew, t)
    	tmp = abs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision] / N[(ew * t), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \left|\frac{\sin t}{\sqrt{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
    
    Derivation
    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right)} \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. associate-*l*N/A

        \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. Applied rewrites99.8%

      \[\leadsto \left|\color{blue}{\frac{\sin t}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}} \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Taylor expanded in t around 0

      \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Step-by-step derivation
      1. lower-*.f6499.1%

        \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    6. Applied rewrites99.1%

      \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    7. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \left|\frac{\sin t}{\sqrt{\color{blue}{{\left(\frac{eh}{ew \cdot t}\right)}^{2}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. unpow2N/A

        \[\leadsto \left|\frac{\sin t}{\sqrt{\color{blue}{\frac{eh}{ew \cdot t} \cdot \frac{eh}{ew \cdot t}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. lift-/.f64N/A

        \[\leadsto \left|\frac{\sin t}{\sqrt{\frac{eh}{ew \cdot t} \cdot \color{blue}{\frac{eh}{ew \cdot t}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. associate-*r/N/A

        \[\leadsto \left|\frac{\sin t}{\sqrt{\color{blue}{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. lower-/.f64N/A

        \[\leadsto \left|\frac{\sin t}{\sqrt{\color{blue}{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      6. lower-*.f6499.1%

        \[\leadsto \left|\frac{\sin t}{\sqrt{\frac{\color{blue}{\frac{eh}{ew \cdot t} \cdot eh}}{ew \cdot t} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    8. Applied rewrites99.1%

      \[\leadsto \left|\frac{\sin t}{\sqrt{\color{blue}{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t}} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    9. Add Preprocessing

    Alternative 3: 98.6% accurate, 1.6× speedup?

    \[\left|\sin t \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    (FPCore (eh ew t)
      :precision binary64
      (fabs
     (+
      (* (sin t) ew)
      (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
    double code(double eh, double ew, double t) {
    	return fabs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(eh, ew, t)
    use fmin_fmax_functions
        real(8), intent (in) :: eh
        real(8), intent (in) :: ew
        real(8), intent (in) :: t
        code = abs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
    end function
    
    public static double code(double eh, double ew, double t) {
    	return Math.abs(((Math.sin(t) * ew) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
    }
    
    def code(eh, ew, t):
    	return math.fabs(((math.sin(t) * ew) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
    
    function code(eh, ew, t)
    	return abs(Float64(Float64(sin(t) * ew) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
    end
    
    function tmp = code(eh, ew, t)
    	tmp = abs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \left|\sin t \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
    
    Derivation
    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right)} \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. associate-*l*N/A

        \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. Applied rewrites99.8%

      \[\leadsto \left|\color{blue}{\frac{\sin t}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}} \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Taylor expanded in t around 0

      \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Step-by-step derivation
      1. lower-*.f6499.1%

        \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    6. Applied rewrites99.1%

      \[\leadsto \left|\frac{\sin t}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    7. Taylor expanded in eh around 0

      \[\leadsto \left|\color{blue}{\sin t} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    8. Step-by-step derivation
      1. lower-sin.f6498.6%

        \[\leadsto \left|\sin t \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    9. Applied rewrites98.6%

      \[\leadsto \left|\color{blue}{\sin t} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    10. Add Preprocessing

    Alternative 4: 68.8% accurate, 2.2× speedup?

    \[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ t_2 := \left|\frac{t\_1 \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}}\right|\\ \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\ \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
    (FPCore (eh ew t)
      :precision binary64
      (let* ((t_1 (/ eh (* ew t)))
           (t_2
            (fabs
             (/
              (+ (* t_1 (* (cos t) eh)) (* (sin t) ew))
              (sqrt (- (pow t_1 2.0) -1.0))))))
      (if (<= t -3e-59)
        t_2
        (if (<= t 1.65e-109)
          (fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
          t_2))))
    double code(double eh, double ew, double t) {
    	double t_1 = eh / (ew * t);
    	double t_2 = fabs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt((pow(t_1, 2.0) - -1.0))));
    	double tmp;
    	if (t <= -3e-59) {
    		tmp = t_2;
    	} else if (t <= 1.65e-109) {
    		tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(eh, ew, t)
    use fmin_fmax_functions
        real(8), intent (in) :: eh
        real(8), intent (in) :: ew
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = eh / (ew * t)
        t_2 = abs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(((t_1 ** 2.0d0) - (-1.0d0)))))
        if (t <= (-3d-59)) then
            tmp = t_2
        else if (t <= 1.65d-109) then
            tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
        else
            tmp = t_2
        end if
        code = tmp
    end function
    
    public static double code(double eh, double ew, double t) {
    	double t_1 = eh / (ew * t);
    	double t_2 = Math.abs((((t_1 * (Math.cos(t) * eh)) + (Math.sin(t) * ew)) / Math.sqrt((Math.pow(t_1, 2.0) - -1.0))));
    	double tmp;
    	if (t <= -3e-59) {
    		tmp = t_2;
    	} else if (t <= 1.65e-109) {
    		tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	t_1 = eh / (ew * t)
    	t_2 = math.fabs((((t_1 * (math.cos(t) * eh)) + (math.sin(t) * ew)) / math.sqrt((math.pow(t_1, 2.0) - -1.0))))
    	tmp = 0
    	if t <= -3e-59:
    		tmp = t_2
    	elif t <= 1.65e-109:
    		tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew)))
    	else:
    		tmp = t_2
    	return tmp
    
    function code(eh, ew, t)
    	t_1 = Float64(eh / Float64(ew * t))
    	t_2 = abs(Float64(Float64(Float64(t_1 * Float64(cos(t) * eh)) + Float64(sin(t) * ew)) / sqrt(Float64((t_1 ^ 2.0) - -1.0))))
    	tmp = 0.0
    	if (t <= -3e-59)
    		tmp = t_2;
    	elseif (t <= 1.65e-109)
    		tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew)));
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	t_1 = eh / (ew * t);
    	t_2 = abs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(((t_1 ^ 2.0) - -1.0))));
    	tmp = 0.0;
    	if (t <= -3e-59)
    		tmp = t_2;
    	elseif (t <= 1.65e-109)
    		tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)));
    	else
    		tmp = t_2;
    	end
    	tmp_2 = tmp;
    end
    
    code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(N[(t$95$1 * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$2, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
    
    \begin{array}{l}
    t_1 := \frac{eh}{ew \cdot t}\\
    t_2 := \left|\frac{t\_1 \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}}\right|\\
    \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
    \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -3.0000000000000001e-59 or 1.65e-109 < t

      1. Initial program 99.8%

        \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        2. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        3. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        4. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        5. lift-sin.f64N/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        6. lift-atan.f64N/A

          \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        7. sin-atanN/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        8. associate-*l/N/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        9. lift-*.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        10. lift-cos.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        11. lift-atan.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        12. cos-atanN/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. Applied rewrites57.2%

        \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
      4. Taylor expanded in t around 0

        \[\leadsto \left|\frac{\frac{eh}{\color{blue}{ew \cdot t}} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}\right| \]
      5. Step-by-step derivation
        1. lower-*.f6448.6%

          \[\leadsto \left|\frac{\frac{eh}{ew \cdot \color{blue}{t}} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}\right| \]
      6. Applied rewrites48.6%

        \[\leadsto \left|\frac{\frac{eh}{\color{blue}{ew \cdot t}} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}\right| \]
      7. Taylor expanded in t around 0

        \[\leadsto \left|\frac{\frac{eh}{ew \cdot t} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}}\right| \]
      8. Step-by-step derivation
        1. lower-*.f6455.0%

          \[\leadsto \left|\frac{\frac{eh}{ew \cdot t} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}^{2} - -1}}\right| \]
      9. Applied rewrites55.0%

        \[\leadsto \left|\frac{\frac{eh}{ew \cdot t} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1}}\right| \]

      if -3.0000000000000001e-59 < t < 1.65e-109

      1. Initial program 99.8%

        \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        2. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        3. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        4. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        5. lift-sin.f64N/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        6. lift-atan.f64N/A

          \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        7. sin-atanN/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        8. associate-*l/N/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        9. lift-*.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        10. lift-cos.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        11. lift-atan.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        12. cos-atanN/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. Applied rewrites57.2%

        \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
      4. Taylor expanded in t around 0

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      5. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. lower-*.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        4. lower-sqrt.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        5. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        7. lower-pow.f6411.3%

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
      6. Applied rewrites11.3%

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      7. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lift-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. pow2N/A

          \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        4. associate-/l*N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. lower-*.f64N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        6. lower-/.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. lift-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        8. *-commutativeN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        9. lower-*.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        10. lift-sqrt.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        11. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        12. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        13. pow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        14. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        15. unpow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
        16. times-fracN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        17. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        18. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        19. rem-sqrt-squareN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        20. lower-fabs.f6435.1%

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
      8. Applied rewrites35.1%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
      9. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
        2. lift-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot \color{blue}{ew}}\right| \]
        3. associate-/r*N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
        4. lower-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
        5. lift-fabs.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
        6. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
        7. fabs-divN/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\frac{\left|eh\right|}{\left|ew\right|}}}{ew}\right| \]
        8. associate-/r/N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        9. lower-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        10. lower-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        11. lower-fabs.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        12. lower-fabs.f6442.6%

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
      10. Applied rewrites42.6%

        \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{\color{blue}{ew}}\right| \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 5: 60.9% accurate, 2.4× speedup?

    \[\begin{array}{l} t_1 := \left|\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{1}}\right|\\ \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\ \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (eh ew t)
      :precision binary64
      (let* ((t_1
            (fabs
             (/
              (+ (* (/ eh (* (tan t) ew)) (* (cos t) eh)) (* (sin t) ew))
              (sqrt 1.0)))))
      (if (<= t -3e-59)
        t_1
        (if (<= t 1.65e-109)
          (fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
          t_1))))
    double code(double eh, double ew, double t) {
    	double t_1 = fabs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0)));
    	double tmp;
    	if (t <= -3e-59) {
    		tmp = t_1;
    	} else if (t <= 1.65e-109) {
    		tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(eh, ew, t)
    use fmin_fmax_functions
        real(8), intent (in) :: eh
        real(8), intent (in) :: ew
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = abs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0d0)))
        if (t <= (-3d-59)) then
            tmp = t_1
        else if (t <= 1.65d-109) then
            tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double eh, double ew, double t) {
    	double t_1 = Math.abs(((((eh / (Math.tan(t) * ew)) * (Math.cos(t) * eh)) + (Math.sin(t) * ew)) / Math.sqrt(1.0)));
    	double tmp;
    	if (t <= -3e-59) {
    		tmp = t_1;
    	} else if (t <= 1.65e-109) {
    		tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	t_1 = math.fabs(((((eh / (math.tan(t) * ew)) * (math.cos(t) * eh)) + (math.sin(t) * ew)) / math.sqrt(1.0)))
    	tmp = 0
    	if t <= -3e-59:
    		tmp = t_1
    	elif t <= 1.65e-109:
    		tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew)))
    	else:
    		tmp = t_1
    	return tmp
    
    function code(eh, ew, t)
    	t_1 = abs(Float64(Float64(Float64(Float64(eh / Float64(tan(t) * ew)) * Float64(cos(t) * eh)) + Float64(sin(t) * ew)) / sqrt(1.0)))
    	tmp = 0.0
    	if (t <= -3e-59)
    		tmp = t_1;
    	elseif (t <= 1.65e-109)
    		tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	t_1 = abs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0)));
    	tmp = 0.0;
    	if (t <= -3e-59)
    		tmp = t_1;
    	elseif (t <= 1.65e-109)
    		tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)));
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[(N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$1, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := \left|\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{1}}\right|\\
    \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
    \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -3.0000000000000001e-59 or 1.65e-109 < t

      1. Initial program 99.8%

        \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        2. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        3. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        4. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        5. lift-sin.f64N/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        6. lift-atan.f64N/A

          \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        7. sin-atanN/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        8. associate-*l/N/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        9. lift-*.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        10. lift-cos.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        11. lift-atan.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        12. cos-atanN/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. Applied rewrites57.2%

        \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
      4. Taylor expanded in eh around 0

        \[\leadsto \left|\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]
      5. Step-by-step derivation
        1. Applied rewrites42.6%

          \[\leadsto \left|\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]

        if -3.0000000000000001e-59 < t < 1.65e-109

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          2. +-commutativeN/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          3. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          4. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          5. lift-sin.f64N/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          6. lift-atan.f64N/A

            \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          7. sin-atanN/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          8. associate-*l/N/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          9. lift-*.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          10. lift-cos.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          11. lift-atan.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          12. cos-atanN/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
        3. Applied rewrites57.2%

          \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
        4. Taylor expanded in t around 0

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. lower-*.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          4. lower-sqrt.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          5. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          6. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          7. lower-pow.f6411.3%

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. Applied rewrites11.3%

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lift-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. pow2N/A

            \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          4. associate-/l*N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          5. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          6. lower-/.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          7. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          8. *-commutativeN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          9. lower-*.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          10. lift-sqrt.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          11. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          12. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          13. pow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          14. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          15. unpow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
          16. times-fracN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          17. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          18. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          19. rem-sqrt-squareN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          20. lower-fabs.f6435.1%

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        8. Applied rewrites35.1%

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
        9. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
          2. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot \color{blue}{ew}}\right| \]
          3. associate-/r*N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
          4. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
          5. lift-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
          6. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
          7. fabs-divN/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\frac{\left|eh\right|}{\left|ew\right|}}}{ew}\right| \]
          8. associate-/r/N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          9. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          10. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          12. lower-fabs.f6442.6%

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        10. Applied rewrites42.6%

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{\color{blue}{ew}}\right| \]
      6. Recombined 2 regimes into one program.
      7. Add Preprocessing

      Alternative 6: 53.5% accurate, 6.4× speedup?

      \[\begin{array}{l} t_1 := \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right|\\ \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\ \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
      (FPCore (eh ew t)
        :precision binary64
        (let* ((t_1 (fabs (* eh (/ (* ew (sin t)) eh)))))
        (if (<= t -3e-59)
          t_1
          (if (<= t 1.65e-109)
            (fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
            t_1))))
      double code(double eh, double ew, double t) {
      	double t_1 = fabs((eh * ((ew * sin(t)) / eh)));
      	double tmp;
      	if (t <= -3e-59) {
      		tmp = t_1;
      	} else if (t <= 1.65e-109) {
      		tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(eh, ew, t)
      use fmin_fmax_functions
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          real(8) :: t_1
          real(8) :: tmp
          t_1 = abs((eh * ((ew * sin(t)) / eh)))
          if (t <= (-3d-59)) then
              tmp = t_1
          else if (t <= 1.65d-109) then
              tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double eh, double ew, double t) {
      	double t_1 = Math.abs((eh * ((ew * Math.sin(t)) / eh)));
      	double tmp;
      	if (t <= -3e-59) {
      		tmp = t_1;
      	} else if (t <= 1.65e-109) {
      		tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = math.fabs((eh * ((ew * math.sin(t)) / eh)))
      	tmp = 0
      	if t <= -3e-59:
      		tmp = t_1
      	elif t <= 1.65e-109:
      		tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew)))
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = abs(Float64(eh * Float64(Float64(ew * sin(t)) / eh)))
      	tmp = 0.0
      	if (t <= -3e-59)
      		tmp = t_1;
      	elseif (t <= 1.65e-109)
      		tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = abs((eh * ((ew * sin(t)) / eh)));
      	tmp = 0.0;
      	if (t <= -3e-59)
      		tmp = t_1;
      	elseif (t <= 1.65e-109)
      		tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)));
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$1, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      t_1 := \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right|\\
      \mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
      \;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if t < -3.0000000000000001e-59 or 1.65e-109 < t

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        2. Taylor expanded in eh around inf

          \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
          2. lower-+.f64N/A

            \[\leadsto \left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) + \color{blue}{\frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}}\right)\right| \]
        4. Applied rewrites92.0%

          \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
        5. Applied rewrites35.2%

          \[\leadsto \left|eh \cdot \left(\frac{\left(\left(eh \cdot eh\right) \cdot {\left(ew \cdot \tan t\right)}^{-2} - -1\right) \cdot \left(ew \cdot \sin t\right)}{\sqrt{\left(eh \cdot eh\right) \cdot {\left(ew \cdot \tan t\right)}^{-2} - -1}} \cdot \color{blue}{\frac{1}{eh}}\right)\right| \]
        6. Taylor expanded in eh around 0

          \[\leadsto \left|eh \cdot \frac{ew \cdot \sin t}{\color{blue}{eh}}\right| \]
        7. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right| \]
          2. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right| \]
          3. lower-sin.f6434.0%

            \[\leadsto \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right| \]
        8. Applied rewrites34.0%

          \[\leadsto \left|eh \cdot \frac{ew \cdot \sin t}{\color{blue}{eh}}\right| \]

        if -3.0000000000000001e-59 < t < 1.65e-109

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          2. +-commutativeN/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          3. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          4. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          5. lift-sin.f64N/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          6. lift-atan.f64N/A

            \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          7. sin-atanN/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          8. associate-*l/N/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          9. lift-*.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          10. lift-cos.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          11. lift-atan.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          12. cos-atanN/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
        3. Applied rewrites57.2%

          \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
        4. Taylor expanded in t around 0

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. lower-*.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          4. lower-sqrt.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          5. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          6. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          7. lower-pow.f6411.3%

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. Applied rewrites11.3%

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lift-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. pow2N/A

            \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          4. associate-/l*N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          5. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          6. lower-/.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          7. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          8. *-commutativeN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          9. lower-*.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          10. lift-sqrt.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          11. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          12. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          13. pow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          14. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          15. unpow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
          16. times-fracN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          17. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          18. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          19. rem-sqrt-squareN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          20. lower-fabs.f6435.1%

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        8. Applied rewrites35.1%

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
        9. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
          2. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot \color{blue}{ew}}\right| \]
          3. associate-/r*N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
          4. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
          5. lift-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
          6. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
          7. fabs-divN/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\frac{\left|eh\right|}{\left|ew\right|}}}{ew}\right| \]
          8. associate-/r/N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          9. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          10. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
          12. lower-fabs.f6442.6%

            \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        10. Applied rewrites42.6%

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{\color{blue}{ew}}\right| \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 7: 42.6% accurate, 22.3× speedup?

      \[\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
      (FPCore (eh ew t)
        :precision binary64
        (fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew))))
      double code(double eh, double ew, double t) {
      	return fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(eh, ew, t)
      use fmin_fmax_functions
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          code = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
      end function
      
      public static double code(double eh, double ew, double t) {
      	return Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
      }
      
      def code(eh, ew, t):
      	return math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew)))
      
      function code(eh, ew, t)
      	return abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew)))
      end
      
      function tmp = code(eh, ew, t)
      	tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)));
      end
      
      code[eh_, ew_, t_] := N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
      
      \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|
      
      Derivation
      1. Initial program 99.8%

        \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        2. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        3. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        4. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        5. lift-sin.f64N/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        6. lift-atan.f64N/A

          \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        7. sin-atanN/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        8. associate-*l/N/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        9. lift-*.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        10. lift-cos.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        11. lift-atan.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        12. cos-atanN/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. Applied rewrites57.2%

        \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
      4. Taylor expanded in t around 0

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      5. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. lower-*.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        4. lower-sqrt.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        5. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        7. lower-pow.f6411.3%

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
      6. Applied rewrites11.3%

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      7. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lift-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. pow2N/A

          \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        4. associate-/l*N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. lower-*.f64N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        6. lower-/.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. lift-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        8. *-commutativeN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        9. lower-*.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        10. lift-sqrt.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        11. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        12. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        13. pow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        14. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        15. unpow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
        16. times-fracN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        17. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        18. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        19. rem-sqrt-squareN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        20. lower-fabs.f6435.1%

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
      8. Applied rewrites35.1%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
      9. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
        2. lift-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot \color{blue}{ew}}\right| \]
        3. associate-/r*N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
        4. lower-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{\color{blue}{ew}}\right| \]
        5. lift-fabs.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
        6. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|\frac{eh}{ew}\right|}}{ew}\right| \]
        7. fabs-divN/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\frac{\left|eh\right|}{\left|ew\right|}}}{ew}\right| \]
        8. associate-/r/N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        9. lower-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        10. lower-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        11. lower-fabs.f64N/A

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
        12. lower-fabs.f6442.6%

          \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right| \]
      10. Applied rewrites42.6%

        \[\leadsto \left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{\color{blue}{ew}}\right| \]
      11. Add Preprocessing

      Alternative 8: 36.1% accurate, 19.3× speedup?

      \[\begin{array}{l} \mathbf{if}\;eh \leq -2 \cdot 10^{-13}:\\ \;\;\;\;\left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|ew\right|}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right|\\ \end{array} \]
      (FPCore (eh ew t)
        :precision binary64
        (if (<= eh -2e-13)
        (fabs (* eh (/ eh (/ (* (fabs eh) ew) (fabs ew)))))
        (fabs (* eh (/ eh (* (fabs (/ eh ew)) ew))))))
      double code(double eh, double ew, double t) {
      	double tmp;
      	if (eh <= -2e-13) {
      		tmp = fabs((eh * (eh / ((fabs(eh) * ew) / fabs(ew)))));
      	} else {
      		tmp = fabs((eh * (eh / (fabs((eh / ew)) * ew))));
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(eh, ew, t)
      use fmin_fmax_functions
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          real(8) :: tmp
          if (eh <= (-2d-13)) then
              tmp = abs((eh * (eh / ((abs(eh) * ew) / abs(ew)))))
          else
              tmp = abs((eh * (eh / (abs((eh / ew)) * ew))))
          end if
          code = tmp
      end function
      
      public static double code(double eh, double ew, double t) {
      	double tmp;
      	if (eh <= -2e-13) {
      		tmp = Math.abs((eh * (eh / ((Math.abs(eh) * ew) / Math.abs(ew)))));
      	} else {
      		tmp = Math.abs((eh * (eh / (Math.abs((eh / ew)) * ew))));
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	tmp = 0
      	if eh <= -2e-13:
      		tmp = math.fabs((eh * (eh / ((math.fabs(eh) * ew) / math.fabs(ew)))))
      	else:
      		tmp = math.fabs((eh * (eh / (math.fabs((eh / ew)) * ew))))
      	return tmp
      
      function code(eh, ew, t)
      	tmp = 0.0
      	if (eh <= -2e-13)
      		tmp = abs(Float64(eh * Float64(eh / Float64(Float64(abs(eh) * ew) / abs(ew)))));
      	else
      		tmp = abs(Float64(eh * Float64(eh / Float64(abs(Float64(eh / ew)) * ew))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	tmp = 0.0;
      	if (eh <= -2e-13)
      		tmp = abs((eh * (eh / ((abs(eh) * ew) / abs(ew)))));
      	else
      		tmp = abs((eh * (eh / (abs((eh / ew)) * ew))));
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := If[LessEqual[eh, -2e-13], N[Abs[N[(eh * N[(eh / N[(N[(N[Abs[eh], $MachinePrecision] * ew), $MachinePrecision] / N[Abs[ew], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(eh / N[(N[Abs[N[(eh / ew), $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
      
      \begin{array}{l}
      \mathbf{if}\;eh \leq -2 \cdot 10^{-13}:\\
      \;\;\;\;\left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|ew\right|}}\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;\left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right|\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eh < -2.0000000000000001e-13

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          2. +-commutativeN/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          3. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          4. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          5. lift-sin.f64N/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          6. lift-atan.f64N/A

            \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          7. sin-atanN/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          8. associate-*l/N/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          9. lift-*.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          10. lift-cos.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          11. lift-atan.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          12. cos-atanN/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
        3. Applied rewrites57.2%

          \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
        4. Taylor expanded in t around 0

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. lower-*.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          4. lower-sqrt.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          5. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          6. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          7. lower-pow.f6411.3%

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. Applied rewrites11.3%

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lift-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. pow2N/A

            \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          4. associate-/l*N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          5. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          6. lower-/.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          7. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          8. *-commutativeN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          9. lower-*.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          10. lift-sqrt.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          11. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          12. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          13. pow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          14. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          15. unpow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
          16. times-fracN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          17. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          18. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          19. rem-sqrt-squareN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          20. lower-fabs.f6435.1%

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        8. Applied rewrites35.1%

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
        9. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot \color{blue}{ew}}\right| \]
          2. lift-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          3. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          4. fabs-divN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right|}{\left|ew\right|} \cdot ew}\right| \]
          5. associate-*l/N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\color{blue}{\left|ew\right|}}}\right| \]
          6. lower-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\color{blue}{\left|ew\right|}}}\right| \]
          7. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|\color{blue}{ew}\right|}}\right| \]
          8. lower-fabs.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|ew\right|}}\right| \]
          9. lower-fabs.f6431.2%

            \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|ew\right|}}\right| \]
        10. Applied rewrites31.2%

          \[\leadsto \left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\color{blue}{\left|ew\right|}}}\right| \]

        if -2.0000000000000001e-13 < eh

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          2. +-commutativeN/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          3. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          4. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          5. lift-sin.f64N/A

            \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          6. lift-atan.f64N/A

            \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          7. sin-atanN/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          8. associate-*l/N/A

            \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          9. lift-*.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          10. lift-cos.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          11. lift-atan.f64N/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
          12. cos-atanN/A

            \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
        3. Applied rewrites57.2%

          \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
        4. Taylor expanded in t around 0

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. lower-*.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          4. lower-sqrt.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          5. lower-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          6. lower-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          7. lower-pow.f6411.3%

            \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. Applied rewrites11.3%

          \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          2. lift-pow.f64N/A

            \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          3. pow2N/A

            \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
          4. associate-/l*N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          5. lower-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          6. lower-/.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          7. lift-*.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
          8. *-commutativeN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          9. lower-*.f6412.3%

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
          10. lift-sqrt.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          11. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          12. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
          13. pow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          14. lift-pow.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
          15. unpow2N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
          16. times-fracN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          17. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          18. lift-/.f64N/A

            \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
          19. rem-sqrt-squareN/A

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
          20. lower-fabs.f6435.1%

            \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        8. Applied rewrites35.1%

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 9: 35.1% accurate, 23.5× speedup?

      \[\left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
      (FPCore (eh ew t)
        :precision binary64
        (fabs (* eh (/ eh (* (fabs (/ eh ew)) ew)))))
      double code(double eh, double ew, double t) {
      	return fabs((eh * (eh / (fabs((eh / ew)) * ew))));
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(eh, ew, t)
      use fmin_fmax_functions
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          code = abs((eh * (eh / (abs((eh / ew)) * ew))))
      end function
      
      public static double code(double eh, double ew, double t) {
      	return Math.abs((eh * (eh / (Math.abs((eh / ew)) * ew))));
      }
      
      def code(eh, ew, t):
      	return math.fabs((eh * (eh / (math.fabs((eh / ew)) * ew))))
      
      function code(eh, ew, t)
      	return abs(Float64(eh * Float64(eh / Float64(abs(Float64(eh / ew)) * ew))))
      end
      
      function tmp = code(eh, ew, t)
      	tmp = abs((eh * (eh / (abs((eh / ew)) * ew))));
      end
      
      code[eh_, ew_, t_] := N[Abs[N[(eh * N[(eh / N[(N[Abs[N[(eh / ew), $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
      
      \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right|
      
      Derivation
      1. Initial program 99.8%

        \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \left|\color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        2. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        3. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        4. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right)} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        5. lift-sin.f64N/A

          \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        6. lift-atan.f64N/A

          \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        7. sin-atanN/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} \cdot \left(eh \cdot \cos t\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        8. associate-*l/N/A

          \[\leadsto \left|\color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
        9. lift-*.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        10. lift-cos.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        11. lift-atan.f64N/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)}\right| \]
        12. cos-atanN/A

          \[\leadsto \left|\frac{\frac{\frac{eh}{ew}}{\tan t} \cdot \left(eh \cdot \cos t\right)}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. Applied rewrites57.2%

        \[\leadsto \left|\color{blue}{\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} - -1}}}\right| \]
      4. Taylor expanded in t around 0

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      5. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. lower-*.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        4. lower-sqrt.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        5. lower-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        6. lower-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        7. lower-pow.f6411.3%

          \[\leadsto \left|\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
      6. Applied rewrites11.3%

        \[\leadsto \left|\color{blue}{\frac{{eh}^{2}}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
      7. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        2. lift-pow.f64N/A

          \[\leadsto \left|\frac{{eh}^{2}}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        3. pow2N/A

          \[\leadsto \left|\frac{eh \cdot eh}{\color{blue}{ew} \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}\right| \]
        4. associate-/l*N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        5. lower-*.f64N/A

          \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        6. lower-/.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\color{blue}{ew \cdot \sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        7. lift-*.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{ew \cdot \color{blue}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}}}}\right| \]
        8. *-commutativeN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        9. lower-*.f6412.3%

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot \color{blue}{ew}}\right| \]
        10. lift-sqrt.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        11. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        12. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{{eh}^{2}}{{ew}^{2}}} \cdot ew}\right| \]
        13. pow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        14. lift-pow.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{{ew}^{2}}} \cdot ew}\right| \]
        15. unpow2N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh \cdot eh}{ew \cdot ew}} \cdot ew}\right| \]
        16. times-fracN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        17. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        18. lift-/.f64N/A

          \[\leadsto \left|eh \cdot \frac{eh}{\sqrt{\frac{eh}{ew} \cdot \frac{eh}{ew}} \cdot ew}\right| \]
        19. rem-sqrt-squareN/A

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
        20. lower-fabs.f6435.1%

          \[\leadsto \left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right| \]
      8. Applied rewrites35.1%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}}\right| \]
      9. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025258 
      (FPCore (eh ew t)
        :name "Example from Robby"
        :precision binary64
        (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))