Sine Values Wrong?

This forum is currently in read-only mode.
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • I'm not too sure, since I don't know much about sine, but I'm pretty sure that the sine function is returning the wrong values in some cases. For instance, it claims that the sine of 180 is(roughly) 1.2, instead of the 0 it should be. But it gets really weird when I make a sine wave, where it creates a perfect sine wave with no visible problems. I've got a .CAP that will give you the sine for the angle you input for as well as a button that will create a sine wave:

    Sine Calculator/Sine Wave

    Am I just stupid, or is it actually giving out the wrong sine values?

  • You are right, it should be zero. But the value it receives is not 1.2, it's much closer to zero: it's about 0.00000000000000012! See the e-016 in the end :D! Actually, I was deceived by this in another situation. Is there a way to show small numbers without scientific notation?

  • You are right, it should be zero. But the value it receives is not 1.2, it's much closer to zero: it's about 0.00000000000000012! See the e-016 in the end ! Actually, I was deceived by this in another situation. Is there a way to show small numbers without scientific notation?

    Ah, crazy! I didn't realize the 'e' stood for 'exponent'. Thanks for that. And I agree, there needs to be a way to show a smaller number. I can't seem to find one.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could use "round" or "int" (int'd floor it).

    Last event:

    round(1000*sin(int(EditBox.Text))) / 1000[/code:1d78ex69]
  • Yeah, computers can't calculate math exactly precisely, because they only used a fixed number of digits. For example, if you do one-third times three using only 6 digits of precision, you get:

    0.333333 * 3 = 0.999999

    which clearly isn't 1 - which you'd expect to get from multiplying a third by three. The same thing is happening, but in binary.

  • 011011000110111101101100001000000110100100100000011000110110000101101110001000000111010001111001011100000110010100100000011010010110111000100000011000100110100101101110011000010111001001111001

    ~011100110110111101101100

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)