[Issue 7691] A pure std.math.floor

2015-01-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7691

AndyC a...@squeakycode.net changed:

   What|Removed |Added

 CC||a...@squeakycode.net

--- Comment #5 from AndyC a...@squeakycode.net ---
In dmd 2.066.1, I get:
$ dmd test.d
/usr/include/dmd/phobos/std/math.d(4183): Error: Cannot convert double to
ulong* at compile time
/usr/include/dmd/phobos/std/math.d(3288):called from here: isNaN(x)
test.d(4):called from here: floor(2.3)


Any reason it has to be enum?  Changing it to either const or immutable
compiles fine:

pure void main() {
const double x = floor(2.3);
}

--


[Issue 7691] A pure std.math.floor

2012-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7691


hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx


--- Comment #1 from hst...@quickfur.ath.cx 2012-03-28 08:04:13 PDT ---
Most std.math functions need use asm; we need to write ctfe versions for them.

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


[Issue 7691] A pure std.math.floor

2012-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7691



--- Comment #2 from bearophile_h...@eml.cc 2012-03-28 10:03:17 PDT ---
(In reply to comment #1)
 Most std.math functions need use asm; we need to write ctfe versions for them.

But note that I'd like to use it mostly in run-time code.

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


[Issue 7691] A pure std.math.floor

2012-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7691



--- Comment #3 from hst...@quickfur.ath.cx 2012-03-28 10:05:51 PDT ---
Does dmd even support pureness checking for asm blocks? If not, I'm not sure
when we will be able to mark asm functions as pure.

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


[Issue 7691] A pure std.math.floor

2012-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7691


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #4 from Don clugd...@yahoo.com.au 2012-03-28 11:12:44 PDT ---
(In reply to comment #3)
 Does dmd even support pureness checking for asm blocks? If not, I'm not sure
 when we will be able to mark asm functions as pure.

asm blocks are ignored for pureness checking.

And I think it has to be that way. In the asm for BigInt, at one point I write
to a static variable. That variable is never read from, EVER. It's a trick to
force Intel processors to stay in sync every pass through the loop.

It would be impossible to enforce, anyway.

BTW: floor() isn't pure, because floorl() isn't pure,  because floorl(), being
a C function, may set the matherr variable.

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