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

Review factorial. #1292

Open
1uc opened this issue Jun 3, 2024 · 1 comment
Open

Review factorial. #1292

1uc opened this issue Jun 3, 2024 · 1 comment

Comments

@1uc
Copy link
Collaborator

1uc commented Jun 3, 2024

In nocmodl the string factorial is reserved for the function factorial and will refuse to compile. In NMODL, it seems to generate a user-specified and it doesn't not error out.

Valid:

NEURON {
    SUFFIX recursion
}

FUNCTION myfactorial(n) {
    myfactorial = factorial(n)
} 

Invalid:

NEURON {
    SUFFIX recursion
}

FUNCTION factorial(n) {
    if (n == 0 || n == 1) {
        factorial = 1
    } else {
        factorial = n * factorial(n - 1)
    }
}
@nrnhines
Copy link
Collaborator

nrnhines commented Jun 3, 2024

Yes. factorial is listed in nrn/src/nmodl/extedf.h as a supported function (from the scoop-math library)

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

No branches or pull requests

2 participants