On Sun, 01 Jan 2023 05:31:55 -0800
Bill Ross <bross_phobr...@sonic.net> wrote:

> Thanks! 
> 
> > Java is known to be big-endian ... your CPU is probably little-endian.   
> 
> $ lscpu | grep -i endian
> Byte Order: Little Endian 
> 
> > Numpy has the tools to represent an array of double BE.   
> 
> Is there a lower-level ndarray method that writes an array that could be
> used this way? 

One example:

numpy.array([1,2,3], dtype=">d").tobytes()
b'?\xf0\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x08\x00\x00\x00\x00\x00\x00'

numpy.array([1,2,3], dtype="<d").tobytes()
b'\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x08@'

_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to