You can use the
ccalc program to try out AFNI expressions. As in
calc> sqrt(-1)
Z = 1
calc> log(-3)
Z = 1.09861
calc> log(3)
Z = 1.09861
calc> log(0)
Z = 0
Showing that I was wrong in my previous post:
sqrt(x) is really
sqrt(abs(x)) (similarly for
log()). Note
log(0)=0, an indication of avoiding blowups.
The
calc programs are based on some functions I wrote in the mid 1980s for parsing and evaluating arithmetic expressions. I believe in 1983-4, so they are around 33 years old now (the functions, not the programs). They still work, even though written in Fortran, so I've never really updated them except around the edges.