
(FPCore (a b) :precision binary64 (exp (+ (log a) (log b))))
double code(double a, double b) {
return exp((log(a) + log(b)));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = exp((log(a) + log(b)))
end function
public static double code(double a, double b) {
return Math.exp((Math.log(a) + Math.log(b)));
}
def code(a, b): return math.exp((math.log(a) + math.log(b)))
function code(a, b) return exp(Float64(log(a) + log(b))) end
function tmp = code(a, b) tmp = exp((log(a) + log(b))); end
code[a_, b_] := N[Exp[N[(N[Log[a], $MachinePrecision] + N[Log[b], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\log a + \log b}
\end{array}
herbie shell --seed 2024238
(FPCore (a b)
:name "Exp of sum of logs"
:precision binary64
:alt
(! :herbie-platform default (* a b))
(exp (+ (log a) (log b))))
Please file a bug report with this information.
| flexp2: contract violation expected: flonum? given: 0.043952488503085974+0.0i in: the 1st argument of (-> flonum? any) contract from: <pkgs>/math-lib/math/private/flonum/flonum-exp.rkt blaming: <pkgs>/herbie/core/logspace.rkt (assuming the contract is correct) at: <pkgs>/math-lib/math/private/flonum/flonum-exp.rkt:99:11 | L | C | |
|---|---|---|---|
| raise-blame-error | /usr/local/racket/collects/racket/contract/private/blame.rkt | 346 | 0 |
| (unnamed) | /usr/local/racket/collects/racket/contract/private/arrow-higher-order.rkt | 379 | 33 |
| log+ | /home/nightlies/herbie/bhargav-log-space/src/core/logspace.rkt | 52 | 0 |
| compiled-prog | /home/nightlies/herbie/bhargav-log-space/src/core/compiler.rkt | 26 | 2 |
| predict-errors | /home/nightlies/herbie/bhargav-log-space/src/core/explain.rkt | 88 | 0 |
| explain | /home/nightlies/herbie/bhargav-log-space/src/core/explain.rkt | 614 | 0 |
| explain! | /home/nightlies/herbie/bhargav-log-space/src/core/mainloop.rkt | 321 | 0 |
| run-improve! | /home/nightlies/herbie/bhargav-log-space/src/core/mainloop.rkt | 43 | 0 |
| get-alternatives/report | /home/nightlies/herbie/bhargav-log-space/src/api/sandbox.rkt | 184 | 0 |
| (unnamed) | /home/nightlies/herbie/bhargav-log-space/src/api/sandbox.rkt | 280 | 6 |
| (unnamed) | /usr/local/racket/share/pkgs/profile-lib/main.rkt | 40 | 10 |
| profile-thunk | /usr/local/racket/share/pkgs/profile-lib/main.rkt | 9 | 0 |
| (unnamed) | /usr/local/racket/collects/racket/engine.rkt | 42 | 24 |