Fix #215: Helper for int and double now work as expected.

Can you cast `val` to `long`?