Skip to content

Instantly share code, notes, and snippets.

@pzwang
Created April 24, 2014 05:00
Show Gist options
  • Save pzwang/11242062 to your computer and use it in GitHub Desktop.
Save pzwang/11242062 to your computer and use it in GitHub Desktop.
bokeh example plot showing problems with Javascript integer precision
import numpy as np
from bokeh.plotting import *
N = 10
import sys
output_file("bigint.html", title="bigint example")
for div in (1, 10, 100, 1000, 10000, 100000, 1000000):
bigint = sys.maxint / 2 / div - 100
x = range(bigint, bigint+10)
y = range(10)
scatter(x, y, color="blue", title="%d Digits" % len(str(bigint)))
xaxis().major_label_orientation = np.pi/4
show()
@pzwang
Copy link
Author

pzwang commented Apr 24, 2014

Things are broken beyond 15 digits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment