4.3 and Divide by 0

UI and Macro
In 4.3 PTR it appears dividing by 0 is no longer working

so

local inf = 1/0

or

local serNaN = tostring(0/0)

or other similar number or hacks. A lot of mods are using these and they are not functional on PTR.

Intended change, or just a bug, don't know yet. Have to wait and see what blizzard says about this.
At this stage of the PTR, I don't think any addons even get loaded. (Unless they're all just marked "out of date" and you have to hit the box again and I forgot.)


And X/0 is not infinity. In fact it's not even possible to compute.

And what possible reason could you have for including something like this in an addon?

And what possible reason could you have for including something like this in an addon?
Stat calculations, averages, etc. and relying on it silently failing.

Also, you already get errors when dividing by zero if you output the results.

E.g. print(1/0) -- prints "1.#INF".

Lua does not throw errors when dividing by zero, so it's likely Blizzard debugging code has been enabled, they will probably disable it later on.

___________________________

<<It doesn't work the way I want it to, so it must be bugged.>>
www.wowpedia.org/User:Egingell
wow.curse.com/members/egingell.aspx
actually toc on current build was still 40200 so it loaded addons without "load out of date" which is another oversight i'm sure. every mod not using divide by 0 is actually working flawlessly.
Ah, so Combuctor must divide by zero then, and Recount, and EliteFrame, and all my other addons that didn't load last night.
A few libs are affected, so a lot of other mods are affected indirectly. They will nil out when they try to call functions fromt he libs. such as bugsack failing because it can't work right with ace serializer.
local serNaN = tostring(math.log(-1))
local serInf = tostring(math.huge)
local serNegInf = tostring(-math.huge)

seems to do the job for now
local inf = math.huge

fixes libcrayon

but same fix in libtourist hangs the UI in deadlock, sigh.
found this useful

http://www.gammon.com.au/scripts/doc.php?general=lua_math
Does math.log(-1) actually work in your PTR client? It crashes mine with a FLT_INVALID_OPERATION exception, even with the scriptProfile CVar off.

It looks like floating point overflow also causes the game to crash:
local a=1000^1000; -- FLT_OVERFLOW
And X/0 is not infinity. In fact it's not even possible to compute.

And what possible reason could you have for including something like this in an addon?


They're not trying to actually get a numerical answer that you could count to. I recommend doing some googling on floating-point math, NaNs, normalized and denormalized numbers and their representations, etc.
Quick sanity check: what does

/dump _VERSION (with leading underscore)

print out on the PTR?
Quick sanity check: what does

/dump _VERSION (with leading underscore)

print out on the PTR?


"Lua 5.1"
Okay good, that's what I expected.
Does math.log(-1) actually work in your PTR client? It crashes mine with a FLT_INVALID_OPERATION exception, even with the scriptProfile CVar off.

It looks like floating point overflow also causes the game to crash:
local a=1000^1000; -- FLT_OVERFLOW


http://www.mysticalos.com/nan.jpg

yeah works for me ^ (see screen shot), mac client. 64bit OS X lion boot. No crashes at all, and the mods that were using it started working gloriously again when applying my changes. I dunno. i only tried it in ace serializer though.

looks like someone redirected this to PTR bug forum. is that a blue confirming it's not intended then?

Some have speculated 4.3 might have updated the lua compiler to a JIT one or something, which could have caused an issue like this to crop up. it'd be a step in right direction to use an optimized compiler instead of just interpreting lua byte code. such a bug can only happen if you are doing some very smart optimizations
lim 1/x = infinity
x->0
This is an intended change to keep the lua engine in line with changes to our game engine.
09/29/2011 01:49 PMPosted by Sorreal
I though 1/0 was an imaginary number...


That's what you get when you square (or even) root a negative number.
Why are you people trying to divide by zero anyhow?

Have you SEEN the result? It's not pretty.

Join the Conversation

Return to Forum