Am 28.10.2020 um 18:27 schrieb Artur Bala:
Thank you Ioannis and Sven!!!
To be frank, the kind of expression "abs(d)<0.00001 ? 0 : d" sounds to
me not that much intuitive - anyway, less than zeroifclose() stuff -
but probably it's just lack of experience.
It's basically just a compact if-block which you can read out like this:
Is abs(d) smaller than 1e-5 ? ( <- note the literal question mark in the
syntax!)
If yes, set it to zero - or else if not, then leave it at d (the old value).
This is borrowed from C I believe. The cool thing in hansl (gretl
scripting) is that it also works directly with matrices if you use the
dot-operators. Example (which I cannot test right now):
<hansl>
matrix M = ( I(3) .> 0 ) ? -2 : 0 # note the .>
print M
</hansl>
cheers
sven