Skip to content

Commit

Permalink
#70 more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Baumgold committed Mar 28, 2021
1 parent 945c232 commit e76dd5c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/TableView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,17 @@ function _showtable_async!(w, schema, names, types, rows, coldefs, tablelength,
onimport(w, handler)
end

_is_javascript_safe(x::Integer) = -(Int64(2)^53-1) < x < Int64(2)^53-1
_is_javascript_safe(x::AbstractFloat) = -(Float64(2)^53-1) < x < Float64(2)^53-1
function _is_javascript_safe(x::Integer)
min_safe_int = -(Int64(2)^53-1)
max_safe_int = Int64(2)^53-1
min_safe_int < x < max_safe_int
end

function _is_javascript_safe(x::AbstractFloat)
min_safe_float = -(Float64(2)^53-1)
max_safe_float = Float64(2)^53-1
min_safe_float < x < max_safe_float
end

# directly write JSON instead of allocating temporary dicts etc
function table2json(schema, rows, types; requested = nothing)
Expand Down

0 comments on commit e76dd5c

Please sign in to comment.