power operator block a^b#3462
Conversation
|
ah, a new PR was made |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@AeroKoder you would have to edit the 23,000 line translation thing in this PR too |
|
Looking at the scratch forum and then here with the thought that maybe soon a certain period of the history of the "13-year Struggle for Power operation" will be close |
Yep, hopefully someone merges this soon. |
They won't, you have to use feat: or something and they wouldn't just add features off the fly |
Resolves
scratchfoundation/scratch-editor#426
Proposed Changes
Add a new block to the Operator category to raise a given number to a power of another given number.
Reason for Changes
This is a highly requested block by many Scratchers and Scratch Team members (I have with some [1,2], and they agree that it should exist in Scratch). There also aren't any accurate workarounds, besides ones that are crazy inefficient, making this block even more important to have.
It has been discussed in multiple topics and issues, and they always end up with tons of upvotes and supports.
The one thing I would like to discuss is whether, zero to the power of zero, should return 1 or NaN. Currently, it returns 1, as that is what the native JavaScript operator returns. This might confuse younger Scratchers, but then again, I don't know if NaN is such a good idea either, since it acts as zero in scratch, making some math equations with the power operator return an incorrect result. Discuss this in the scratchfoundation/scratch-editor#444
Test Coverage
Tests are in the scratchfoundation/scratch-editor#444