
Hi there,
implementing interactive GiNaC programs is made extremely painful by the fact that GiNaC's parser accepts too much. This claim can be checked with the attached program derived from an example in the tutorial. Basically, stuff at the end of the string sometimes is accepted even if nonsensical. Moreover, once a well-formed string has been parsed, things tend to be accepted anyway.
$ a.out Enter an expression containing 'x': x.13 put what you want here The derivative of x with respect to x is 1.
$ a.out Enter an expression containing 'x': x. The derivative of 0 with respect to x is 0. Enter an expression containing 'x': x.13 put what you want here The derivative of x with respect to x is 1.
Again:
$ a.out Enter an expression containing 'x': 0 The derivative of 0 with respect to x is 0. Enter an expression containing 'x': log(|x|) The derivative of 0 with respect to x is 0. Enter an expression containing 'x': log(|x|+put anything here) The derivative of 0 with respect to x is 0.
All the best
Roberto
participants (1)
-
Roberto Bagnara