Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 17, 2009 [Issue 3000] New: iota should work with floats | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3000 Summary: iota should work with floats Product: D Version: 2.030 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: dsimcha@yahoo.com import std.range; void main() { auto foo = iota(0.0L, 10.0L, 1.0L); } The above doesn't compile and results in a bunch of long errors that aren't particularly useful for diagnosing the cause of the problem. The real problem is line 2089, range.d: return take((end - begin + step - 1) / step, Seq(tuple(begin, step), 0u)); The problem is that, if the arguments to iota are floats, not ints, the number of elements take() is told to take is a float, not an int. This can be fixed trivially by changing that line to: return take(cast(size_t) ((end - begin + step - 1) / step), Seq(tuple(begin, step), 0u)); Also, take() should probably use a ulong, not a size_t. I could picture someone wanting to run a long monte carlo simulation, for example, by taking more than 4 billion elements from an infinite range of random numbers. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 18, 2009 [Issue 3000] iota should work with floats | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsimcha@yahoo.com | http://d.puremagic.com/issues/show_bug.cgi?id=3000 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei@metalanguage.com AssignedTo|bugzilla@digitalmars.com |andrei@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 07, 2009 [Issue 3000] iota should work with floats | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsimcha@yahoo.com | http://d.puremagic.com/issues/show_bug.cgi?id=3000 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-07-07 10:02:24 PDT --- Fixed in future 2.032 (and checked in for the impatient). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 10, 2009 [Issue 3000] iota should work with floats | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsimcha@yahoo.com | http://d.puremagic.com/issues/show_bug.cgi?id=3000 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr@puremagic.com Resolution|FIXED | --- Comment #2 from Brad Roberts <braddr@puremagic.com> 2009-07-09 22:33:01 PDT --- Should the examples be updated to include one for floats, maybe? Also, how about adding a bit more sanity checking such as B, E, and S are all numeric types? Also, what does 'iota' stand for? I keep reading it as 'itoa' which is obviously wrong. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 11, 2009 [Issue 3000] iota should work with floats | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsimcha@yahoo.com | http://d.puremagic.com/issues/show_bug.cgi?id=3000 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-07-11 12:11:32 PDT --- (In reply to comment #2) > Should the examples be updated to include one for floats, maybe? Done. Also found and fixed a couple of issues with negative ranges. > Also, how about adding a bit more sanity checking such as B, E, and S are all numeric types? B and E can be pointers. I did add a check that should eliminate nonsensical calls. > Also, what does 'iota' stand for? I keep reading it as 'itoa' which is obviously wrong. It's an actual word of which meaning in the current context I borrowed from some STL implementations (http://www.sgi.com/tech/stl/iota.html). Bug fixed and checked in; the fix will come in dmd 2.032. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 11, 2009 [Issue 3000] iota should work with floats | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsimcha@yahoo.com | http://d.puremagic.com/issues/show_bug.cgi?id=3000 --- Comment #4 from Brad Roberts <braddr@puremagic.com> 2009-07-11 12:15:59 PDT --- I thought that might be the case (regarding the name), but it wasn't obvious. And I still keep reading it with the o and t reversed. :) Thanks for the updates. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation