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

  • Home
  • SEARCH
  • 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 6186783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:56:50+00:00 2026-05-24T01:56:50+00:00

I have a problem. I am calculating position of some points for opengl rendering.

  • 0

I have a problem.
I am calculating position of some points for opengl rendering.
But calculations are wrong and it results with one pixel overlap on rendered image.
And its a serious problem because it looks nasty.
Strangest thing is that error occurs with simple addition.

I am just adding 0.02 for every row and column and there is a 0,009 from nowhere.
Any ideas where its coming from?
I have tried to change compiler from arm7 to arm and it does not help

code :

for (int i=0;i<elem;i++)
    {
        LOGE("ROW: %d",i);

        startPosX = -(float)elem*vertSize/2.0f + vertSize/2.0f;

        for (int j=0;j<elem;j++)
        {
            LOGE("Column: %d",j);
            LOGE("x: %f  y: %f  vs:%f",startPosX,startPosY,vertSize);

            Vvertices[((i*elem*3)+j*3+0)] = startPosX;
            Vvertices[((i*elem*3)+j*3+1)] = startPosY;
            Vvertices[((i*elem*3)+j*3+2)] = z;              

            positions[i*elem+j].Set( startPosX, startPosY, z );

            if(randomType)
                velocity[i*elem+j].Set(getRandom()/speed,getRandom()/speed,getRandom()/speed);
            else
                velocity[i*elem+j].Set(0.0f,0.1f/speed,0.0f);

            startPosX+=vertSize;
        }
        startPosY +=vertSize;

    }

Column: 85
x: 0.710000 y: 0.989999 vs:0.020000

Column: 86
x: 0.729999 y: 0.989999 vs:0.020000

  • 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-05-24T01:56:51+00:00Added an answer on May 24, 2026 at 1:56 am

    When you need assured precision for mathematical calculations it can sometimes be a bad idea to use types such as float, because many numbers do not have a finite representation in binary, just like some fractions do not have a finite representation in decimal.

    This problem has to do with the machine representation of the numbers and not with the programming language you are using itself. Many languages with the typical ways of handling float and double types have this issue.

    In Java people use classes such as BigDecimal to deal with this kind of problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two figures, one is a data plot resulting from some calculations and
I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem when I try insert some data to Informix TEXT column via
I have a serious problem with calculating Standard Deviation within subgroup in SSRS/SQl (whichever
I have a problem with combining or calculating common/equal part of these two dictionaries.
I have a problem with a game i am programming. I am making some
I have a problem calculating the distance between two geopoints. The geopoints are: position1
I have a problem with my client side script not calculating the same values
I have problem with return statment >.< I want to store all magazine names

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.