• 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: encoding a NSDecimalNumber as IEEE-754 on an intel mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: encoding a NSDecimalNumber as IEEE-754 on an intel mac


  • Subject: Re: encoding a NSDecimalNumber as IEEE-754 on an intel mac
  • From: Hidetomo Katsura <email@hidden>
  • Date: Mon, 9 Oct 2006 00:26:23 -0700

hello Tore,

it works on ppc only because EndianS64_NtoB() is a no-op on ppc.

  #define EndianS64_NtoB(value)               (value)

it's assigning a signed 64-bit integer value to aDouble (unwanted implicit type conversion) on i386 while it's assigning a double value to aDouble (no type conversion) on ppc.

do this instead:

double aDouble = [.... doubleValue];
CFSwappedFloat64 bigEndian = CFConvertFloat64HostToSwapped(aDouble);
[callData appendBytes:&bigEndian length:sizeof(bigEndian)];

// note: CFConvertFloat64HostToSwapped() is actually HostToBig().

regards,
katsura

On Oct 8, 2006, at 5:03 PM, Tore Halset wrote:

Hello.

I am trying to encode a NSDecimalNumber with objCType 'd' as IEEE-754 on a intel mac. It is working on a powerpc mac, but not on an intel mac. This is done as part of the HessianObjC framework to communicate between a cocoa client and a java server.

double aDouble = [.... doubleValue];
aDouble = EndianS64_NtoB(aDouble);
[callData appendBytes:&aDouble length:sizeof(aDouble)];

Perhaps double on intel macs are not encoded as IEEE-754 doubles? How can this be "fixed"? (I have googled a lot for this....)

- Tore.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: encoding a NSDecimalNumber as IEEE-754 on an intel mac
      • From: Tore Halset <email@hidden>
References: 
 >encoding a NSDecimalNumber as IEEE-754 on an intel mac (From: Tore Halset <email@hidden>)

  • Prev by Date: Re: Order [:.VIRUS.:]
  • Next by Date: WhackedTV - Adding Video Overlay (photoshop image with mask)
  • Previous by thread: encoding a NSDecimalNumber as IEEE-754 on an intel mac
  • Next by thread: Re: encoding a NSDecimalNumber as IEEE-754 on an intel mac
  • Index(es):
    • Date
    • Thread