1

having a small question on decimal places! I have 4 cubes that scales evenly within X value. Count = y = 4. Value = x = 5. Default fault = 1(scale)

I want to have two mode where one tells u the max amount of scale being input which is 5 while the other mode tells you the even scale value in-between of each cube. And I can toggle between these two mode. Mode A = 5. Mode B = 1.333~

Now my formula from A to B is ((5(Max value)-1(default value))/(4(count)-1(we don't count the 1st cube)) +1. Short form =((5-1)/(4-1))+1. Which is 1.333. 1st cube = 1. 2nd cube = 2.333~. 3rd cube = 3.666~. 4th cube = 4.999~

From B back to A is ((5(max value)-1(default value))*(4(count)-1))+1. Short form =((5-1)/(4-1))+1 But now my max value is 4.999 instead of 5. I need to toggle these two mode but there is this 0.000000001~ value missing. Is there a better formula to compute this?

Elson Kwek
  • 31
  • 1
  • 4
  • Pardon my poor English or explaining skills. So basically 5 to 1.333 then back to 4.999. how do I formula it better to get back to 5? Any tips is deeply appreciated! – Elson Kwek Oct 10 '18 at 00:56
  • Do I need to round it off? Like an extra function to detect 0.999~ then round it off. – Elson Kwek Oct 10 '18 at 01:02
  • As the linked question explains, you can define all your number variables as `Decimal` objects instead. Remember to initialize the objects with strings rather than number literals. – blhsing Oct 10 '18 at 01:08
  • @blhsing thank you! Will have a good read up on the doc! – Elson Kwek Oct 10 '18 at 02:09

0 Answers0