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 7806981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:42:29+00:00 2026-06-02T02:42:29+00:00

I noticed a very strange thing in my application. There are two static const

  • 0

I noticed a very strange thing in my application. There are two static const integers in my World class:

class World
{
  public:
    static const int CHUNK_SIZE_X = 32;
  private:
    static const int SHIFT_X;
};

The constant SHIFT_X is initialised in the corresponding *.cpp file:

const int World::SHIFT_X = Ogre::Math::Log2(World::CHUNK_SIZE_X);

Now the strange thing is that the value in SHIFT_X is 4 instead of 5. If I call Ogre::Math::Log2(32) from within an arbitrary method it correctly computes 5.

What the hell is going on here? I also need to say that this only happens under Windows 7 (with Visual Studio Express 10). My application also runs under GNU/Linux (Debian Squeeze) and there everything works fine.

  • 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-02T02:42:31+00:00Added an answer on June 2, 2026 at 2:42 am

    Ogre::Math::Log2 returns a Real which is actually a float and you are trying to store it as an int. Therefore if the value returned was 4.9999999999999998 it would still end up with 4 after the conversion. If you would like to continue using an int instead of a float you should round the value.

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

Sidebar

Related Questions

I noticed a strange thing about OpenCV. I used one of the basic sample
I have encountered a very strange thing today : I have an app installed
While creating the sample, I noticed very strange behavior and due to which I
While writing a Javascript inheritance function some time ago I noticed some very strange
i noticed a very strange way of naming classes in G+ and gmail.. example:
I noticed very strange behavior of my program today. Basically I have JToolBar uder
I just noticed a very strange behaviour. Why does a simple space break all
I am getting very strange flickering on a WPF application of mine. It only
I just noticed this strange rendering of a very simple form. Here's my markup/CSS:
I've noticed some very strange behaviour today in Code Igniter. I have this locations

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.