Added magic float/int casting methods, for more compatibility with numpy