Changing pitch step values to double for play_sound()
LadyCailinBot opened this issue ยท 3 comments
CMDHELPER-2760 - Reported by psnider85
Spoke to LadyCailin about this on IRC about if it's possible to change the step values of play_sound() to double.
Since bukkit has nerfed play_note() and hasn't implemented the /playsound command. Maybe it could be possible to change play_sound() instead.
I have found on the bukkit forums a user who has had success in changing to a double iteration.
http://forums.bukkit.org/threads/playnote-is-bugged.135411/#post-1591741
Thanks so much if this can be done!
Comment by PseudoKnight
Was added in build 1592 but it doesn't work yet. There's some sort of bug. It gives a range exception.
Comment by jb_aero
Given what values?
EDIT: hmm, computers subtract in strange ways. I'm testing with:
d = Double.valueOf(n)
f = Float.valueOf(n)
dif = Math.abs(f - d)
f2 = (float) d
dif2 = Math.abs(f2 - d)
ret = "Double: " + d + "\nFloat: " + f + "\nDif1: " + dif + "\nFloat2: " + f2 + "\nDif2: " + dif2
The above is based off the CH code that validates floats. Basically, the casting makes no difference (at least as far as toString() is concerned), f = f2 and dif = dif2. The issue is, when n is 1.5, dif is 0.0. When n is 2.0 or 2, dif is 0.0. When n is 1.6 or 1.9, dif is 2.384E-8. When dif is 1.7 or 1.8, dif is 4.768E-8. CH's Static.getDouble32() considers a float to be out of range if the difference between the double and the double cast to a float is greater than 1.0E-9.