Results 1 to 3 of 3

Thread: Math Function - fract -

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    1

    Math Function - fract -

    In description of function 'fract' on OpenCL Specification (pg. 164), I am not able to understand the second argument to fmin i.e. 0x1.fffffep-1f

    As per my understanding it is trying to subtract one from a value just less than 2.0

    Any clue !

  2. #2

    Re: Math Function - fract -

    I think 0x1.fffffep-1f means a number just under 2, divided by 2 (the p means 2^) (which would give you the biggest number just under one: 0.ffffff)

    how 0x1.fffffep-1 is different to 0x0.ffffff I'm not sure (not a c programmer), maybe you can't use a 0 before the . separator and so the 2nd form wouldn't be valid.

  3. #3
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: Math Function - fract -

    It's a hexadecimal float constant as supported by C99, and it is indeed the largest number < 1.0 which can be represented as single precision float. It's probably written with the 1 before the decimal point because that's how IEEE754 floats are actually stored, with an implicit leading 1 (unless it's a denormalized number). Then fffffe means all 23 mantissa bits are set to 1.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

Similar Threads

  1. Call to fract causing crash
    By PaulS in forum OpenCL
    Replies: 2
    Last Post: 10-16-2009, 08:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •