www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6486] New: std.math.abs(BigInt)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6486

           Summary: std.math.abs(BigInt)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I'd like to use std.math.abs on a BigInt too:

import std.bigint, std.math;
void main() {
    auto r = abs(BigInt(-1000));
}


But dmd 2.054 gives:

...\src\phobos\std\math.d(251): Error: pure function 'abs' cannot call impure
function 'opCmp'
...\src\phobos\std\math.d(251): Error: safe function 'abs' cannot call system
function 'opCmp'

Line 251 of math.d is:

return x>=0 ? x : -x;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6486


safety0ff.bugz gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz gmail.com



https://github.com/D-Programming-Language/phobos/pull/1236

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 31 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6486




Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/835fca54e909da1e01476016a47e443cbe196782
BigInt enhancement: make std.math.abs work with BigInt (issue 6486)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6486


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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