Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch addresses of os_RealAsinRad and os_RealAcosRad #358

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

arjvik
Copy link
Contributor

@arjvik arjvik commented Feb 5, 2022

I'm building an RPN calculator, and I noticed that the os_RealAsinRad function appears to calculate the arccosine of its argument while the os_RealAcosRad function appears to calculate the arcsine of its argument.

This can be verified by running the following program:

#include <tice.h>

void main() {
	char buffer[50];
	os_ClrHome();
	
	real_t x = os_Int24ToReal(0); // change to any value
	
	os_RealToStr(buffer, &x, 0, 1, -1);
	os_SetCursorPos(0, 0);
	os_PutStrFull("x=");
	os_SetCursorPos(0, 3);
	os_PutStrFull(buffer);
	
	real_t sin_x = os_RealSinRad(&x);
	real_t asin_sin_x = os_RealAsinRad(&sin_x);
	os_RealToStr(buffer, &asin_sin_x, 0, 1, -1);
	os_SetCursorPos(1, 0);
	os_PutStrFull("asin(sin(x))=");
	os_SetCursorPos(1, 14);
	os_PutStrFull(buffer);
	
	real_t cos_x = os_RealCosRad(&x);
	real_t acos_cos_x = os_RealAcosRad(&cos_x);
	os_RealToStr(buffer, &acos_cos_x, 0, 1, -1);
	os_SetCursorPos(2, 0);
	os_PutStrFull("acos(cos(x))=");
	os_SetCursorPos(2, 14);
	os_PutStrFull(buffer);
	
	real_t acos_sin_x = os_RealAcosRad(&sin_x);
	os_RealToStr(buffer, &acos_sin_x, 0, 1, -1);
	os_SetCursorPos(3, 0);
	os_PutStrFull("acos(sin(x))=");
	os_SetCursorPos(3, 14);
	os_PutStrFull(buffer);
	
	real_t asin_cos_x = os_RealAsinRad(&cos_x);
	os_RealToStr(buffer, &asin_cos_x, 0, 1, -1);
	os_SetCursorPos(4, 0);
	os_PutStrFull("asin(cos(x))=");
	os_SetCursorPos(4, 14);
	os_PutStrFull(buffer);
	
	while (os_GetCSC() == 0);
}

I get an output of:

x= 0
asin(sin(x))= 1.570796327
acos(cos(x))= 1.570796327
acos(sin(x))= 0
asin(cos(x))= 0

Let me know if this change works!

@runer112
Copy link
Member

runer112 commented Feb 6, 2022

If these were indeed mislabeled, src/include/ti84pceg.inc should also be updated. And also https://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File.

@jacobly0
Copy link
Member

jacobly0 commented Feb 7, 2022

Seems legit:
arcrad

@jacobly0 jacobly0 requested review from jacobly0 and runer112 February 7, 2022 02:12
@jacobly0 jacobly0 merged commit 3293d36 into CE-Programming:master Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants