For some reason I get a different value when i do "local resXfrq = res * freq" "x / resXfreq" than when I do " x / res * freq"

I am making a Perlin noise script to spawn trees. And when I make a variable for resolution * frequency and divide x by it, it gives a different value than when do x / resolution * frequency.

Here is a screenshot of the trees with the variable:

And here it is without the variable (What it’s supposed to look like):

local function getHeight(x, y, resolution, frequency, amplitude)
	local resXfreq = resolution * frequency -- this is the variable
	
	-- this is the Output (picture below):
	debugOutput:print(x / resolution * frequency .. " : " .. y / resolution * frequency) -- doing this works
	debugOutput:print(x / resXfreq .. " :: " .. y / resXfreq) -- and this gives a diffent value
	
	local noiseHeight = math.noise(
		x / resolution * frequency, -- heres where it goes
		y / resolution * frequency
	)
	
	--[[
	Heres what it looks like with the variable
	
	local noiseHeight = math.noise(
		x / resXfreq, -- heres where it goes
		y / resXfreq
	)
	]]--
	
	noiseHeight = math.clamp(noiseHeight, -NOISEBUFFER, NOISEBUFFER) + NOISEBUFFER
	return noiseHeight * amplitude
end

single colon is the x / resolution * frequency and a double is x / resXfreq

oh wait i get it now
my bad 30charact

local resXfreq = resolution * frequency

– this is the Output:|
debugOutput:print(x / resolution * frequency … : … y / resolution * frequency) – doing this gives differnt result than this:
debugOutput:print(x / resXfreq … :: … y / resXfreq)
but it should give the same result because it doesn’t matter in what order you multiply or divide

im not sure, but try setting local resXfreq = 0.001 before local resXfreq = resolution * frequency

i mean right in the line above

didn’t work

sry 30charactars bla blah

They are not the same expressions.

local a,b,c = 2,4,6
print(a/b * c); print(2/4 * 6) --> 3
-- may be written as
print((a*c) / b); print((2*6) / 4) --> 3
-- versus
print(a / (b*c)); print(2 / (4*6)) --> 0.0833 or 1/12

resXfreq would be (b * c).