{"action":"created","issue":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1107","labels_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1107/labels{/name}","comments_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1107/comments","events_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1107/events","html_url":"https://github.com/cleanflight/cleanflight/pull/1107","id":94216249,"number":1107,"title":"Added fast acos/atan2 functions. Added unittests for fast trigonometry","user":{"login":"digitalentity","id":11059099,"avatar_url":"https://avatars.githubusercontent.com/u/11059099?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalentity","html_url":"https://github.com/digitalentity","followers_url":"https://api.github.com/users/digitalentity/followers","following_url":"https://api.github.com/users/digitalentity/following{/other_user}","gists_url":"https://api.github.com/users/digitalentity/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalentity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalentity/subscriptions","organizations_url":"https://api.github.com/users/digitalentity/orgs","repos_url":"https://api.github.com/users/digitalentity/repos","events_url":"https://api.github.com/users/digitalentity/events{/privacy}","received_events_url":"https://api.github.com/users/digitalentity/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-10T05:20:22Z","updated_at":"2015-07-10T06:26:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cleanflight/cleanflight/pulls/1107","html_url":"https://github.com/cleanflight/cleanflight/pull/1107","diff_url":"https://github.com/cleanflight/cleanflight/pull/1107.diff","patch_url":"https://github.com/cleanflight/cleanflight/pull/1107.patch"},"body":"This is a continuation of #1092. \r\nNow cleanflight does not use any libm trigonometry functions. atan2f is ported over from  here: http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization (also available here https://gist.github.com/volkansalma/2972237).\r\nacosf is taken from Handbook of Mathematical Functions by M. Abramowitz and I.A. Stegun (reference implementation available here http://http.developer.nvidia.com/Cg/acos.html)\r\n\r\nCode footprint is 1480 byte smaller:\r\n\r\nmaster branch @ 52fe86e66db4e5f3d51422782b781d2b65db0182\r\n   text    data     bss     dec     hex filename\r\n 119732     364   12860  132956   2075c ./obj/main/cleanflight_CC3D.elf\r\n\r\nfast-trig-improvements @ f3b571179dd639b1a047bad2e8b2f03f991db5a1\r\n   text    data     bss     dec     hex filename\r\n 118252     364   12856  131472   20190 ./obj/main/cleanflight_CC3D.elf\r\n\r\nlooptime=800 is now possible in rate mode and PIDC1 on CC3D"},"comment":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/comments/120247527","html_url":"https://github.com/cleanflight/cleanflight/pull/1107#issuecomment-120247527","issue_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1107","id":120247527,"user":{"login":"digitalentity","id":11059099,"avatar_url":"https://avatars.githubusercontent.com/u/11059099?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalentity","html_url":"https://github.com/digitalentity","followers_url":"https://api.github.com/users/digitalentity/followers","following_url":"https://api.github.com/users/digitalentity/following{/other_user}","gists_url":"https://api.github.com/users/digitalentity/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalentity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalentity/subscriptions","organizations_url":"https://api.github.com/users/digitalentity/orgs","repos_url":"https://api.github.com/users/digitalentity/repos","events_url":"https://api.github.com/users/digitalentity/events{/privacy}","received_events_url":"https://api.github.com/users/digitalentity/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T06:26:42Z","updated_at":"2015-07-10T06:26:42Z","body":"@zh \r\nWe can take http://en.wikipedia.org/wiki/Fast_inverse_square_root implementation. It's very fast and rather accurate. It is only working with IEEE 754 floating point format (ok for us). We may be able to save another several hundred bytes of flash, but this will come at cost of loosing precision. Also we'll likely won't get much performance gain - `sqrtf` is not used much around the code."}}