• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binary floating point format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binary floating point format


  • Subject: Re: Binary floating point format
  • From: Greg Parker <email@hidden>
  • Date: Thu, 30 Mar 2017 21:06:34 -0700

> On Mar 30, 2017, at 9:03 PM, Carl Hoefs <email@hidden> wrote:
>
>> On Mar 30, 2017, at 8:10 PM, Greg Parker <email@hidden <mailto:email@hidden>> wrote:
>>
>>> On Mar 30, 2017, at 7:09 PM, Carl Hoefs <email@hidden <mailto:email@hidden>> wrote:
>>>
>>> 26 C3 E9 E2 6C 6A 38 0C 46 C3 E9 E2 6C 6A 40 0B 46 C3 E9 E2 83 6A DC 0A 66 C3 E9 E2 83 6A 0E 0B
>>> A5 C3 EF E2 AF 6A 40 0B A5 C3 EF E2 C6 6A 40 0B C5 C3 F5 E2 C6 6A 16 0A C5 C3 F5 E2 DC 6A 0E 0B
>>> 26 C3 3C E3 9E 62 B2 09 26 C3 3C E3 9E 62 B2 09 26 C3 36 E3 B4 62 BA 08 06 C3 36 E3 CB 62 C2 07
>>> 45 C4 76 E3 44 6C 38 0C 25 C4 76 E3 5A 6C 06 0C 25 C4 76 E3 5A 6C DC 0A 05 C4 7D E3 70 6C DC 0A
>>
>>
>> Byte-swapped VAX type D might be right, but it's so easy to be off by a factor of 2 here that it's hard to trust any guess.
>>
>> Using CFSwapInt64() from CoreFoundation/CFByteOrder.h and from_vax_d8() from https://pubs.usgs.gov/of/2005/1424/ <https://pubs.usgs.gov/of/2005/1424/>, your bytes above are:
>> -41.7215935353
>> -49.7215935353
>> -49.7215935353
>> -49.7215935366
>> -49.7215935366
>> -57.7215935366
>> -57.7215935366
>> -82.9432328547
>> -82.9432328547
>> -82.9432328574
>> -82.9432328574
>> -98.9432786338
>> -98.9432786338
>> -98.9432786363
>> -98.9432786363
>> -41.7219100388
>>
>
> Enticing results!  When I use CFSwapInt64(), it does this to the bytes:
>
> - raw bytes: 69BF5DE3 9F530306
> - swp bytes: 0603539F E35DBF69
> * [04] time_base: 2400969845129752384725738662412037010364031309686872696685853017835577483033453697155629104443247189829603912142488904070729903714756009814926441089319983058422454699494905107871645497808138444180815872.000000
>
> The 'time_base' value is what I get when I printf the swapped-bytes value with a %f formatter.
> Not sure why you're getting good results...

CFSwapInt64() is not sufficient. I used CFSwapInt64() followed by from_vax_d8() from the USGS URL above. The latter is what performs the real floating-point format transformation from VAX to IEEE.


--
Greg Parker     email@hidden <mailto:email@hidden>     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Binary floating point format
      • From: Carl Hoefs <email@hidden>
References: 
 >Binary floating point format (From: Carl Hoefs <email@hidden>)
 >Re: Binary floating point format (From: Steve Bird <email@hidden>)
 >Re: Binary floating point format (From: Carl Hoefs <email@hidden>)
 >Re: Binary floating point format (From: Greg Parker <email@hidden>)
 >Re: Binary floating point format (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Re: Binary floating point format
  • Next by Date: Re: Binary floating point format
  • Previous by thread: Re: Binary floating point format
  • Next by thread: Re: Binary floating point format
  • Index(es):
    • Date
    • Thread