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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:03:14+00:00 2026-05-23T10:03:14+00:00

In my program I have a #define MAXIMUM_SCALE 10 at the top The only

  • 0

In my program I have a #define MAXIMUM_SCALE 10 at the top

The only time this constant is EVER used is in this section of code:

float newScale = [scrollView zoomScale] * ZOOM_STEP;
NSLog(@"%f", newScale);
NSLog(@"lol %f", MAXIMUM_SCALE);

if( [scrollView zoomScale] < MAXIMUM_SCALE){
    [self handleZoomWith:newScale andZoomType: TRUE];
}

Some how, the NSLog’s are printing out that MAXIMUM_SCALE is the same as newScale

i.e. ( 1.500000 lol 1.500000 2.250000 lol 2.250000)

Why is this happening?

  • 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-23T10:03:15+00:00Added an answer on May 23, 2026 at 10:03 am

    When you use #define MAXIMUM_SCALE 10, you are defining an integer constant, not a float. I am guessing that your code is being compiled for x86-64. In that architecture, floating point and integer variables are passed through different types of registers. Since the second call to NSLog doesn’t use any floating point arguments, the value from the previous call will still be in the register which is used to retrieve the value, which means you get the value from the previous call every time. You should be getting a compiler warning on the second NSLog telling you that the arguments don’t match the passed format. You can fix this by telling the compiler that MAXIMUM_SCALE should be floating point.

    #define MAXIMUM_SCALE 10.0f
    

    The decimal tells the compiler that you want a floating point number instead of an integer, and the f tells the compiler to use the float type instead of double.

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

Sidebar

Related Questions

in a C program I have this variable: float (*data)[3]; data = (float (*)[3])calloc(ntimes,
I have a problem with an application I'm currently developing. In this program I
I have spent many hours working on this program that is supposed to play
I am new to the Zend Framework, and this code is used for downloading
i am try a program of Struts to show french value...for this i have
i have to define a variable that i am using in a program but
I have to define a large array (lookup table) in a code. It contains
We would like to have user defined formulas in our c++ program. e.g. The
I'm working on a java program, and I have several vectors defined and filled
I have a C program which has a function call that is defined in

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.