[Issue 10466] Optional "[]" syntax for std.range.iota too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 25 19:24:57 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10466



--- Comment #4 from hsteoh at quickfur.ath.cx 2013-08-25 19:24:55 PDT ---
Hmm, iota with FP gets tricky, because, for example, 0.1 does not have an exact
representation in floating-point. So if you write iota(0.0, 1.0, 0.1), it's
unclear whether 1.0 will be included or not (for example, you may end up with
0.999999998 and it gets included, or it may end up with 1.0000001 and get
excluded).

One example given in the python docs
(http://docs.python.org/3/tutorial/floatingpoint.html) is that 0.1 + 0.1 + 0.1
!= 0.3, because neither 0.1 nor 0.3 have exact representation in FP. So if you
write iota(0.1, 0.3, ...) you might get surprised by the results. Which makes
iota!"[]" and iota!"()" unreliable when used with FP. :-(

Similar issues exist if we implement issue #10762, if the user-defined type
supports ++ and -- or +=, but does not have exact semantics.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list