Topic 4.3 and Divide by 0
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
Edited by Omegal on 9/28/11 10:26 PM (PDT)
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.
Rubyheart
Nesingwary
Rubyheart
90 Night Elf Hunter
13055
Edited by Rubyheart on 9/28/11 12:59 AM (PDT)
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?
Treader
Cenarion Circle
Treader
85 Night Elf Hunter
1285

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
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
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.
Rubyheart
Nesingwary
Rubyheart
90 Night Elf Hunter
13055
Ah, so Combuctor must divide by zero then, and Recount, and EliteFrame, and all my other addons that didn't load last night.
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
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.
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
local serNaN = tostring(math.log(-1))
local serInf = tostring(math.huge)
local serNegInf = tostring(-math.huge)

seems to do the job for now
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
Edited by Omegal on 9/28/11 1:53 PM (PDT)
local inf = math.huge

fixes libcrayon

but same fix in libtourist hangs the UI in deadlock, sigh.
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
found this useful

http://www.gammon.com.au/scripts/doc.php?general=lua_math
Biozera
Drak'Tharon
Biozera
85 Blood Elf Paladin
13800
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
Farmbuyer
Kilrogg
Farmbuyer
90 Undead Priest
11280
Edited by Farmbuyer on 9/28/11 7:20 PM (PDT)
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.
Farmbuyer
Kilrogg
Farmbuyer
90 Undead Priest
11280
Quick sanity check: what does

/dump _VERSION (with leading underscore)

print out on the PTR?
Mitochondrîa
Destromath
Mitochondrîa
85 Undead Warrior
8825
Quick sanity check: what does

/dump _VERSION (with leading underscore)

print out on the PTR?


"Lua 5.1"
Farmbuyer
Kilrogg
Farmbuyer
90 Undead Priest
11280
Okay good, that's what I expected.
Omegal
Whisperwind
Omegal
MVP - Technical Support
90 Human Warrior
17280
Edited by Omegal on 9/28/11 11:24 PM (PDT)
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
Kerthorok
Area 52
Kerthorok
90 Orc Warrior
10880
lim 1/x = infinity
x->0
Bashiok
Bashiok
Community Manager
This is an intended change to keep the lua engine in line with changes to our game engine.
Jaese
Stormreaver
Jaese
85 Worgen Death Knight
2385
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.
Iolblood
Akama
Iolblood
85 Goblin Death Knight
3500
Why are you people trying to divide by zero anyhow?

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

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Click here to view the Forums Code of Conduct.

Report Post # written by
Reason
Explain (256 characters max)

Reported!

[Close]