What do the > < signs in numpy dtype mean?

前端 未结 3 1340
野的像风
野的像风 2021-01-01 21:55

What is the difference between dtype=\'f\', dtype=\'f4\', dtype=\'>f4\', dtype\'? The syntax is not explained

3条回答
  •  萌比男神i
    2021-01-01 22:30

    I just had the same question and tried to search the answer online.

    'f' is the shorthand for 'float32'.

    'f4' also means 'float32' because it has 4 bytes and each byte has 8 bits.

    Similarly, 'f8' means 'float64' because 8*8 = 64.

    For the difference between '>f4' and '', it is related to how the 32 bits are stored in 4 bytes.

    ('>')Big Endian Byte Order: The most significant byte (the "big end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.

    ('<')Little Endian Byte Order: The least significant byte (the "little end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.

    Please see this link for more detailed information: https://chortle.ccsu.edu/AssemblyTutorial/Chapter-15/ass15_3.html

提交回复
热议问题