Code: Select all
KaylaKaze:
« math.sin(math.toRadians(45)) = math.sin(math.toRadians(45)) = 0.665148772988813401014167238056219011 »
KaylaKaze:
« math.cos(math.toRadians(45)) = math.cos(math.toRadians(45)) = 0.758912420807571160280436671609310105 »
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Code: Select all
KaylaKaze:
« math.sin(math.toRadians(45)) = math.sin(math.toRadians(45)) = 0.665148772988813401014167238056219011 »
KaylaKaze:
« math.cos(math.toRadians(45)) = math.cos(math.toRadians(45)) = 0.758912420807571160280436671609310105 »
I only ran a couple of tests on each and see if they matched my calculator, but I'll double check this. At first glance, neither of those answers are correct:KaylaKaze wrote:Something's off in your calculations:
Those should be equal (or reasonably close).Code: Select all
KaylaKaze: « math.sin(math.toRadians(45)) = math.sin(math.toRadians(45)) = 0.665148772988813401014167238056219011 » KaylaKaze: « math.cos(math.toRadians(45)) = math.cos(math.toRadians(45)) = 0.758912420807571160280436671609310105 »
Code: Select all
[H: radians = arg(0)]
[H: cosine = 1]
[H: product = 1]
[H, for(i,2,21,2), code: {
[H: product = product * -1 * i * (i-1)]
[H: cosine = cosine + power(radians,i) / product]
}]
[H: macro.return = cosine ]
Code: Select all
[H: radians = arg(0)]
[H: sine = radians]
[H: product = 1]
[H, for(i,3,24,2), code: {
[H: product = product * -1 * i * (i-1)]
[H: sine = sine + power(radians,i) / product]
}]
[H: macro.return = sine]
Code: Select all
[H: radians = arg(0)]
[h, if(abs(radians)>=1), code:
{
[h, if(abs(radians)==1), code:
{
[H: arcTangent = radians*math.pi()/4]
};
{
[h:alt=1/radians]
[h:inverse=math.arcTan(alt)]
[h: arcTangent = math.pi()/2 - inverse]
}]
};
{
[h: arcTangent = radians]
[h: sign = 1]
[h, for(i,3,50,2), code:
{
[H: sign = if(sign == -1,1,-1)]
[H: arcTangent = arcTangent + (sign * power(radians,i) / i)]
}]
}]
[H: macro.return = arcTangent]