Maneesh Godbole wrote:What is the relation between the scale and the range? I am trying to understand what you mean by scaling in this context.
If you are trying to ensure the bounds, you can use something like Math.min and Math.max
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:Form the problem description, it looks like you need to
Translate each value by subtracting (minimum value)  (minimum of scale) Scale the result by multiplying by (maximum of scale  minimum of scale) / (maximum value  minimum value)
s ravi chandran wrote:
Darryl Burke wrote:Form the problem description, it looks like you need to
Translate each value by subtracting (minimum value)  (minimum of scale) Scale the result by multiplying by (maximum of scale  minimum of scale) / (maximum value  minimum value)
So, do i need to apply both these steps? also, what i tried just now was to use hardcoded values to test the working. so, I have a number range which is in ve and I have scale values which is in +ve. So, I take the +ve scale max, do a negation and set it as new number range min. then i take +ve scale min, do a negation and set it as new number range max. this works.. but this is specific and also for one particular scenario.
i can try the above scenario..
luck, db
There are no new questions, but there may be new answers.
s ravi chandran wrote:I tried the above logic, but it is failing in the first scenario itself. if my value is in negative. do i need to have an if else condition to calculate the bounds differently if value is in negative? also, if scaling is in negative, does it still apply?
"Leadership is nature's way of removing morons from the productive flow"  Dogbert
Articles by Winston can be found here
s ravi chandran wrote:I have done some stop gap arrangement for now. did not get time to come up with a good generic logic. the fix shd work for now...will get some proper time next time
"Leadership is nature's way of removing morons from the productive flow"  Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
s ravi chandran wrote:I have done some stop gap arrangement for now. did not get time to come up with a good generic logic. the fix shd work for now...will get some proper time next time
The epitaph for many a failed system, I fear. Have a look at my signature comment.
Winston
That new kid is a freak. Show him this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn KlassenKoop
https://coderanch.com/wiki/718759/books/BuildingWorldBackyardPaulWheaton
