Skip to content

Atan in micropython #1857

Answered by dlech
Redstonetill asked this question in Q&A
Sep 30, 2024 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

Ah, I see the problem now. Pybricks hubs only use single precision floating point, not double

For portability,

double startX = mp_obj_get_float(args[0]);

should be

mp_float_t startX = mp_obj_get_float(args[0]);

or to force single-precision, you can do

float startX = mp_obj_get_float_to_f(args[0]);

(All other uses of double should be changed accordingly as well)

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@Redstonetill
Comment options

Comment options

You must be logged in to vote
4 replies
@laurensvalk
Comment options

@Redstonetill
Comment options

@Redstonetill
Comment options

@laurensvalk
Comment options

Answer selected by Redstonetill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants