Skip to content

Improve cot() function, to ensure x is not exactly a multiple of pi/2#3

Open
alanpawlak wants to merge 1 commit intohacihabiboglu:masterfrom
alanpawlak:fix-cot
Open

Improve cot() function, to ensure x is not exactly a multiple of pi/2#3
alanpawlak wants to merge 1 commit intohacihabiboglu:masterfrom
alanpawlak:fix-cot

Conversation

@alanpawlak
Copy link

Hi! This is a quick fix for cot() function, to ensure that it doesn't return Inf or -Inf. This is because the tangent of x is undefined when x is a multiple of pi/2, which would result in a division by zero error if not handled properly. By subtracting the smallest positive representable number (eps) from x, the expression ensures that x is not exactly a multiple of pi/2 and thus the tangent of x is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant