Average Error: 3.7 → 0
Time: 3.9s
Precision: binary64
\[\left(\left(\left(-14 \leq a \land a \leq -13\right) \land \left(-3 \leq b \land b \leq -2\right)\right) \land \left(3 \leq c \land c \leq 3.5\right)\right) \land \left(12.5 \leq d \land d \leq 13.5\right)\]
\[\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2 \]
\[\left(\log \left(e^{c + \left(a + d\right)}\right) + b\right) \cdot 2 \]
(FPCore (a b c d) :precision binary64 (* (+ a (+ b (+ c d))) 2.0))
(FPCore (a b c d) :precision binary64 (* (+ (log (exp (+ c (+ a d)))) b) 2.0))
double code(double a, double b, double c, double d) {
	return (a + (b + (c + d))) * 2.0;
}
double code(double a, double b, double c, double d) {
	return (log(exp((c + (a + d)))) + b) * 2.0;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = (a + (b + (c + d))) * 2.0d0
end function
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = (log(exp((c + (a + d)))) + b) * 2.0d0
end function
public static double code(double a, double b, double c, double d) {
	return (a + (b + (c + d))) * 2.0;
}
public static double code(double a, double b, double c, double d) {
	return (Math.log(Math.exp((c + (a + d)))) + b) * 2.0;
}
def code(a, b, c, d):
	return (a + (b + (c + d))) * 2.0
def code(a, b, c, d):
	return (math.log(math.exp((c + (a + d)))) + b) * 2.0
function code(a, b, c, d)
	return Float64(Float64(a + Float64(b + Float64(c + d))) * 2.0)
end
function code(a, b, c, d)
	return Float64(Float64(log(exp(Float64(c + Float64(a + d)))) + b) * 2.0)
end
function tmp = code(a, b, c, d)
	tmp = (a + (b + (c + d))) * 2.0;
end
function tmp = code(a, b, c, d)
	tmp = (log(exp((c + (a + d)))) + b) * 2.0;
end
code[a_, b_, c_, d_] := N[(N[(a + N[(b + N[(c + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
code[a_, b_, c_, d_] := N[(N[(N[Log[N[Exp[N[(c + N[(a + d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision] * 2.0), $MachinePrecision]
\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\left(\log \left(e^{c + \left(a + d\right)}\right) + b\right) \cdot 2

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.7
Target3.8
Herbie0
\[\left(a + b\right) \cdot 2 + \left(c + d\right) \cdot 2 \]

Derivation

  1. Initial program 3.7

    \[\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2 \]
  2. Applied add-log-exp_binary643.7

    \[\leadsto \left(a + \left(b + \left(c + \color{blue}{\log \left(e^{d}\right)}\right)\right)\right) \cdot 2 \]
  3. Applied add-log-exp_binary643.7

    \[\leadsto \left(a + \left(b + \left(\color{blue}{\log \left(e^{c}\right)} + \log \left(e^{d}\right)\right)\right)\right) \cdot 2 \]
  4. Applied sum-log_binary643.7

    \[\leadsto \left(a + \left(b + \color{blue}{\log \left(e^{c} \cdot e^{d}\right)}\right)\right) \cdot 2 \]
  5. Applied add-log-exp_binary643.7

    \[\leadsto \left(a + \left(\color{blue}{\log \left(e^{b}\right)} + \log \left(e^{c} \cdot e^{d}\right)\right)\right) \cdot 2 \]
  6. Applied sum-log_binary642.8

    \[\leadsto \left(a + \color{blue}{\log \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)}\right) \cdot 2 \]
  7. Applied add-log-exp_binary642.8

    \[\leadsto \left(\color{blue}{\log \left(e^{a}\right)} + \log \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right) \cdot 2 \]
  8. Applied sum-log_binary641.5

    \[\leadsto \color{blue}{\log \left(e^{a} \cdot \left(e^{b} \cdot \left(e^{c} \cdot e^{d}\right)\right)\right)} \cdot 2 \]
  9. Taylor expanded in b around 0 0.1

    \[\leadsto \color{blue}{\left(\log \left(e^{c} \cdot \left(e^{d} \cdot e^{a}\right)\right) + b\right)} \cdot 2 \]
  10. Taylor expanded in d around inf 0.1

    \[\leadsto \left(\log \color{blue}{\left(e^{d} \cdot \left(e^{c} \cdot e^{a}\right)\right)} + b\right) \cdot 2 \]
  11. Simplified0

    \[\leadsto \left(\log \color{blue}{\left(e^{c + \left(a + d\right)}\right)} + b\right) \cdot 2 \]
  12. Final simplification0

    \[\leadsto \left(\log \left(e^{c + \left(a + d\right)}\right) + b\right) \cdot 2 \]

Reproduce

herbie shell --seed 2022129 
(FPCore (a b c d)
  :name "Expression, p6"
  :precision binary64
  :pre (and (and (and (and (<= -14.0 a) (<= a -13.0)) (and (<= -3.0 b) (<= b -2.0))) (and (<= 3.0 c) (<= c 3.5))) (and (<= 12.5 d) (<= d 13.5)))

  :herbie-target
  (+ (* (+ a b) 2.0) (* (+ c d) 2.0))

  (* (+ a (+ b (+ c d))) 2.0))