Hi Chiara,
There is no explicit way to typecast variables in NESTML. However, if you assign a variable with a “real” type to a variable with an “integer” type, the decimal part would be truncated and you will have the integer part in the variable. This is because the integer variables in NESTML correspond to “long” types in C++.
Here’s a small example:
neuron foo: state: x real = 42.8
update: i integer = x print("i: {i}")
Hope this helps.
Thanks, Pooja
On 6. Jul 2023, at 09:59, chiara de luca deluca.1665541@studenti.uniroma1.it wrote:
Hello everyone,
just a small question about NESML.
I would like to cast a variable from float to integer in the onReceive block of a custom synapse model. Is there an easy way to do that? Can't find anything in documentation about that.
Thank you!
Chiara _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org