pxt-microbit
pxt-microbit copied to clipboard
Block for Math.PI
micro:bit support: #46552
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
This is very useful when working with the math trig functions, it exists in JS. very useful when converting degrees to radians and VV. There are workaounds, but having a dedicated block is so much more convienent.
Describe the solution you'd like
Block equivalent of Math.PI

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
We have had another request for this block in https://support.microbit.org/a/tickets/50725 (private)
The use case relates to using the math Sin block which uses radians rather than degrees. The user mentions that Scratch calculates based on degrees, so moving to MakeCode from Scratch is harder.
since calculations are done in radians I kinda need a number pi (π) however I can not find a block for it. I could type 3.14 every time, but I'd lose a lot of accuracy in the long run. I now also need to do a lot more math to simply draw half a circle.
I am really confused over the choice to use radians over degrees in the code. I only seem to find extra hurdles and no benefits for this, especially when the most important number for radians is not provided.
I expect that at this stage, we can;t change the API to use degrees, so could we surface the Pi API as a math block for the next release @abchatra
@microbit-mark lets track for next-release.
May be we can have a math extension which can implement all the blocks