Discuss Scratch

ixvizikil
Scratcher
52 posts

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

unnor wrote:

JamesTheScratcherBoy wrote:

I've heard people say it would be too advanced for Scratch, but Scratch already has sin, cos, tan, log, and more.

Anyways, support. We need this.
I don't understand why a CHILDREN's website would have such complicated mathematics.

It's not so complicated.
x^5 is just basically x*x*x*x*x, x^2 is just x*x…

It would help a lot to have ^ for cases where it is difficult or long to code (5^2.5 isn't easy to calculate)

If people don't know what something does, they either don't use it or search what it does.
(for an example, I never use log)
Also, scratch is SUPPOSED to teach how to code.
In other coding languages, you most of the time have to search what a function does.

Anyway, it's quite difficult to make, and it is useful.

if you still think it's too complicated, ST could just make an ‘advanced math’ extension.
It could contain ^, Atan2, and a quite a few other mathematical functions, as well as >=, <=, …

Last edited by ixvizikil (Aug. 17, 2026 15:02:46)

CuddlyGrouse
Scratcher
40 posts

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

Yeah, ^ is very simple, It is repeated multiplication, And can be quite useful. Also, it is quite silly of Scratch not to add it, because recreating it with
([tan v] of ()::operators)
and
([10^ v] of ()::operators)
can return slightly incorrect values.
unnor
Scratcher
1000+ posts

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

CuddlyGrouse wrote:

Yeah, ^ is very simple, It is repeated multiplication, And can be quite useful. Also, it is quite silly of Scratch not to add it, because recreating it with
([tan v] of ()::operators)
and
([10^ v] of ()::operators)
can return slightly incorrect values.
6^-2.125 =
VictoryVonDoom
Scratcher
100+ posts

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

+1
r3hehehehehhe
Scratcher
1000+ posts

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

Yes because it's near impossible to recreate
Haycat2009
Scratcher
500+ posts

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

unnor wrote:

JamesTheScratcherBoy wrote:

I've heard people say it would be too advanced for Scratch, but Scratch already has sin, cos, tan, log, and more.

Anyways, support. We need this.
I don't understand why a CHILDREN's website would have such complicated mathematics.
Complicated? You are behind the times.

Its actually much easier than many things like trig, logarithms, and the lot.
ixvizikil
Scratcher
52 posts

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

unnor wrote:

CuddlyGrouse wrote:

Yeah, ^ is very simple, It is repeated multiplication, And can be quite useful. Also, it is quite silly of Scratch not to add it, because recreating it with
([tan v] of ()::operators)
and
([10^ v] of ()::operators)
can return slightly incorrect values.
6^-2.125 =
The principle is simple.
Of course, some equations are difficult to calculate, which is why we need it in the first place.

If you could just do
repeat pow:
set result to ((result)*(base)),
We wouldn't need so much this block.

Last edited by ixvizikil (Aug. 19, 2026 08:01:04)

Assycot243
Scratcher
53 posts

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

The nonexistence of
(() ^ () ::operators)
is especially weird given that
([e ^ v] of ())
and
([10 ^ v] of ())
already exist.
bitmap_caketin
Scratcher
100+ posts

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

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
Assycot243
Scratcher
53 posts

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

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
AndPherbCodes
Scratcher
1000+ posts

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

ixvizikil wrote:

unnor wrote:

snippity snip snip
The principle is simple.
Of course, some equations are difficult to calculate, which is why we need it in the first place.

If you could just do
repeat pow:
set result to ((result)*(base)),
We wouldn't need so much this block.
Multiplication is just repeated addition.
But it gets more complicated when you factor in negatives and fractions and decimals.
Same for exponents.
By your logic we should just get rid of multiplication.

Last edited by AndPherbCodes (Aug. 19, 2026 14:53:41)

bitmap_caketin
Scratcher
100+ posts

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

Assycot243 wrote:

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
I expect OP could've done it a bit faster than waiting thirteen years and counting.
Also, the floating-point error is unavoidable in the maths system that scratch uses

Last edited by bitmap_caketin (Aug. 19, 2026 17:29:45)

Mimi-EEEEE
Scratcher
500+ posts

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

bitmap_caketin wrote:

Assycot243 wrote:

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
I expect OP could've done it a bit faster than waiting thirteen years and counting.
Also, the floating-point error is unavoidable in the maths system that scratch uses
Eh IDK. Some Scratch mods have exponent blocks, and they dont have too many of those errors.
VictoryVonDoom
Scratcher
100+ posts

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

Mimi-EEEEE wrote:

bitmap_caketin wrote:

Assycot243 wrote:

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
I expect OP could've done it a bit faster than waiting thirteen years and counting.
Also, the floating-point error is unavoidable in the maths system that scratch uses
Eh IDK. Some Scratch mods have exponent blocks, and they dont have too many of those errors.
((0) - ((0) * (0)))
or
((0) * (() - (0)))
not sure but ye

Last edited by VictoryVonDoom (Aug. 19, 2026 22:55:47)

scratchy_boy106
Scratcher
1000+ posts

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

Assycot243 wrote:

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
To make it output 8, just pop a round block somewhere.
TheRealAL2009
Scratcher
100+ posts

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

scratchy_boy106 wrote:

Assycot243 wrote:

bitmap_caketin wrote:

If you need negative numbers, use:
(([e v] of (([ln v]of(base))*([abs v] of (exponent)))::operators)*((1)-((2)*((([floor v] of (exponent))mod(2))*<(base)<(0)>)))
these workarounds have two problems:
  • they're not obvious at the skill level where the exponent block would start to be helpful (that is probably clumsily stated)
  • the errors show even for small numbers (2 ^ 3 should be eight but the workaround gives 7.999999999999998)
To make it output 8, just pop a round block somewhere.
Yeah, but suppose it was:

3.2 ^ 5
= 3.2 * 3.2 * 3.2 * 3.2 * 3.2
= 335.54432 (exactly that, it's not rounded)

While scratch's e^5ln(3.2) workaround might give something like 335.5443199999…

You would have to do something more complex to find which decimal places are just floating point error. Maybe if you multiply it by ten, various numbers of times, then round it and check the difference to see how close the decimal part is to 0 / 1.

But that's a bit of a hassle.
hotcrystal
Scratcher
1000+ posts

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

TheRealAL2009 wrote:

Yeah, but suppose it was:

3.2 ^ 5
= 3.2 * 3.2 * 3.2 * 3.2 * 3.2
= 335.54432 (exactly that, it's not rounded)

While scratch's e^5ln(3.2) workaround might give something like 335.5443199999…

You would have to do something more complex to find which decimal places are just floating point error. Maybe if you multiply it by ten, various numbers of times, then round it and check the difference to see how close the decimal part is to 0 / 1.

But that's a bit of a hassle.
It's called floating point imprecision, and unfortunately, there is no solution to that.
ixvizikil
Scratcher
52 posts

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

hotcrystal wrote:

TheRealAL2009 wrote:

Yeah, but suppose it was:

3.2 ^ 5
= 3.2 * 3.2 * 3.2 * 3.2 * 3.2
= 335.54432 (exactly that, it's not rounded)

While scratch's e^5ln(3.2) workaround might give something like 335.5443199999…

You would have to do something more complex to find which decimal places are just floating point error. Maybe if you multiply it by ten, various numbers of times, then round it and check the difference to see how close the decimal part is to 0 / 1.

But that's a bit of a hassle.
It's called floating point imprecision, and unfortunately, there is no solution to that.
I think the problem is not that we have imprecision (I don't know if ST could even avoid them by using complex code),
but that it's complex to build (I don't know anything about log, so I wouldn't be able to code the workaround myself).
ILuvDogs-5335
Scratcher
100+ posts

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

hotcrystal wrote:

TheRealAL2009 wrote:

Yeah, but suppose it was:

3.2 ^ 5
= 3.2 * 3.2 * 3.2 * 3.2 * 3.2
= 335.54432 (exactly that, it's not rounded)

While scratch's e^5ln(3.2) workaround might give something like 335.5443199999…

You would have to do something more complex to find which decimal places are just floating point error. Maybe if you multiply it by ten, various numbers of times, then round it and check the difference to see how close the decimal part is to 0 / 1.

But that's a bit of a hassle.
It's called floating point imprecision, and unfortunately, there is no solution to that.

Ehh, it's okay.
unnor
Scratcher
1000+ posts

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

ixvizikil wrote:

hotcrystal wrote:

TheRealAL2009 wrote:

Yeah, but suppose it was:

3.2 ^ 5
= 3.2 * 3.2 * 3.2 * 3.2 * 3.2
= 335.54432 (exactly that, it's not rounded)

While scratch's e^5ln(3.2) workaround might give something like 335.5443199999…

You would have to do something more complex to find which decimal places are just floating point error. Maybe if you multiply it by ten, various numbers of times, then round it and check the difference to see how close the decimal part is to 0 / 1.

But that's a bit of a hassle.
It's called floating point imprecision, and unfortunately, there is no solution to that.
I think the problem is not that we have imprecision (I don't know if ST could even avoid them by using complex code),
but that it's complex to build (I don't know anything about log, so I wouldn't be able to code the workaround myself).
-2.45^-2.125 =

Powered by DjangoBB