Discuss Scratch

Luvexina
Scratcher
500+ posts

Could we please have an exponents block? ( ) ^ ( )

I support per the reasons in @imfh's post.

Support trans youth, in Texas and across the globe!
LEGAMER4665
Scratcher
84 posts

Could we please have an exponents block? ( ) ^ ( )

set [a v] to (answer)
repeat (a)
set [b v] to ((b) * (a))
end

i never understood why the entire scratch community is afraid of fruit like bruh just eat them what is the problem
15-MinuteGaming
Scratcher
100+ posts

Could we please have an exponents block? ( ) ^ ( )

Support. They have logarithms but no exponents.

My kumquats and forum signatures ate each other. Luckily, I did not like any of them anyways.
The evil kumquat must have some relation with thanos cat. Evil kumquat is 2.0 and thanos cat is 3.0
April 1st is this Saturday. Details here.
space_elephant
Scratcher
500+ posts

Could we please have an exponents block? ( ) ^ ( )

15-MinuteGaming wrote:

Support. They have logarithms but no exponents.
They don't (but should) have logarithms (except for base e and 10 where they also have exponents)

red link
[url=redlink.com][color=red][u]red link[/u][/color][/url]
noogai34
Scratcher
46 posts

Could we please have an exponents block? ( ) ^ ( )

No support. In Snap! the workaround is…
Script bars (result)
Set result to base
Repeat ((exponent)-(1))
Set result to result * result
End
Report result
result
Yes I was l a a y

S U C C
DarthVader4Life
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

noogai34 wrote:

No support. In Snap! the workaround is…
Script bars (result)
Set result to base
Repeat ((exponent)-(1))
Set result to result * result
End
Report result
result
Yes I was l a a y
This is scratch.

Last edited by DarthVader4Life (Aug. 16, 2021 22:23:11)


Be Moist Also, here's a helpful link to Ocular
I am DV4L, Erector of Text Walls, Typer of Long Posts, Creator of Mini-mod posts
The kumquats have eaten this line, so I have to have a new way to repel them.
Had a bad day or are feeling bored? Watch this to make your day better in an interesting way.
Do you think you've been banned unfairly? Then you'd be wrong. The ST aren't children, so quit acting like they are.
DrGaming_92Games
Scratcher
100+ posts

Could we please have an exponents block? ( ) ^ ( )

bump, I support this idea because when I used Pythagorean Theorem to calculate distance from a clone, the code was about twice as large as it needed to be. The use of this little operator would make things so much simpler and cleaner. The only thing I'd like to know is why it isn't already implemented, was it simply an oversight or is there something that prevents this block from being added?

Maximouse
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

I support this idea because it would make scripts that include powers much shorter.

I actually made a custom block that works for all integer exponents. It's used like this:

(x) ^ (y) :: custom
do something with (result) :: custom

See this project.


This is Maximouse's signature. Learn more about signatures.
Nambaseking01
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

Support.

All the workarounds for this are either only worker for specific type of numbers, or extremely long, and this could be extremely useful.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Maximouse
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

DarthVader4Life wrote:

noogai34 wrote:

No support. In Snap! the workaround is…
Script bars (result)
Set result to base
Repeat ((exponent)-(1))
Set result to result * result
End
Report result
result
Yes I was l a a y
this is scratch
It's Snap!. Scratch doesn't have a report block.


This is Maximouse's signature. Learn more about signatures.
Zivkoinformatika
Scratcher
2 posts

Could we please have an exponents block? ( ) ^ ( )

It's pretty devastating that this is not implemented yet.
redfireball256
Scratcher
3 posts

Could we please have an exponents block? ( ) ^ ( )

define set answer to (base)^(exponent)
set [result v] to (base)
if <(exponent)=(0)> then
set [result v] to [1]
else
if <(exponent)>(0)> then
set [counter v] to [1]
repeat until <(counter)=(exponent)>
set [result v] to ((result)*(base))
change [counter v] by (1)
end
else
set [counter v] to (-1)
repeat until<(counter)=(exponent)>
set [result v] to ((result)*(base))
change [counter v] by (-1)
end
set [answer v] to (join [1/] (result))
end
end
I have tested this code and it works for a real numbers (I might as well upgrade it someday to let it do complex numbers). Might not be the best way to do it (because I don't understand the log stuff) but it at least works.

Last edited by redfireball256 (April 20, 2020 21:31:23)

fdreerf
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

redfireball256 wrote:

...
In my opinion, that is way too long for any practical use.
You might as well use the very flawed ln/e or log/10^ way, which is also really big and cumbersome.

Hyped for MS-DOS 11.0
Niloss_
Scratcher
51 posts

Could we please have an exponents block? ( ) ^ ( )

Support. I genuinely don't understand why the Scratch Team has neglected to add this for upwards of 7 years - the function isn't complicated and there's certainly been opportunities to add it with the creation of 3.0. Really kind of frustrating at this point. I have to somewhat wonder if the ST is actually listening to suggestions instead of just moderating at this point - this is one of the most suggested features on these forums.

TonyBrown148
Scratcher
100+ posts

Could we please have an exponents block? ( ) ^ ( )

Support, I mean, if there are
([e ^ v] of (9))
and
([10 ^ v] of (9))
why not this suggestion?

Base64url of SHA-384 of signature BBCode (Google it for all my posts): Y9HICbv1WbHQp9NIeBx-tBm1m6EwLzVSB7b1bPnZ6E9MU5uDyh4q2L5iLCQMQrBB
Generation 378: The first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment. I did not start this.
My browser / operating system: Windows NT 10.0, Firefox 81.0, Flash 32.0 (release 0)
(^_^)//This is Jury, my evil kumquat guard. He is a good kumquat.
Give me some internets!
;
IB21717
Scratcher
6 posts

Could we please have an exponents block? ( ) ^ ( )

scubajerry wrote:

DadOfMrLog wrote:

firedrake969_test wrote:

The thing is that you can't do negative numbers with logs.
OK, so here's my definitive x^y custom block…
define result = (x) ^ (y)
if <(y) = [0]> then
set [result v] to [1] // yes, we also include 0^0=1 :O
else
if <(x) = [0]> then
set [result v] to [0] // 0^y=0 for any y except zero (see above)
else
set [result v] to ([e^ v] of ((y)*([ln v] of ([abs v] of (x)))) // no negative x for now
if <(x) < [0]> then // now deal with power of negative number
if <(round(y)) = (y)> then // we can do integer powers of negative numbers
if <((y) mod (2)) = [1]> then
set [result v] to ((0) - (result)) // odd powers will be negative
end
else
set [result v] to [NaN] // but let's not go there at this stage...
end
end
if <<(y) > [0]> and <<(round(x)) = (x)> and <(round(y)) = (y)>>> then
set [result v] to (round (result)) // ensure we get exactly an integer if both x & y were ints
end
end
end
That should cover everything but non-integer powers of negative numbers (which gets a bit hairy…), and it makes sure that integer raised to integer gives exactly an integer (in case you assume you'll get an integer, perhaps because you check for equality with an integer at some point).

Hope I've got that all right!

Have you put this is a project?
this sometimes does not work
360Genius
Scratcher
63 posts

Could we please have an exponents block? ( ) ^ ( )

yes please! I SUPPORT!

Thank you for listening to my TED talk ≤( º-º)/
Nambaseking01
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

360Genius wrote:

yes please! I SUPPORT!

Please explain why you support - the Scratch Team unfortunately doesn't implement suggestions based off of the amount of supports but the reason for the support.



Anyways, support. This is an important math formula (and way more commonly used than all those trigonometry formulas in the operators section) that many Scratchers would like to have, and the workaround isn't really that… simple. Additionally, I think everyone can agree it's very fun to play around with high numbers in programming, so this would increase a lot of fun (at least for me personally).

Last edited by Nambaseking01 (June 19, 2020 14:59:45)


Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
badatprogrammingibe
Scratcher
500+ posts

Could we please have an exponents block? ( ) ^ ( )

Nambaseking01 wrote:

360Genius wrote:

yes please! I SUPPORT!

Please explain why you support - the Scratch Team unfortunately doesn't implement suggestions based off of the amount of supports but the reason for the support.



Anyways, support. This is an important math formula (and way more commonly used than all those trigonometry formulas in the operators section) that many Scratchers would like to have, and the workaround isn't really that… simple. Additionally, I think everyone can agree it's very fun to play around with high numbers in programming, so this would increase a lot of fun (at least for me personally).
No, trigonometry is definitely used a lot more. (Every project that uses traveling in a certain direction in any fashion other than the most trivial likely uses trigonometry.)
Vanilla2011
Scratcher
500+ posts

Could we please have an exponents block? ( ) ^ ( )

So, I’ve checked out the workarounds. But there is no workaround(at least any I found)that guarantees you can put any NUMBER there. I mean not just positive integers. ALL numbers. All positives and negatives and decimals. So I support the idea that we need this block:
(() ^ () ::operators)

Last edited by Vanilla2011 (July 15, 2020 04:56:48)


Za-Chary wrote:

aw heck naw someones' wanting to ban the sab spunch bop faec from scrathc



(ツ::#000)//Master Kakawam, slays evil kumquats.

Powered by DjangoBB