Reinterpret byte to Float in julia

Note also that it is probably easier to use read! for this sort of thing. Allocate an uninitialized Float64 array of the desired size, then read! into it — that way no reinterpret is required, and the sizeof(Float64) factor in the number of bytes to read is included automatically.

For example:

a = Array{Float64}(undef, m, n) # allocate uninitialized m×n array of Float64
read!(f, a) # read from f into a, in column-major order
4 Likes