expq3 (problem 3.4.2)

Percentage Accurate: 0.0% → 99.8%
Time: 15.0s
Alternatives: 5
Speedup: 29.1×

Specification

?
\[\left(\left|a\right| \leq 710 \land \left|b\right| \leq 710\right) \land \left(10^{-27} \cdot \mathsf{min}\left(\left|a\right|, \left|b\right|\right) \leq \varepsilon \land \varepsilon \leq \mathsf{min}\left(\left|a\right|, \left|b\right|\right)\right)\]
\[\begin{array}{l} \\ \frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \end{array} \]
(FPCore (a b eps)
 :precision binary64
 (/
  (* eps (- (exp (* (+ a b) eps)) 1.0))
  (* (- (exp (* a eps)) 1.0) (- (exp (* b eps)) 1.0))))
double code(double a, double b, double eps) {
	return (eps * (exp(((a + b) * eps)) - 1.0)) / ((exp((a * eps)) - 1.0) * (exp((b * eps)) - 1.0));
}
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(a, b, eps)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: eps
    code = (eps * (exp(((a + b) * eps)) - 1.0d0)) / ((exp((a * eps)) - 1.0d0) * (exp((b * eps)) - 1.0d0))
end function
public static double code(double a, double b, double eps) {
	return (eps * (Math.exp(((a + b) * eps)) - 1.0)) / ((Math.exp((a * eps)) - 1.0) * (Math.exp((b * eps)) - 1.0));
}
def code(a, b, eps):
	return (eps * (math.exp(((a + b) * eps)) - 1.0)) / ((math.exp((a * eps)) - 1.0) * (math.exp((b * eps)) - 1.0))
function code(a, b, eps)
	return Float64(Float64(eps * Float64(exp(Float64(Float64(a + b) * eps)) - 1.0)) / Float64(Float64(exp(Float64(a * eps)) - 1.0) * Float64(exp(Float64(b * eps)) - 1.0)))
end
function tmp = code(a, b, eps)
	tmp = (eps * (exp(((a + b) * eps)) - 1.0)) / ((exp((a * eps)) - 1.0) * (exp((b * eps)) - 1.0));
end
code[a_, b_, eps_] := N[(N[(eps * N[(N[Exp[N[(N[(a + b), $MachinePrecision] * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Exp[N[(a * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] * N[(N[Exp[N[(b * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 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 5 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: 0.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \end{array} \]
(FPCore (a b eps)
 :precision binary64
 (/
  (* eps (- (exp (* (+ a b) eps)) 1.0))
  (* (- (exp (* a eps)) 1.0) (- (exp (* b eps)) 1.0))))
double code(double a, double b, double eps) {
	return (eps * (exp(((a + b) * eps)) - 1.0)) / ((exp((a * eps)) - 1.0) * (exp((b * eps)) - 1.0));
}
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(a, b, eps)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: eps
    code = (eps * (exp(((a + b) * eps)) - 1.0d0)) / ((exp((a * eps)) - 1.0d0) * (exp((b * eps)) - 1.0d0))
end function
public static double code(double a, double b, double eps) {
	return (eps * (Math.exp(((a + b) * eps)) - 1.0)) / ((Math.exp((a * eps)) - 1.0) * (Math.exp((b * eps)) - 1.0));
}
def code(a, b, eps):
	return (eps * (math.exp(((a + b) * eps)) - 1.0)) / ((math.exp((a * eps)) - 1.0) * (math.exp((b * eps)) - 1.0))
function code(a, b, eps)
	return Float64(Float64(eps * Float64(exp(Float64(Float64(a + b) * eps)) - 1.0)) / Float64(Float64(exp(Float64(a * eps)) - 1.0) * Float64(exp(Float64(b * eps)) - 1.0)))
end
function tmp = code(a, b, eps)
	tmp = (eps * (exp(((a + b) * eps)) - 1.0)) / ((exp((a * eps)) - 1.0) * (exp((b * eps)) - 1.0));
end
code[a_, b_, eps_] := N[(N[(eps * N[(N[Exp[N[(N[(a + b), $MachinePrecision] * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Exp[N[(a * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] * N[(N[Exp[N[(b * eps), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)}
\end{array}

Alternative 1: 99.8% accurate, 13.4× speedup?

\[\begin{array}{l} [a, b, eps] = \mathsf{sort}([a, b, eps])\\ \\ \frac{\frac{b}{a} + 1}{b} \end{array} \]
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
(FPCore (a b eps) :precision binary64 (/ (+ (/ b a) 1.0) b))
assert(a < b && b < eps);
double code(double a, double b, double eps) {
	return ((b / a) + 1.0) / b;
}
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
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(a, b, eps)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: eps
    code = ((b / a) + 1.0d0) / b
end function
assert a < b && b < eps;
public static double code(double a, double b, double eps) {
	return ((b / a) + 1.0) / b;
}
[a, b, eps] = sort([a, b, eps])
def code(a, b, eps):
	return ((b / a) + 1.0) / b
a, b, eps = sort([a, b, eps])
function code(a, b, eps)
	return Float64(Float64(Float64(b / a) + 1.0) / b)
end
a, b, eps = num2cell(sort([a, b, eps])){:}
function tmp = code(a, b, eps)
	tmp = ((b / a) + 1.0) / b;
end
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
code[a_, b_, eps_] := N[(N[(N[(b / a), $MachinePrecision] + 1.0), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
[a, b, eps] = \mathsf{sort}([a, b, eps])\\
\\
\frac{\frac{b}{a} + 1}{b}
\end{array}
Derivation
  1. Initial program 0.0%

    \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
  2. Taylor expanded in eps around 0

    \[\leadsto \color{blue}{\frac{a + b}{a \cdot b}} \]
  3. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
    2. lower-/.f64N/A

      \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
    3. lower-/.f64N/A

      \[\leadsto \frac{\frac{a + b}{a}}{b} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\frac{b + a}{a}}{b} \]
    5. lower-+.f6499.8

      \[\leadsto \frac{\frac{b + a}{a}}{b} \]
  4. Applied rewrites99.8%

    \[\leadsto \color{blue}{\frac{\frac{b + a}{a}}{b}} \]
  5. Taylor expanded in a around inf

    \[\leadsto \frac{1 + \frac{b}{a}}{b} \]
  6. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \frac{\frac{b}{a} + 1}{b} \]
    2. lower-+.f64N/A

      \[\leadsto \frac{\frac{b}{a} + 1}{b} \]
    3. lower-/.f6499.8

      \[\leadsto \frac{\frac{b}{a} + 1}{b} \]
  7. Applied rewrites99.8%

    \[\leadsto \frac{\frac{b}{a} + 1}{b} \]
  8. Add Preprocessing

Alternative 2: 78.0% accurate, 10.9× speedup?

\[\begin{array}{l} [a, b, eps] = \mathsf{sort}([a, b, eps])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 2.3 \cdot 10^{-173}:\\ \;\;\;\;\frac{1}{b}\\ \mathbf{elif}\;b \leq 4.5 \cdot 10^{-108}:\\ \;\;\;\;\frac{b + a}{b \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a}\\ \end{array} \end{array} \]
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
(FPCore (a b eps)
 :precision binary64
 (if (<= b 2.3e-173)
   (/ 1.0 b)
   (if (<= b 4.5e-108) (/ (+ b a) (* b a)) (/ 1.0 a))))
assert(a < b && b < eps);
double code(double a, double b, double eps) {
	double tmp;
	if (b <= 2.3e-173) {
		tmp = 1.0 / b;
	} else if (b <= 4.5e-108) {
		tmp = (b + a) / (b * a);
	} else {
		tmp = 1.0 / a;
	}
	return tmp;
}
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
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(a, b, eps)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: eps
    real(8) :: tmp
    if (b <= 2.3d-173) then
        tmp = 1.0d0 / b
    else if (b <= 4.5d-108) then
        tmp = (b + a) / (b * a)
    else
        tmp = 1.0d0 / a
    end if
    code = tmp
end function
assert a < b && b < eps;
public static double code(double a, double b, double eps) {
	double tmp;
	if (b <= 2.3e-173) {
		tmp = 1.0 / b;
	} else if (b <= 4.5e-108) {
		tmp = (b + a) / (b * a);
	} else {
		tmp = 1.0 / a;
	}
	return tmp;
}
[a, b, eps] = sort([a, b, eps])
def code(a, b, eps):
	tmp = 0
	if b <= 2.3e-173:
		tmp = 1.0 / b
	elif b <= 4.5e-108:
		tmp = (b + a) / (b * a)
	else:
		tmp = 1.0 / a
	return tmp
a, b, eps = sort([a, b, eps])
function code(a, b, eps)
	tmp = 0.0
	if (b <= 2.3e-173)
		tmp = Float64(1.0 / b);
	elseif (b <= 4.5e-108)
		tmp = Float64(Float64(b + a) / Float64(b * a));
	else
		tmp = Float64(1.0 / a);
	end
	return tmp
end
a, b, eps = num2cell(sort([a, b, eps])){:}
function tmp_2 = code(a, b, eps)
	tmp = 0.0;
	if (b <= 2.3e-173)
		tmp = 1.0 / b;
	elseif (b <= 4.5e-108)
		tmp = (b + a) / (b * a);
	else
		tmp = 1.0 / a;
	end
	tmp_2 = tmp;
end
NOTE: a, b, and eps should be sorted in increasing order before calling this function.
code[a_, b_, eps_] := If[LessEqual[b, 2.3e-173], N[(1.0 / b), $MachinePrecision], If[LessEqual[b, 4.5e-108], N[(N[(b + a), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / a), $MachinePrecision]]]
\begin{array}{l}
[a, b, eps] = \mathsf{sort}([a, b, eps])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{-173}:\\
\;\;\;\;\frac{1}{b}\\

\mathbf{elif}\;b \leq 4.5 \cdot 10^{-108}:\\
\;\;\;\;\frac{b + a}{b \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 2.29999999999999988e-173

    1. Initial program 0.0%

      \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
    2. Taylor expanded in eps around 0

      \[\leadsto \color{blue}{\frac{a + b}{a \cdot b}} \]
    3. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{a + b}{a}}{b} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{b + a}{a}}{b} \]
      5. lower-+.f6499.9

        \[\leadsto \frac{\frac{b + a}{a}}{b} \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\frac{\frac{b + a}{a}}{b}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{1}{b} \]
    6. Step-by-step derivation
      1. Applied rewrites80.3%

        \[\leadsto \frac{1}{b} \]

      if 2.29999999999999988e-173 < b < 4.4999999999999997e-108

      1. Initial program 0.0%

        \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
      2. Taylor expanded in eps around 0

        \[\leadsto \color{blue}{\frac{a + b}{a \cdot b}} \]
      3. Step-by-step derivation
        1. associate-/r*N/A

          \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
        3. lower-/.f64N/A

          \[\leadsto \frac{\frac{a + b}{a}}{b} \]
        4. +-commutativeN/A

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
        5. lower-+.f6499.7

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
      4. Applied rewrites99.7%

        \[\leadsto \color{blue}{\frac{\frac{b + a}{a}}{b}} \]
      5. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \frac{\frac{b + a}{a}}{\color{blue}{b}} \]
        2. lift-+.f64N/A

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
        4. associate-/l/N/A

          \[\leadsto \frac{b + a}{\color{blue}{a \cdot b}} \]
        5. +-commutativeN/A

          \[\leadsto \frac{a + b}{\color{blue}{a} \cdot b} \]
        6. lower-/.f64N/A

          \[\leadsto \frac{a + b}{\color{blue}{a \cdot b}} \]
        7. +-commutativeN/A

          \[\leadsto \frac{b + a}{\color{blue}{a} \cdot b} \]
        8. lift-+.f64N/A

          \[\leadsto \frac{b + a}{\color{blue}{a} \cdot b} \]
        9. *-commutativeN/A

          \[\leadsto \frac{b + a}{b \cdot \color{blue}{a}} \]
        10. lower-*.f6453.2

          \[\leadsto \frac{b + a}{b \cdot \color{blue}{a}} \]
      6. Applied rewrites53.2%

        \[\leadsto \frac{b + a}{\color{blue}{b \cdot a}} \]

      if 4.4999999999999997e-108 < b

      1. Initial program 0.0%

        \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
      2. Taylor expanded in a around 0

        \[\leadsto \color{blue}{\frac{1}{a}} \]
      3. Step-by-step derivation
        1. inv-powN/A

          \[\leadsto {a}^{\color{blue}{-1}} \]
        2. lower-pow.f6487.2

          \[\leadsto {a}^{\color{blue}{-1}} \]
      4. Applied rewrites87.2%

        \[\leadsto \color{blue}{{a}^{-1}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto {a}^{\color{blue}{-1}} \]
        2. inv-powN/A

          \[\leadsto \frac{1}{\color{blue}{a}} \]
        3. lower-/.f6487.2

          \[\leadsto \frac{1}{\color{blue}{a}} \]
      6. Applied rewrites87.2%

        \[\leadsto \frac{1}{\color{blue}{a}} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 3: 99.8% accurate, 13.4× speedup?

    \[\begin{array}{l} [a, b, eps] = \mathsf{sort}([a, b, eps])\\ \\ \frac{\frac{a}{b} + 1}{a} \end{array} \]
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    (FPCore (a b eps) :precision binary64 (/ (+ (/ a b) 1.0) a))
    assert(a < b && b < eps);
    double code(double a, double b, double eps) {
    	return ((a / b) + 1.0) / a;
    }
    
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    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(a, b, eps)
    use fmin_fmax_functions
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: eps
        code = ((a / b) + 1.0d0) / a
    end function
    
    assert a < b && b < eps;
    public static double code(double a, double b, double eps) {
    	return ((a / b) + 1.0) / a;
    }
    
    [a, b, eps] = sort([a, b, eps])
    def code(a, b, eps):
    	return ((a / b) + 1.0) / a
    
    a, b, eps = sort([a, b, eps])
    function code(a, b, eps)
    	return Float64(Float64(Float64(a / b) + 1.0) / a)
    end
    
    a, b, eps = num2cell(sort([a, b, eps])){:}
    function tmp = code(a, b, eps)
    	tmp = ((a / b) + 1.0) / a;
    end
    
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    code[a_, b_, eps_] := N[(N[(N[(a / b), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]
    
    \begin{array}{l}
    [a, b, eps] = \mathsf{sort}([a, b, eps])\\
    \\
    \frac{\frac{a}{b} + 1}{a}
    \end{array}
    
    Derivation
    1. Initial program 0.0%

      \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
    2. Taylor expanded in eps around 0

      \[\leadsto \color{blue}{\frac{a + b}{a \cdot b}} \]
    3. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{a + b}{a}}{b} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{b + a}{a}}{b} \]
      5. lower-+.f6499.8

        \[\leadsto \frac{\frac{b + a}{a}}{b} \]
    4. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{b + a}{a}}{b}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1 + \frac{a}{b}}{\color{blue}{a}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1 + \frac{a}{b}}{a} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{a}{b} + 1}{a} \]
      3. lower-+.f64N/A

        \[\leadsto \frac{\frac{a}{b} + 1}{a} \]
      4. lower-/.f6499.8

        \[\leadsto \frac{\frac{a}{b} + 1}{a} \]
    7. Applied rewrites99.8%

      \[\leadsto \frac{\frac{a}{b} + 1}{\color{blue}{a}} \]
    8. Add Preprocessing

    Alternative 4: 76.2% accurate, 19.4× speedup?

    \[\begin{array}{l} [a, b, eps] = \mathsf{sort}([a, b, eps])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 1.35 \cdot 10^{-121}:\\ \;\;\;\;\frac{1}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a}\\ \end{array} \end{array} \]
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    (FPCore (a b eps)
     :precision binary64
     (if (<= b 1.35e-121) (/ 1.0 b) (/ 1.0 a)))
    assert(a < b && b < eps);
    double code(double a, double b, double eps) {
    	double tmp;
    	if (b <= 1.35e-121) {
    		tmp = 1.0 / b;
    	} else {
    		tmp = 1.0 / a;
    	}
    	return tmp;
    }
    
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    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(a, b, eps)
    use fmin_fmax_functions
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: eps
        real(8) :: tmp
        if (b <= 1.35d-121) then
            tmp = 1.0d0 / b
        else
            tmp = 1.0d0 / a
        end if
        code = tmp
    end function
    
    assert a < b && b < eps;
    public static double code(double a, double b, double eps) {
    	double tmp;
    	if (b <= 1.35e-121) {
    		tmp = 1.0 / b;
    	} else {
    		tmp = 1.0 / a;
    	}
    	return tmp;
    }
    
    [a, b, eps] = sort([a, b, eps])
    def code(a, b, eps):
    	tmp = 0
    	if b <= 1.35e-121:
    		tmp = 1.0 / b
    	else:
    		tmp = 1.0 / a
    	return tmp
    
    a, b, eps = sort([a, b, eps])
    function code(a, b, eps)
    	tmp = 0.0
    	if (b <= 1.35e-121)
    		tmp = Float64(1.0 / b);
    	else
    		tmp = Float64(1.0 / a);
    	end
    	return tmp
    end
    
    a, b, eps = num2cell(sort([a, b, eps])){:}
    function tmp_2 = code(a, b, eps)
    	tmp = 0.0;
    	if (b <= 1.35e-121)
    		tmp = 1.0 / b;
    	else
    		tmp = 1.0 / a;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: a, b, and eps should be sorted in increasing order before calling this function.
    code[a_, b_, eps_] := If[LessEqual[b, 1.35e-121], N[(1.0 / b), $MachinePrecision], N[(1.0 / a), $MachinePrecision]]
    
    \begin{array}{l}
    [a, b, eps] = \mathsf{sort}([a, b, eps])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 1.35 \cdot 10^{-121}:\\
    \;\;\;\;\frac{1}{b}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{a}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 1.3500000000000001e-121

      1. Initial program 0.0%

        \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
      2. Taylor expanded in eps around 0

        \[\leadsto \color{blue}{\frac{a + b}{a \cdot b}} \]
      3. Step-by-step derivation
        1. associate-/r*N/A

          \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{\frac{a + b}{a}}{\color{blue}{b}} \]
        3. lower-/.f64N/A

          \[\leadsto \frac{\frac{a + b}{a}}{b} \]
        4. +-commutativeN/A

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
        5. lower-+.f6499.8

          \[\leadsto \frac{\frac{b + a}{a}}{b} \]
      4. Applied rewrites99.8%

        \[\leadsto \color{blue}{\frac{\frac{b + a}{a}}{b}} \]
      5. Taylor expanded in a around inf

        \[\leadsto \frac{1}{b} \]
      6. Step-by-step derivation
        1. Applied rewrites70.8%

          \[\leadsto \frac{1}{b} \]

        if 1.3500000000000001e-121 < b

        1. Initial program 0.0%

          \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
        2. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{1}{a}} \]
        3. Step-by-step derivation
          1. inv-powN/A

            \[\leadsto {a}^{\color{blue}{-1}} \]
          2. lower-pow.f6485.3

            \[\leadsto {a}^{\color{blue}{-1}} \]
        4. Applied rewrites85.3%

          \[\leadsto \color{blue}{{a}^{-1}} \]
        5. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto {a}^{\color{blue}{-1}} \]
          2. inv-powN/A

            \[\leadsto \frac{1}{\color{blue}{a}} \]
          3. lower-/.f6485.3

            \[\leadsto \frac{1}{\color{blue}{a}} \]
        6. Applied rewrites85.3%

          \[\leadsto \frac{1}{\color{blue}{a}} \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 5: 49.4% accurate, 29.1× speedup?

      \[\begin{array}{l} [a, b, eps] = \mathsf{sort}([a, b, eps])\\ \\ \frac{1}{a} \end{array} \]
      NOTE: a, b, and eps should be sorted in increasing order before calling this function.
      (FPCore (a b eps) :precision binary64 (/ 1.0 a))
      assert(a < b && b < eps);
      double code(double a, double b, double eps) {
      	return 1.0 / a;
      }
      
      NOTE: a, b, and eps should be sorted in increasing order before calling this function.
      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(a, b, eps)
      use fmin_fmax_functions
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8), intent (in) :: eps
          code = 1.0d0 / a
      end function
      
      assert a < b && b < eps;
      public static double code(double a, double b, double eps) {
      	return 1.0 / a;
      }
      
      [a, b, eps] = sort([a, b, eps])
      def code(a, b, eps):
      	return 1.0 / a
      
      a, b, eps = sort([a, b, eps])
      function code(a, b, eps)
      	return Float64(1.0 / a)
      end
      
      a, b, eps = num2cell(sort([a, b, eps])){:}
      function tmp = code(a, b, eps)
      	tmp = 1.0 / a;
      end
      
      NOTE: a, b, and eps should be sorted in increasing order before calling this function.
      code[a_, b_, eps_] := N[(1.0 / a), $MachinePrecision]
      
      \begin{array}{l}
      [a, b, eps] = \mathsf{sort}([a, b, eps])\\
      \\
      \frac{1}{a}
      \end{array}
      
      Derivation
      1. Initial program 0.0%

        \[\frac{\varepsilon \cdot \left(e^{\left(a + b\right) \cdot \varepsilon} - 1\right)}{\left(e^{a \cdot \varepsilon} - 1\right) \cdot \left(e^{b \cdot \varepsilon} - 1\right)} \]
      2. Taylor expanded in a around 0

        \[\leadsto \color{blue}{\frac{1}{a}} \]
      3. Step-by-step derivation
        1. inv-powN/A

          \[\leadsto {a}^{\color{blue}{-1}} \]
        2. lower-pow.f6449.4

          \[\leadsto {a}^{\color{blue}{-1}} \]
      4. Applied rewrites49.4%

        \[\leadsto \color{blue}{{a}^{-1}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto {a}^{\color{blue}{-1}} \]
        2. inv-powN/A

          \[\leadsto \frac{1}{\color{blue}{a}} \]
        3. lower-/.f6449.4

          \[\leadsto \frac{1}{\color{blue}{a}} \]
      6. Applied rewrites49.4%

        \[\leadsto \frac{1}{\color{blue}{a}} \]
      7. Add Preprocessing

      Developer Target 1: 100.0% accurate, 13.4× speedup?

      \[\begin{array}{l} \\ \frac{1}{a} + \frac{1}{b} \end{array} \]
      (FPCore (a b eps) :precision binary64 (+ (/ 1.0 a) (/ 1.0 b)))
      double code(double a, double b, double eps) {
      	return (1.0 / a) + (1.0 / b);
      }
      
      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(a, b, eps)
      use fmin_fmax_functions
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8), intent (in) :: eps
          code = (1.0d0 / a) + (1.0d0 / b)
      end function
      
      public static double code(double a, double b, double eps) {
      	return (1.0 / a) + (1.0 / b);
      }
      
      def code(a, b, eps):
      	return (1.0 / a) + (1.0 / b)
      
      function code(a, b, eps)
      	return Float64(Float64(1.0 / a) + Float64(1.0 / b))
      end
      
      function tmp = code(a, b, eps)
      	tmp = (1.0 / a) + (1.0 / b);
      end
      
      code[a_, b_, eps_] := N[(N[(1.0 / a), $MachinePrecision] + N[(1.0 / b), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \frac{1}{a} + \frac{1}{b}
      \end{array}
      

      Reproduce

      ?
      herbie shell --seed 2025101 
      (FPCore (a b eps)
        :name "expq3 (problem 3.4.2)"
        :precision binary64
        :pre (and (and (<= (fabs a) 710.0) (<= (fabs b) 710.0)) (and (<= (* 1e-27 (fmin (fabs a) (fabs b))) eps) (<= eps (fmin (fabs a) (fabs b)))))
      
        :alt
        (! :herbie-platform default (+ (/ 1 a) (/ 1 b)))
      
        (/ (* eps (- (exp (* (+ a b) eps)) 1.0)) (* (- (exp (* a eps)) 1.0) (- (exp (* b eps)) 1.0))))