Bug tracker

if you found a bug please post it here and tag @richard or any other member of the makecode team like @jwunderl

Why did i make this Topic?

i made this topic because of a bug i found that is so annoying to me, the x and y in the atan2 function are inserted, every were else I use atan2/arctan2 the function goes like (math.atan2(x,y) or arctan(x,y)) but makecode arcade does it like this (Math.atan2(y,x))
so @richard please fix this.

1 Like

You can also report issues in the repository:


About atan2’s “backward” arguments:

  • atan2 in JavaScript has y as the first argument, so it’s unlikely to be changed. Many other programming languages, (with a couple exceptions, some listed below) also have y as the first parameter. For example, python and C++ do this as well.

  • Wikipedia has a section about atan2’s argument order:

    In 1961, Fortran introduced the atan2 function with argument order (y, x) so that the argument (phase angle) of a complex number is {isplaystyle peratorname {arg} z=peratorname {atan2} (peratorname {Im} z,peratorname {Re} z).} This follows the left-to-right order of a fraction written {isplaystyle y/x,} so that {isplaystyle peratorname {atan2} (y,x)=peratorname {atan} (y/x)} for positive values of x. However, this is the opposite of the conventional component order for complex numbers, z=x+iy, or as coordinates .{isplaystyle (peratorname {Re} z,peratorname {Im} z).} See section Definition and computation.

    Some other programming languages (see § Realizations of the function in common computer languages) picked the opposite order instead. For example Microsoft Excel uses {isplaystyle peratorname {Atan2} (x,y),} OpenOffice Calc uses {isplaystyle peratorname {arctan2} (x,y),} and Mathematica uses {isplaystyle peratorname {ArcTan} [x,y],} defaulting to one-argument arctangent if called with one argument.

    (rip no LaTeX plugin enabled here, that’s why all the math looks funny. :skull::skull::skull:)

3 Likes

Well, I guess it’s getting tagged as wontfix in that case

1 Like

The Importance of the x-then-y Argument Order in Functions

When working with functions that take both an x and y input, it is generally preferred to provide the x-coordinate followed by the y-coordinate as arguments. This convention holds true for various mathematical functions, including atan2, and it promotes consistency and compatibility with established mathematical principles.

Consistency with Function Composition By following the x-then-y argument order, we align ourselves with the concept of function composition. In function composition, the output of one function becomes the input of another. By convention, the input of a function is typically written on the right side, while the output is on the left. Therefore, when providing arguments to a function, it is natural to follow the same order: x first, then y.

Simplifying Function Composition Adhering to the x-then-y argument order simplifies the process of function composition. When composing functions, it is often necessary to pass the output of one function as the input to another. By consistently using the x-then-y order, we can easily chain functions together without the need for additional adjustments or transformations.

Promoting Readability and Understanding Following the x-then-y argument order in functions enhances code readability and comprehension. When reviewing or collaborating on code, it is easier for others to understand the purpose and behavior of a function when the arguments are provided in a consistent and predictable order. This convention reduces confusion and promotes efficient communication among developers.

Compatibility with Existing Conventions The x-then-y argument order is widely used in mathematics and programming, making it a familiar convention for many developers. By adhering to this convention, we ensure compatibility with existing libraries, frameworks, and mathematical concepts. This compatibility allows for easier integration of functions and promotes interoperability across different systems and platforms.

In conclusion, the x-then-y argument order in functions, including atan2, is a convention that promotes consistency, simplifies function composition, enhances code readability, and ensures compatibility with existing mathematical principles and conventions. By following this convention, we can write more readable and maintainable code and facilitate effective collaboration among developers.
now keep in mind this is just my opinion

If it’s more convenient you can define your own atan2 method, which would just take in the x argument first, like this

function atan2(x: number, y: number): number {
    return Math.atan2(y, x);
}

That way, you can follow the conventions and make it easier to use, without modifying the MakeCode platform directly. Hope this idea resolves your issue

2 Likes

I’m drowning in words…

Most of the time, atan2 is defined as atan2(y, x), including in math and programming.


Also, it sounds like that post was generated by AI. I don’t think we should use AI for most of the content in a post or response.

2 Likes

ya sorry about that, XP

so I found out that you can still take the functions variables when your in debug mode and in blocks @richard

you know that Wikipedia pages are written by some random person the might not even know what he’s talking about? heck there are millions of Wikipedia pages heck you can make your own Wikipedia pages if you want, that’s why I don’t use Wikipedia as a source, you just cant base yourself on it, for all you know it can be totally wrong or making a great point but we don’t know
ps. ‘im not saying that your argument if incorect’

1 Like

@YuHayate it is indeed confusing! I have no idea who started this convention but I always have to force myself to remember it.

That being said, we always follow the conventions of JavaScript whenever possible and this is how JavaScript does it as well

1 Like

You know that Wiki pages are cross-referenced and sourced? You know there are other sources that state the same thing? You know you used an AI generated paragraph to prove a point and now you’re automatically citing yourself as somehow correct despite the numerous sources citing the opposite of what you’re saying?

UA just tried to provie additional context / information about the subject, and you’re getting all hostile like damn, chill man.

We do know, because it’s not the only source that claims that. I assume UA just picked out Wikipedia because it was the most detailed and well-researched article on the matter. Also, if you actually read said article, you’d know why the order is the way it is. It was introduced by FORTRAN in the 60’s and it’s been a convention since. While it might not be the same way in math, it is standardised in all other programming languages and MakeCode because it’s based on JS. If you don’t like it, refer to my post where I explained how to work around this, because makecode isn’t breaking conventions just because you don’t like the way something is. Not a bug, wontfix

1 Like

ahem

1 Like

Most “popular” Wikipedia pages are actually moderated, and usually people have others best interest, I don’t think someone would want to fake the status quo on the argument order of some math function rarely used.

1 Like

dame i was roasted so bad XD, also completely off track, and can you send me a link to that ‘ai contend check thing’ ? i want to test some thing , also I’m bad at writing in english so i used Google Translate to convert my text from French then spent 10 minutes making it look nice adding spatial effect to my text, if you want to know the funny part of the long text i sent, you can reed the text below or you can roast me some more if you want

the part I think is funny and a good subject to roast me about

i was in class when I wrote the ‘text’ " I’ll call it that from now on" in French class, and my teacher came to me and said “sa c boucoup de text ‘my name irl’ , c pourquoi?.” witch translate to (there’s a lot of text ‘my name irl’, why?. but i’d put it like this “that’s a lot of text ‘my name irl’, what is it for ?.”), then i explained what was going on and we sat down at the lunch break and worked on it together because why not, we thought those were good points so we fixed it up and said “ill make sure that they know that we didn’t mean it to change it” because @UnsignedArduino toled me that it was meant to be like that it’s just that i already wrote it so i wanted to sent it so that me and my teachers work didn’t go to waist. but apparently that was a bad idea. well what’s done is done. now have a good one

1 Like

what are you using to check for ai likeliness, i just read and guess

I used this site because it had a high enough limit to fit his message

2 Likes

alright i know now that what i said was dumb and not based on any real fact

so i doing test and decided to see what my ‘text’ gave and its not the same as what you showed me, now its till bad but its not the same


first paragraph

second paragraph

and again

and again

BUT AS SOON AS I GET HERE, ho no its made by ai

and the conclusion…

2 Likes

This is only the beginning in 2030 everyone will type like bots

3 Likes