Bug 6486 – std.math.abs(BigInt)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-08-12T15:25:00Z
Last change time
2013-05-03T16:39:10Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-08-12T15:25:47Z
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;
Comment #1 by safety0ff.bugz — 2013-03-31T16:02:03Z
Comment #2 by github-bugzilla — 2013-04-03T07:11:30Z
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)