Discuss Scratch

qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

What would be the most effective way to find 1.55^x, where x could be a number as large as 1 000 000?

Edit: I have a product block that doesn't round, but it stops working effectively (i.e. fast) at > 100 for x.

Last edited by qwertycodechamp90411 (Sept. 9, 2023 11:13:12)

sashimiricedev
Scratcher
100+ posts

Raising number to really large exponent

You can use scientific notation to raise a number to a large power of ten, but there is not a real
 ((b) ^ (e)::operators) 
block. Sorry

Last edited by sashimiricedev (Sept. 9, 2023 10:19:29)

qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

sashimiricedev wrote:

You can use scientific notation to raise a number to a large power of ten, but there is not a real
 ((b) ^ (e)::operators) 
block. Sorry
Yeah, I know that, but how do I do it, while avoiding the rounding error?
griefercube
Scratcher
500+ posts

Raising number to really large exponent

1. Why would you need such a huge number?
2. Scratch stores numbers as 32 bits (I think) so rounding errors couldn’t be avoided and might result in answer being infinity.
3. Here’s the method I tested on:
qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

griefercube wrote:

1. Why would you need such a huge number?
2. Scratch stores numbers as 32 bits (I think) so rounding errors couldn’t be avoided and might result in answer being infinity.
3. Here’s the method I tested on:
As I said, I already know that. I'm asking for a way to do this efficiently without the rounding error.
qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

griefercube wrote:

1. Why would you need such a huge number?
2. Scratch stores numbers as 32 bits (I think) so rounding errors couldn’t be avoided and might result in answer being infinity.
3. Here’s the method I tested on:
I need a large number for accurate precision.
griefercube
Scratcher
500+ posts

Raising number to really large exponent

Unfortunately as I beforehand mentioned, scratch will inevitably round the number as it uses 32 bits (32 digits) to store numbers, meaning that a number cannot exceed 10^309, or else it will display Infinity.
qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

griefercube wrote:

Unfortunately as I beforehand mentioned, scratch will inevitably round the number as it uses 32 bits (32 digits) to store numbers, meaning that a number cannot exceed 10^309, or else it will display Infinity.
Except if you don't use math blocks, which is what I did. My problem is that it is slower than a snail with slowness 99999 if x > 1000
qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

I'll try to make it more effective tomorrow.

I've never had a problem with the 60 second rule before. I feel the pain now.
TheIsJa
Scratcher
0 posts

Raising number to really large exponent

Did you find a solution?
qwertycodechamp90411
Scratcher
100+ posts

Raising number to really large exponent

TheIsJa wrote:

Did you find a solution?
No, but I think it’s fine.
awesome-llama
Scratcher
1000+ posts

Raising number to really large exponent

griefercube wrote:

Scratch stores numbers as 32 bits (I think)

Floats are 32-bit but Scratch and JavaScript use double floats which are double the size, so 64 bits.

https://en.wikipedia.org/wiki/Double-precision_floating-point_format

Powered by DjangoBB