View Single Post
stickz
Senior Member
Join Date: Oct 2012
Location: Ontario, Canada
Old 02-04-2019 , 11:21   Re: Solve Exponential Base
Reply With Quote #6

I have the following code now.
Code:
void WriteConsoleSkillValues(int client, float mult)
{
	for (int base = 1; base <= 10; base++)
	{
		float value = Pow(float(base), 1.0 / mult) * 100.0;
		PrintToConsole(client, "Round: %d% ^ %.2f = %d", RoundToNearest(value), mult, base);
	}
}
Which produces the following output.
Code:
--> Low Uneven Skill Percent Difference <--
Round: 100 ^ 1.75 = 1
Round: 149 ^ 1.75 = 2
Round: 187 ^ 1.75 = 3
Round: 221 ^ 1.75 = 4
Round: 251 ^ 1.75 = 5
Round: 278 ^ 1.75 = 6
Round: 304 ^ 1.75 = 7
Round: 328 ^ 1.75 = 8
Round: 351 ^ 1.75 = 9
Round: 373 ^ 1.75 = 10

--> High Uneven Skill Percent Difference <--
Round: 100 ^ 1.89 = 1
Round: 144 ^ 1.89 = 2
Round: 178 ^ 1.89 = 3
Round: 207 ^ 1.89 = 4
Round: 233 ^ 1.89 = 5
Round: 257 ^ 1.89 = 6
Round: 278 ^ 1.89 = 7
Round: 299 ^ 1.89 = 8
Round: 318 ^ 1.89 = 9
Round: 336 ^ 1.89 = 10

--> Even Skill Percent Difference <--
Round: 100 ^ 1.39 = 1
Round: 164 ^ 1.39 = 2
Round: 219 ^ 1.39 = 3
Round: 269 ^ 1.39 = 4
Round: 316 ^ 1.39 = 5
Round: 360 ^ 1.39 = 6
Round: 401 ^ 1.39 = 7
Round: 442 ^ 1.39 = 8
Round: 480 ^ 1.39 = 9
Round: 518 ^ 1.39 = 10
My code is rounding to ceiling instead to nearest like I want. Is there any way I can resolve this issue and calculate the nearest value instead?

Last edited by stickz; 02-04-2019 at 11:24.
stickz is offline