MOO-cows Mailing List Archive


Re: eval / toliteral safety question

Followup to:  <199606111344.JAA09446@rabbit.INS.CWRU.Edu>
By author:    "Seth I. Rich" <>
In newsgroup: local.moo
> Is there EVER a circumstace where
>   eval("return " + toliteral(x) + ";")[2]
> would not equal x?  Can anyone think of a situation in which this would
> represent an unsafe operation?  I've been trying to think of a value for
> x for which this expression could have side effects, but I haven't come
> up with anything yet, and I suspect I won't.

Yes.  toliteral() may induce a (small) rounding error when used on
floating-point numbers.

PGP public key available - finger
"The earth is but one country, and mankind its citizens."  --  Bahá'u'lláh
Just Say No to Morden * Save Babylon 5:
The cat is out of the bag - Linux 2.0 is available!


Home | Subject Index | Thread Index