Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 16, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh@quickfur.ath.cx --- Comment #1 from hsteoh@quickfur.ath.cx --- `NaN` is not a template. Are you sure it should be on this list? :) -- |
January 16, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from hsteoh@quickfur.ath.cx --- https://github.com/dlang/phobos/pull/6040 Note that currently I'm not touching abs() because the sig constraint is just too complex. -- |
January 16, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 --- Comment #3 from Răzvan Ștefănescu <rumbu@rumbu.ro> --- NaN assumes that you want to create a real nan; The correct signature will be in my opinion: NaN(F, T)(const T payload) if (isFloatingPoint!T && isUnsigned!T) This will allow to create float or double NaNs. Ref abs: I don't understand exactly why we have abs and fabs. I think that dropping "fabs" and specializing "abs" for each numeric type is a better approach. -- |
January 16, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 --- Comment #4 from hsteoh@quickfur.ath.cx --- Huh. I'm surprised there's such a thing as fabs in std.math. :-P I agree that we should just unify everything under abs(). This is not C, where we can't overload abs() for integer vs. float arguments. Of course, fabs can still be left as an alias to abs() for backward compatibility. We should probably file a separate bug to track this issue. -- |
January 16, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 --- Comment #5 from hsteoh@quickfur.ath.cx --- W.r.t NaN, I agree it would be nice to be able to specify the exact type desired. I don't think the payload has to be a template parameter; it should just be ulong since all unsigned integral types will convert to ulong, and we can just take however many bits to fit into the payload of the requested type. Again, I think this belongs in a separate issue so that it doesn't get lost amid the overloading issues. -- |
January 18, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 --- Comment #6 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/113579ec6be26777198a2e13abe9913226a385e6 Fix issue 18244: Generic functions in std.math need to have proper sig constraints. Not having any sig constraints causes needless conflicts with user-defined numerical types, e.g.: ```` // myNumber.d module myNumber; struct MyNumber { ... } int signbit(T : MyNumber)(T num) { ... } // usercode.d import myNumber; import std.math; MyNumber num; auto x = signbit(num); // tries to call std.math.signbit, and fails ```` Add sig constraints to: * signbit * isFinite. * isNormal. * isSubnormal * sgn. * nextafter. https://github.com/dlang/phobos/commit/e4da79f10f52b1a9cae1143c28b8b3b520efaa10 Merge pull request #6040 from quickfur/signbit_sig Issue 18244: std.math generic functions need to have sig constraints merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com> -- |
January 18, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
February 24, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 --- Comment #7 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a74271be4c93cf95905265597ac9bca426378f55 Revert "Issue 18244: std.math generic functions need to have sig constraints" https://github.com/dlang/phobos/commit/230292aef0353efa25ba5e298c30cdf5ce6717b5 Merge pull request #6213 from dlang/revert-6040-signbit_sig Revert "Issue 18244: std.math generic functions need to have sig constraints" merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org> -- |
February 24, 2018 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- -- |
December 12, 2019 [Issue 18244] Generic functions in std.math cannot be overloaded | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18244 berni44 <bugzilla@d-ecke.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@d-ecke.de --- Comment #8 from berni44 <bugzilla@d-ecke.de> --- Before this can be fixed, the alias this problem mentioned in issue 18287 should be removed. -- |
Copyright © 1999-2021 by the D Language Foundation