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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:32:49+00:00 2026-06-11T20:32:49+00:00

I have three values that should in total come to 100 at all times

  • 0

I have three values that should in total come to 100 at all times

the user can only change one value at a time (by increments think slider it might not be single increments at a time)

when one value changes I want the others to also change to reflect the constant total, however on a pro rata basis

The larger of the other two values should increase more than the smaller value

but should decrease less than the smaller value

  • 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-11T20:32:51+00:00Added an answer on June 11, 2026 at 8:32 pm

    Not sure what you mean by “but should decrease less than the smaller value” – this seems to indicate it’s not pro-rata, especially if the ratios are maintained only in one direction.

    Assuming that’s a mistake, the way to pro-rata the non-moving values b and c is simply to maintain their ratio when the moving value a changes, something like:

    a = 50, b = 30, c = 20             # initial values
    aDelta = 10                        # how much to change 'a' by
    
    bDelta = -aDelta * b / (b + c)     # bDelta <- -6
    cDelta = -aDelta - bDelta          # cDelta <- -4
    
    a = a + aDelta                     # a <- 60
    b = b + bDelta                     # b <- 24
    c = c + cDelta                     # c <- 16
    

    You can see there that the ratio remains the same between b and c (30:20 and 24:16 are both 3:2), at least until the values get small enough for rounding errors to come into play (reducing them, then increasing them may not give you back the exact values you started with).

    If that’s important, you could consider using floating point for the values and simply turn them into integers as a final step.

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

Sidebar

Related Questions

Hi There I need to get the names and values of checkboxes that have
I have three radio buttons with same name and different values.When I click the
I have three tables filters (id, name) items(item_id, name) items_filters(item_id, filter_id, value_id) values(id, filter_id,
I have a dropdownlist having id=ddlTitle . It contains three values as mentioned below
I have an array called: $fragment = array($fragment); Which has the following three values:
I have a set of three double values as part of an anonymous expression
I have three simple html or php file that I'm going to create. What
Edit: I should have probably mentioned that I am extremely new to Java programming.
I have a form that uses PHP to calculate a total based on the
I have a table called Jrl with three columns: code AS varchar(15) total AS

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.