The main fix in this PR is hand-rolling the type casts from the first commit. Previously it was going through the python type system meaning that there aren't 2 kinds of ints, floats, etc.
Then I got sidetracked into performance tuning b/c some of the numbers surprised me. I need to clean this up, but am going to checkpoint now rather than make 2 prs etc.
The main fix in this PR is hand-rolling the type casts from the first commit. Previously it was going through the python type system meaning that there aren't 2 kinds of ints, floats, etc.
Then I got sidetracked into performance tuning b/c some of the numbers surprised me. I need to clean this up, but am going to checkpoint now rather than make 2 prs etc.