We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › interpreting 4 bytes as a double
Page Index Toggle Pages: 1
interpreting 4 bytes as a double (Read 686 times)
interpreting 4 bytes as a double
Apr 14th, 2010, 7:47pm
 
i'm pulling bytes off of a data stream using myClient.read() and I can pack those 4 bytes into a long, but I dont know how to reinterpret the data in the long as a double.  If it helps, the double im supposed to get is BIG-endian.  Any thoughts?    Embarrassed


thanks!
Re: interpreting 4 bytes as a double
Reply #1 - Apr 14th, 2010, 9:06pm
 
Re: interpreting 4 bytes as a double
Reply #2 - Apr 15th, 2010, 1:22am
 
Wasn't that question answered in 4-Byte Floats thread (mmm, close, it was about floats, not doubles.)

BTW, 4 bytes fit in an int, no need for a long there. And if you need a double, just cast the float to double.
Page Index Toggle Pages: 1