Module:Interval extension: Difference between revisions

R-4981 (talk | contribs)
Created page with "local p = {} -- Calculated by http://www.mikebattagliamusic.com/HE-JS/HE.html. -- Note: that the unit is Nat, not Bit. local lookup_table = { 2.4653643754704344,2.469526..."
 
R-4981 (talk | contribs)
No edit summary
Line 10: Line 10:
-- Get from the table with Linear Interpolation
-- Get from the table with Linear Interpolation
function p.harmonic_entropy_with_lookup_table(c)
function p.harmonic_entropy_with_lookup_table(c)
     if c <= 0 then c = -c end
     if c < 0 then c = -c end
    if c == 0 then return 2.4653643754704344 end
     if c >= #lookup_table then return 4.805772050182217 end
     if c >= #lookup_table then return 4.805772050182217 end
     if c == math.floor(c) then return lookup_table[math.floor(c)] end
     if c == math.floor(c) then return lookup_table[math.floor(c)] end