Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-09 Thread Ali Çehreli via Digitalmars-d-learn
On 09/08/2015 06:37 AM, Steven Schveighoffer wrote: I think this warrants a bug report, iota with only floats as parameters should result in floats. https://issues.dlang.org/show_bug.cgi?id=15033 Ali

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-09 Thread Nordlöw
On Wednesday, 9 September 2015 at 06:37:17 UTC, Ali Çehreli wrote: https://issues.dlang.org/show_bug.cgi?id=15033 Ali https://github.com/D-Programming-Language/phobos/pull/3641

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Ali Çehreli via Digitalmars-d-learn
On 09/08/2015 12:00 AM, drug wrote: import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { } It is probably because the type of floating point literals like 1.0 is double. Probably there is a 1.0 in iota's

Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread drug via Digitalmars-d-learn
import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { }

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 07:17:01 UTC, Ali Çehreli wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/range/package.d#L4630 auto iota(B, E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E))) { return iota(begin, end, 1.0); } Such kind of stuff would

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Meta via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 12:28:07 UTC, Dominikus Dittes Scherkl wrote: On Tuesday, 8 September 2015 at 07:17:01 UTC, Ali Çehreli wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/range/package.d#L4630 auto iota(B, E)(B begin, E end) if

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/8/15 3:17 AM, Ali Çehreli wrote: On 09/08/2015 12:00 AM, drug wrote: import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { } It is probably because the type of floating point literals like 1.0 is double.