0
votes

I would like to calculate an expression including exponential.

But when I try to evaluate an expression like : exp(-1.0e3)

I get an error message saying : "floating point value too small to represent"

How can I avoid this?

I just want to get 0.0 when value is too small to represent.

1
What Tcl version are you using? I don't have this error on Tcl 8.5.11. - Jerry

1 Answers

1
votes

What version of Tcl are you using? What platform are you on? It works for me (on OSX):

$ tclsh8.4
% expr exp(-1.0e3)
0.0
% info patchlevel
8.4.19
$ tclsh8.5
% expr exp(-1.0e3)
0.0
% info patchlevel
8.5.9
$ tclsh8.6
% expr exp(-1.0e3)
0.0
% info patchlevel
8.6.1

It also works just fine when I put that value in a variable and use that, and I've checked that Tcl is understanding it as a (moderately) large negative number and some much larger negative numbers as well (-1e100).