Tonight while updating the Harrisburg Crime Tracker to use Transit (more on how shared data representations help later), I ran into a small issue I didn’t find a whole lot of documentation on and wasn’t immediately obvious to me at first, so I thought I’d share the solution.
I’m storing latitudes and longitudes in Postgres (using the
type), which become Java
BigDecimals. These are encoded in the
Transit format as
“arbitrary precision decimal” with the
If you’re not paying attention, you might assume you’ll just get a
arithmetic, on second thought you
realize that sort of defeats the purpose. Instead, what
provides is a
So how to turn that into a normal float?