Search the Community
Showing results for tags 'logerithms'.
Found 1 result
-
math Match numbers place increase
NumbNutsJunior posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
What I am trying to do probably makes no sense, and I really have no idea what i'm doing in this place of algebra but here is my problem ... I am trying to populate a list of values from min (x) to max (y) increasing the values by the step amount (z) easy enough, but I want to have the step value increase in size as the numbers get larger and larger so I don't have a list the size 'max / step', if max is say 5000000. So once the current value reaches another place the step value matches in increase by the same amount: min(0); max(5000000); starting step(2500); + 2500 +25000 +250000 Expected output: [0, 2500, 5000, 7500, 10000, 25000, 50000, 75000, 100000, 125000, ... , 975000, 1000000, 1250000, ... ] Below is probably just a bunch of junk, so maybe cover your eyes from this part, as It likely will lead you no where but I would not really know ... // Limits _min_value = 0; _max_value = 5000000; // Init _values = []; _current_value = _min_value; // Init loop variables _value_step = 2500; _step_power = floor(log _value_step); _base_step = _value_step / (10 ^ _step_power); // Populate values while {_current_value <= _max_value} do { // Push to value list _values pushBack _current_value; // Figure step amount _current_value_power = floor(log _current_value); _value_step = _base_step * (10 ^ _current_value_power); _powers_difference = _current_value_power - _step_power; // ... // Update current value _current_value = _current_value + _value_step; }; I figured this fell into the category of logarithms but I am apparently not very good at learning and using them as I have been stuck on trying to complete this problem all day. Please help 🙂 Note: I would like to figure this problem without a bunch of 'if' or 'switch' statements, just good old reliable math