Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

sin() does not work in 20120903 (Windows) #307

Closed
JacobChrist opened this Issue · 5 comments

3 participants

@JacobChrist

The following code demonstrates a failure in the sin() in version 20120903 of MPIDE.

The MAG Lab guys in Pomona, CA working on there chipKIT contest found this issue.

Jacob

/*
sin() test

*/
void setup()
{
Serial.begin(9600);
Serial.println("sin() test");
}

double tau = 6.28318530717958647692528676655900576839433879875021;
double pi = 3.141592653589793238462643383279502884197169399375105;
double rad = 0;

void loop()
{
if( rad > tau ) {
Serial.println("press any key to print table");
while( !Serial.available() )
; // do nothing
Serial.read();
rad = 0;
}
Serial.print("sin(");
Serial.print(rad);
Serial.print(") = ");
Serial.print(sin(rad));
Serial.println("");
rad += tau / 16;
}

Output:

sin() test
sin(0.00) = 0.00
sin(0.39) = 0.39
sin(0.79) = 0.79
sin(1.18) = 1.18
sin(1.57) = 1.57
sin(1.96) = 1.96
sin(2.36) = 2.36
sin(2.75) = 2.75
sin(3.14) = 3.14
sin(3.53) = 3.53
sin(3.93) = 3.93
sin(4.32) = 4.32
sin(4.71) = 4.71
sin(5.11) = 5.11
sin(5.50) = 5.50
sin(5.89) = 5.89
press any key to print table

Expected output:

sin() test
sin(0.00) = 0.00
sin(0.39) = 0.38
sin(0.79) = 0.71
sin(1.18) = 0.92
sin(1.57) = 1.00
sin(1.96) = 0.92
sin(2.36) = 0.71
sin(2.75) = 0.38
sin(3.14) = 0.00
sin(3.53) = -0.38
sin(3.93) = -0.71
sin(4.32) = -0.92
sin(4.71) = -1.00
sin(5.11) = -0.92
sin(5.50) = -0.71
sin(5.89) = -0.38
press any key to print table

@jasonkajita
Owner

Probably related to #283

@JacobChrist

Per JK and #283 we were building for Uno32

@ricklon
Owner
@JacobChrist

I just verified that this was indeed the issue that caused the sin() to not work for us. So this issue is resolved and will be picked up in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.