Help with converting seemingly irrational decimals to nice denominators

I'm new to Snap! and I have a question. When working with my project here, I wanted to convert a complex number to exponential form. However, when calculating the argument and magnitude, it would always return a not very nice decimal, which is a hindrance in exponential form. For example, if I had something as so:
Re(z) = sqrt(3)/2
Im(z) = 1/2
= 5 * e^i(0.535374144)pi
I would want to have
= 5 * e^i(pi/6)

Is this possible, without having the computer make an immense list of decimals that can be converted in to nice fractions?

I know you! Your from Scratch! Welcome to Snap!

Welcome to the forums!
Does this help?:

I recognize you too!

I'm so glad to see you on Snap! Now! How's it going for you?

No, sorry. That topic discusses floating numbers, while my problem is less technical.

Fine, I suppose. Question: Why does gobo have an antler in Snap?

Snap! was based on Scratch's source code.

I always thought Gobo looked strange enough. Anyway, I kind of hijacked my own thread.

You can delete posts by clicking the three dots and clicking the delete button.

That's helpful to know in the future. Thanks!

Once you've computed that sqrt(3), you're not going to get an exact answer to any later computation that depends on it. There are a couple of things you can do:

  1. Easy but not quite what you want: You can round the answer to some number of decimal places. Let's say you want three digits after the decimal point; you can say
    round

  2. Hard but perfect: Start by loading the bignums library. Invent a representation for exact square roots, e.g.,
    sqrt
    and build your own SQUARE function that recognizes those things and returns the exact result. Also you'll need your own arithmetic operators in general so that, for example,


    And so on. There would be a lot of little pieces to this solution.

That's not an antler; it's a Greek letter lambda. See Why is the snap logo a lambda?

No. BYOB, the predecessor of Snap!, was based on Scratch 1.4's source code. But Snap! is an entirely separate program. See You ripped off Scratch!

Ahh, got it. Thanks!

Not such a huge surprise. Pretty much every kid with access to a computer runs across Scratch these days, either at school or from friends.

I was just pointing out that I had met them from Scratch.

Snap!'s mascot is called Alonzo, named after Alonzo Church, and is basically Gobo with an antler.

Thanks for the reply.

If you rotate Alonzo to face straight up, the "antler" is a Greek Lambda λ mirrored horizontally.