Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:16:52+00:00 2026-06-10T15:16:52+00:00

So I have an openCL program where some of the variables are in float2

  • 0

So I have an openCL program where some of the variables are in float2 and some are in double2. And I would like to either upcast or downcast these variables but I am not sure how to do it. I tried to explicitly casting it like how I would normally do for float and double but it didn’t work.

float2 a,b;
double2 c,d;

a = (float2)(c+d); //didnt work
a = float2(c+d);  //didnt work

Maybe I am not understanding the type “float2” and “double2”, could someone tell me how to cast them in order to work properly?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:16:54+00:00Added an answer on June 10, 2026 at 3:16 pm

    The floatn and doublen type families represent vectors of values (in your case they have 2 members). A C-style conversion does not work on them.

    There is a family of conversion functions that work for vectors that look like this:

    convert_float2(vec2)
    

    However, reading the documentation here it looks like conversion from/to double2 is not supported. That leaves you with the option of performing the conversions manually:

    a.x = float(c.x + d.x);
    a.y = float(c.y + d.y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which draws some terrain and simulates water flowing over it
I have a program to which I'm adding fullscreen post-processing effects. I do not
I'm working on some cross-platform code using OpenGL and SDL, but have immediately run
I'm new with OpenCL and have some problems with the array additions I use
I have an OpenGL program in which I am doing some augmented reality work.
i have a program that does some GPU computing with Optional OpenGL rendering. The
I have a program do so some graphics. When I run it interactively, I
I have written a simple OpenGL program in C++ that displays a line joining
i have made a small opengl program using the d programming language. what i
I have a program (NWShader) which hooks into a second program's OpenGL calls (NWN)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.