Unexpected frequency value on OscillatorNode
Reported by
mvattu...@gmail.com,
Mar 24 2018
|
|
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: 1. Open Chrome, go into DevTools Console 2. Create an oscillator and set frequency to a decimal: ``` const audioCtx = new AudioContext(); const osc = audioCtx.createOscilator(); osc.frequency.value = 82.41 // E2 osc.frequency.value // returns 82.41000366210938 ``` What is the expected behavior? I would expect to see 82.41 as the frequency value when getting it What went wrong? I see 82.41000366210938 set as the frequency instead Did this work before? N/A Does this work in other browsers? No Follow the same steps on Firefox and you'll see the same issue as what is on Chrome. Chrome version: 65.0.3325.181 Channel: stable OS Version: OS X 10.13.3 Flash Version: I've also tried using `setValueAtTime` since that is the way it _should_ be handled, but I've also noticed issues there. Same with trying to use `toFixed(2)`. Maybe I'm fundamentally misunderstanding something about how IEEE 754 works?
,
Mar 25 2018
Ah okay, pardon my ignorance. I'll read up on that, I had a feeling it was a gotcha rather than a bug. Thanks!
,
Mar 27 2018
You can look at the IEE754 spec itself or maybe the classic Goldberg article: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
,
Mar 27 2018
Thanks for the link. This all has been super informative. |
|
►
Sign in to add a comment |
|
Comment 1 by rtoy@chromium.org
, Mar 24 2018