Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 12, 2022 03:05
Show Gist options
  • Save galenseilis/6400a277fc23640541ff1dccd1d613b0 to your computer and use it in GitHub Desktop.
Save galenseilis/6400a277fc23640541ff1dccd1d613b0 to your computer and use it in GitHub Desktop.
from math import exp, log1p
l1 = -3006
l2 = -3012
def logsum(l1, l2):
return max(l1, l2) + log1p(exp(-abs(l1-l2)))
print(logsum(l1, l2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment