MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: eval / toliteral safety question



Followup to:  <199606111344.JAA09446@rabbit.INS.CWRU.Edu>
By author:    "Seth I. Rich" <sir@po.cwru.edu>
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.

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


References:

Home | Subject Index | Thread Index