Skip to content

Instantly share code, notes, and snippets.

@mdouze
Last active January 9, 2019 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdouze/efc94c57e2302469287b9d1a2501d277 to your computer and use it in GitHub Desktop.
Save mdouze/efc94c57e2302469287b9d1a2501d277 to your computer and use it in GitHub Desktop.
import numpy as np
a = np.array([12345], dtype='float32')
b = np.array([12343], dtype='float32')
diff = (a * a).sum() + (b * b).sum() - 2 * np.dot(a, b)
# diff = 0 instead of the expected 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment