Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-04

OpenCL, Re: C Hex Float.

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dmitry boyarintsev

Anyway. does FPC community need converted OpenCL headers? i'd like to share them.
Should they be converted to the proper structure first (/src, make, fpmake)? there're only 2 files anyway.

I still have not found any reasonable way to convet c-hex-float number to pascal.
i'm not sure if it's nice (and cross-platform) to declare, something like this:

const
  CL_FLT_MAX : double = double($FFFFFFFF);

thanks,
dmitry

Show quoted text 11 lines
Does anyone have an experience with converting hex-float numbers from C to Pascal?  CL_FLT_MAX          0x1.fffffep127f  CL_FLT_MIN          0x1.0p-126f  CL_FLT_EPSILON      0x1.0p-23f  CL_DBL_MAX          0x1.fffffffffffffp1023  CL_DBL_MIN          0x1.0p-1022  CL_DBL_EPSILON      0x1.0p-52 any suggestions?

Reply by email

Marco van de Voort
to dmitry boyarintsev

In our previous episode, dmitry boyarintsev said:

Anyway. does FPC community need converted OpenCL headers? i'd like to share them.

I'm working in vision, and I'd be very interested in OpenCL headers.

Should they be converted to the proper structure first (/src, make, fpmake)? there're only 2 files anyway.

Don't worry. I'll do the packaging if needed. I prefer to have a bunch of examples that test them though.

I still have not found any reasonable way to convet c-hex-float number to pascal.

I think this way is done to make the floating point constants portable. Maybe it works if you hand shift it, something like

Show quoted text 5 lines
i'm not sure if it's nice (and cross-platform) to declare, something like this: const CL_FLT_MAX : double = double($FFFFFFFF);

No it is not :) See also e.g. unit "typ" in unit numlib for ways to do it CPU specific.

I tried to test with calculation, but it seems fpc/Delphi don't support that (something like:

const x =  -double($9abc) shl $12;  // sign (mantisse) SHL exponent

)

Reply by email

dmitry boyarintsev
to Marco van de Voort

thanks for the reply Marco

I'm working in vision, and I'd be very interested in OpenCL headers.

you can download converted headers from here:
http://wnsoft.com/~dima/opencl.zip

original c headers are available here:
http://www.khronos.org/registry/cl/

cl.h and cl_platform.h is united into cl.pas file
cl_gl.h is converted to cl_gl.pas.

I did not tested anything, yet. Just made a straight c to pascal convertion. But, in theory, this should be enough.

thanks,
dmitry

Reply by email