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

simplify_arithmetic_expression - Division by 0 does not work #23

Open
avighnac opened this issue Jun 14, 2023 · 0 comments
Open

simplify_arithmetic_expression - Division by 0 does not work #23

avighnac opened this issue Jun 14, 2023 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@avighnac
Copy link
Member

avighnac commented Jun 14, 2023

Code:

#include <arithmetica.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
    char *answer = simplify_arithmetic_expression ("1/0", 0, 10);
    printf("%s\n", answer);
    free (answer);
    answer = simplify_arithmetic_expression ("1/0", 1, 0);
    printf("%s\n", answer);
    free (answer);
    answer = simplify_arithmetic_expression ("1/0", 2, 0);
    printf("%s\n", answer);
    free (answer);
    answer = simplify_arithmetic_expression ("1/0+2/0", 1, 0);
    printf("%s\n", answer);
    free (answer);
}

Output:

u+0
1/0
u + u/0
... apparently runs into some kind of infinite loop

Expected:

undefined
undefined
undefined
undefined
avighnac added a commit that referenced this issue Jun 14, 2023
@avighnac avighnac added bug Something isn't working help wanted Extra attention is needed labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant