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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:40:37+00:00 2026-06-17T18:40:37+00:00

I have a value range, say the iPhone screen size 480×320. I have a

  • 0

I have a value range, say the iPhone screen size 480×320. I have a position that may be outside the range, let’s say the position’s x coordinate is 600 for example.

In order to adjust the x coordinate to its on-screen position I can do: 600 – 480 = 120

But when the value is greater than two times 480 I’d have to run a loop, subtract 480 until the resulting number is below 480.

I know there’s an optimization to this problem revolving around division/modulo but I just can’t find a good answer (or question) related to this. Mainly because I can only guess possibly helpful search phrases.

I’m feeling sick today and for the live of me I can’t wrap my head around it. I’d welcome any pointers, even a “close as duplicate”.

PS: this is for Objective-C but any language will do.

  • 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-17T18:40:39+00:00Added an answer on June 17, 2026 at 6:40 pm

    You are looking for the modulo operator. The solution for the case of a width of 480 is:

    x % 480
    

    Modulo will guarantee that the resulting value is between 0 and 479.

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

Sidebar

Related Questions

I have an integer value that spans a range so large it is impractical
So let say I have an array of size 10 with index range from
I have a form with a System.Windows.Forms.NumericUpDown control. Say that the range is from
Lets say I have an image in double that goes from range 0.0 to
I have a regular expression which allows the value range '1111' - '999999', excluding
Hi guys I have made a JqueryUI simple slider,on certain value range I make
I have a string: Range(T4).Value = Rule 13s voilation I want to write 13s
I have the below code: Sheet1.Range(AB3).Value = Application.WorksheetFunction.AverageIfs( _ .Range(AB5:AB & CStr(i)), _ .Range(AB5:AB
Let's say I have a range from 0 to 10: range = 0...10 Three
I have a problem while dealing with a data set which the value range

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.