Fix float_to_fix64
return value & f32 trig function doc corrections
#787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current return argument for
float_to_fix64()
isf32
, which doesn't make sense and is at odds with the definition in the pico SDK. This PR replaces it with the correct type.The function as exposed by the SDK is here:
https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_float/include/pico/float.h#L44
It returns an
int64
, so I've updated rom_data.rs to match. I tested this on my pico by converting a small set off32
s to fix64 with the change in this PR, then back throughfix64_to_float()
and the values match up.This is a breaking change, though given that the return argument was both the wrong type and the wrong size, I'm not sure if anyone could really have used this function as it currently stands.
Additionally, the function descriptions for fcos, fsin, and ftan state a valid range of -1024 to 1024, but the datasheet gives a range of -128 to 128 on page 140. Note that the valid range for doubles is specified as -1024 to 1024 on page 143.