I am experimenting with some trigonometric functions, the code compile good, i want see a square moving on the 360 degrees, but when i run the code i see the square only move in the x-axis, everything work fine except a line on my function.
void mvdr(int* x, int* y, float d, float sp)
{
if(d != 0)
d = (d / 360.0) / 6.283185307179586;
*x += cos(d)*sp;
*y += sin(d)*sp; // here's the error
}
I saw in gdb: y
doesn't change.
(gdb) n
11 *y += sin(d)*sp; // here's the error
(gdb) p d
$4 = 0.000442097051
(gdb) p sin(d)*sp
$5 = 6.44245094e+09
(gdb) p *y
$6 = 256
(gdb) n
12 }
(gdb) p *y
$7 = 256
I can't understand what is happening or if i did something wrong, i hope you can help me.