[Issue 12170] sum(double[]) is not pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 15 06:10:01 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12170


Peter Alexander <peter.alexander.au at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au at gmail.co
                   |                            |m
         OS/Version|Windows                     |All


--- Comment #1 from Peter Alexander <peter.alexander.au at gmail.com> 2014-02-15 06:09:57 PST ---
The problem is this:

"Cyclic functions (i.e. functions that wind up directly or indirectly calling
themselves) are inferred as being impure, throwing, and @system."

http://dlang.org/function.html

sum uses a recursive algorithm for summing floating point ranges for extra
accuracy, so its purity is not inferred. It cannot just be marked as pure
because the range operations it uses may not be pure.

I'm not sure why that cyclic function restriction exists. I think it should be
possible to infer these attributes on recursive functions. I'll have a think.

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


More information about the Digitalmars-d-bugs mailing list