C++ writing and reading doubles from a binary file

前端 未结 4 1150
春和景丽
春和景丽 2021-01-06 04:45

I want to perform disk I/O operations for a program that takes too much RAM. I use matrices of doubles and think writing them to disk as bytes is the fastest way (I need to

4条回答
  •  萌比男神i
    2021-01-06 05:19

    He may have been referring to binary representation in general, not just sizeof.

    C - Serialization of the floating point numbers (floats, doubles)

    The spec doesn't specify binary representation of floating point numbers at all. Most compilers follow IEEE, so a little unit testing should ensure the behavior you want if you know your target platforms.

提交回复
热议问题