• 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
Strange issue when converting from hex to float
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange issue when converting from hex to float


  • Subject: Strange issue when converting from hex to float
  • From: Ian was here <email@hidden>
  • Date: Thu, 21 Jul 2005 09:54:23 -0700 (PDT)

I have written a method that converts hex values to
floating point numbers. I am having a really strange
problem occur in the conversion process.



// Convert each hex segment to decimal. This code
works fine!

long			alphaComp = strtol( alphaValue, NULL, 16 );
long			redComp = strtol( redValue, NULL, 16 );
long			greenComp = strtol( greenValue, NULL, 16 );
long			blueComp = strtol( blueValue, NULL, 16 );



The following code segment always returns zero!!??

// Convert each decimal number to float.

float			fAlpha = alphaComp / 255L;
float			fRed = alphaComp / 255L;
float			fGreen = alphaComp / 255L;
float			fBlue = alphaComp / 255L;


Any ideas would be greatly appreciated. Thank you.




____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

 _______________________________________________
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: Strange issue when converting from hex to float
      • From: Steve Bird <email@hidden>
    • Re: Strange issue when converting from hex to float
      • From: Will Mason <email@hidden>
    • Re: Strange issue when converting from hex to float
      • From: Dan Treiman <email@hidden>
    • Re: Strange issue when converting from hex to float
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: observeValueForKeyPath:ofObject:change:context:
  • Next by Date: Problems with Function Keys
  • Previous by thread: observeValueForKeyPath:ofObject:change:context:
  • Next by thread: Re: Strange issue when converting from hex to float
  • Index(es):
    • Date
    • Thread