Skip to content

Save flash space by defining atan() in terms of atan2()#6704

Closed
jepler wants to merge 1 commit into
adafruit:mainfrom
jepler:flash-optimize-atan
Closed

Save flash space by defining atan() in terms of atan2()#6704
jepler wants to merge 1 commit into
adafruit:mainfrom
jepler:flash-optimize-atan

Conversation

@jepler
Copy link
Copy Markdown

@jepler jepler commented Aug 5, 2022

I noticed that atanf() and atan2f() were both pretty bulky functions. It's a definition that atan2f(y,1f) == atanf(y). However, the performance optimization that atan2f(y,1f) can be computed in this way has to also be removed.

I noticed that atanf() and atan2f() were both pretty bulky functions.
It's a definition that atan2f(y,1f) == atanf(y). However, the
performance optimization that atan2f(y,1f) can be computed in this way
has to also be removed.
@jepler
Copy link
Copy Markdown
Author

jepler commented Aug 5, 2022

On trinket_m0 this saves 488 bytes.

@jepler jepler marked this pull request as ready for review August 5, 2022 22:32
@jepler jepler marked this pull request as draft August 5, 2022 22:36
@jepler
Copy link
Copy Markdown
Author

jepler commented Aug 5, 2022

huh but it doesn't work. I tested on esp32s3 and now atan(any arguments) or atan2(any arguments) crashes instead.

@jepler
Copy link
Copy Markdown
Author

jepler commented Aug 5, 2022

I missed that atan2f called atanf in two places, not just one.

@jepler jepler closed this Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant