Added some more casts to double for typed arrays