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

Re: Strange issue when converting from hex to float


  • Subject: Re: Strange issue when converting from hex to float
  • From: Andy Lee <email@hidden>
  • Date: Thu, 21 Jul 2005 14:57:19 -0400


On Jul 21, 2005, at 2:52 PM, Ian was here wrote:

I've tried several combos and they all yield a value
of zero.

float            fAlpha = alphaComp / 255.0f;

float                 fAlpha = (float)alphaComp /
255.0f;

float fAlpha = alphaComp / 255.0;


I don't know my operator precedences offhand, but I usually do something like:

float                 fAlpha = ((float)alphaComp) / 255.0f;

or even:

float                 fAlpha = ((float)alphaComp) / 255;

I'm pretty sure you want to force the cast to float with that first set of parens.

--Andy

_______________________________________________
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: Sherm Pendley <email@hidden>
References: 
 >Re: Strange issue when converting from hex to float (From: Ian was here <email@hidden>)

  • Prev by Date: Re: Strange issue when converting from hex to float
  • Next by Date: NSTableView: option-drag with only one row?
  • Previous by thread: Re: Strange issue when converting from hex to float
  • Next by thread: Re: Strange issue when converting from hex to float
  • Index(es):
    • Date
    • Thread