use math.log() not log() for mathematical log function..
jeske opened this issue ยท 4 comments
There is a bug in populating the CDF table. I believe this is caused because it is calling log() which is the console log function when it means to call math.log().. the console log() function returns nil
Here is the fixed function, and the error below.
local function calculateCDF(ln_mean, ln_std_dev)
local function logNormal(x, mean, sigma)
return (1 / (x * sigma * sqrt(2 * 3.14)))
* exp((-1 / 2) * ((math.log(x) - mean) / sigma) * ((math.log(x) - mean) / sigma))
end
cdf = {}
cdf[1] = logNormal(1, ln_mean, sqrt(ln_std_dev))
for i = 2, 60 do
cdf[i] = cdf[i - 1] + logNormal(i, ln_mean, sqrt(ln_std_dev))
end
return cdf
end
Date: 2023-09-08 08:41:38
ID: 1
Error occured in: Global
Count: 1
Message: Interface/AddOns/Deathlog/utils.lua line 241:
attempt to perform arithmetic on a nil value
Debug:
[string "@Interface/AddOns/Deathlog/utils.lua"]:241: logNormal()
[string "@Interface/AddOns/Deathlog/utils.lua"]:244:
Interface/AddOns/Deathlog/utils.lua:237
[string "@Interface/AddOns/Deathlog/utils.lua"]:297: deathlogGetOrderedNormalized()
[string "@Interface/AddOns/Deathlog/Widgets/CreatureRankingTooltip/widget.lua"]:79: Deathlog_CRTWidget_applySettings()
[string "@Interface/AddOns/Deathlog/deathlog.lua"]:67:
Interface/AddOns/Deathlog/deathlog.lua:65
[string "@Interface/AddOns/Deathlog/deathlog.lua"]:140:
Interface/AddOns/Deathlog/deathlog.lua:111
Locals:
x = 1
mean = 2.459821
sigma = 0.761783
(*temporary) = 0.523828
(*temporary) = <function> defined =[C]:-1
(*temporary) = nil
(*temporary) = 1
(*temporary) = nil
(*temporary) = "attempt to perform arithmetic on a nil value"
AddOns:
Swatter, v3.4.6977 (SwimmingSeadragon)
AIVoiceOver, v1.4.2
AIVoiceOverDataVanilla, v0.1
AtlasLootClassic, vv3.1.3
AtlasLootClassicData, vv3.1.3
AtlasLootClassicDungeonsAndRaids, vv3.1.3
AtlasLootClassicMaps, vv1.0.0
AucAdvanced, v3.4.6952 (SwimmingSeadragon)
AucFilterBasic, v3.4.6941 (SwimmingSeadragon)
AucStatHistogram, v3.4.6928 (SwimmingSeadragon)
AucStatiLevel, v3.4.6913 (SwimmingSeadragon)
AucStatPurchased, v3.4.6910 (SwimmingSeadragon)
AucStatSimple, v3.4.6911 (SwimmingSeadragon)
AucStatStdDev, v3.4.6912 (SwimmingSeadragon)
AucUtilFixAH, v3.4.6914 (SwimmingSeadragon)
BagBrother, v
Bagnon, v10.1.4
BagnonBoE, v2.0.67-Release
BagnonGarbage, v2.0.55-Release
BagnonScrap, v10.1.1
BagSync, v19.19
BeanCounter, v3.4.6983 (SwimmingSeadragon)
ClassicBestiary, v1.0.4
DBMCore, v322cbac
DBMStatusBarTimers, v322cbac
DBMVPVEM, v6b4f4f1
Deathlog, v0.1.4
Details, v#Details.20230825.11857.155
DetailsCompare2, v
DetailsEncounterDetails, v
DetailsRaidCheck, v
DetailsStreamer, v
DetailsTinyThreat, v
DetailsVanguard, v
Enchantrix, v3.4.6979 (SwimmingSeadragon)
EnchantrixBarker, v3.4.6917 (SwimmingSeadragon)
GryphonsRemover, vv1.3.9
Informant, v3.4.6980 (SwimmingSeadragon)
LeatrixMaps, v1.14.126
LeatrixPlus, v1.14.126
MoveToolTip, v1.0.6
NeatMinimap, vv1.10.05
NovaInstanceTracker, v1.45
NovaWorldBuffs, v2.55
PartyPetFrames, v1.1.7
PetAbilities, v1.2.r20
Plater, vPlater-v564-Classic
Questie, v8.9.0
QuestieShutUp, v1.0
RXPGuides, vv4.5.19
Scrap, v10.1.1
ShadowedUFNotMyAuras, vv0.1.10
ShadowedUnitFrames, vv4.3.4-classic
SlideBar, v3.4.6919 (SwimmingSeadragon)
Stubby, v3.4.6920 (SwimmingSeadragon)
Tamed, v1.13.9
TargetHealth, v1.0.5
TitanClassic, v1.3.3.11404
TitanClassicAmmo, v1.3.3.11404
TitanClassicBag, v1.3.3.11404
TitanClassicClock, v1.3.3.11404
TitanClassicGold, v1.3.3.11404
TitanClassicLocation, v1.3.3.11404
TitanClassicLootType, v1.3.3.11404
TitanClassicPerformance, v1.3.3.11404
TitanClassicRegen, v1.3.3.11404
TitanClassicRepair, v1.3.3.11404
TitanClassicRestPlus, v1.0.0.2
TitanClassicVolume, v1.3.3.11404
TitanClassicXP, v1.3.3.11404
WeakAuras, v5.7.1
WhatsTraining, v5.0.2
BlizRuntimeLib v1.14.4.51146(US) <enUS>
(ck=8ea)
Thanks for looking into this. I'll change. For understanding, how can I reproduce that error?
For context, when I run
/run print(log(2))
I get .693. Referencing https://wowpedia.fandom.com/wiki/Lua_functions, "Most of these functions are shorthand references to the Lua math library ", makes me think that log
is shorthand for math.log
. Is one of your addons overwriting log
?