Thread overview
[Issue 15763] std.math.approxEqual is not symmetric
Dec 23, 2016
Lucia Cojocaru
Sep 09, 2019
Berni
December 23, 2016
https://issues.dlang.org/show_bug.cgi?id=15763

Lucia Cojocaru <lucia.mcojocaru@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |trivial
                 CC|                            |lucia.mcojocaru@gmail.com

--
March 31, 2017
https://issues.dlang.org/show_bug.cgi?id=15763

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com
           Assignee|nobody@puremagic.com        |schveiguy@yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> ---
I think that you need to pick one of the two parameters to determine the relative error.

One could use a some test to determine the "best" value, but "best" is subjective. Armed with the knowledge that the second parameter is the one that is the basis for the percentage difference, you can call it in the correct order.

Working on Doc PR.

--
April 01, 2017
https://issues.dlang.org/show_bug.cgi?id=15763

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
             Status|NEW                         |ASSIGNED

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
Hm... also found an issue, because if rhs is a range, but lhs is a value, it swaps the arguments and calls approxEqual(rhs, lhs). Clearly, if rhs is the relative difference determination, you don't want to do this (as the comparison isn't symmetrical).

PR: https://github.com/dlang/phobos/pull/5316

--
April 10, 2017
https://issues.dlang.org/show_bug.cgi?id=15763

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9b4ae1e779a0d086b5e07c76df99f3c097884f5f
fix issue 15763 - Document behavior of relative difference. Also fix
issue where symmetry was assumed when lhs was a value and rhs was not.

https://github.com/dlang/phobos/commit/74a339ea51fc8d568152be7bde1eb46d2e6df4d3 Merge pull request #5316 from schveiguy/fix15763

fix issue 15763 - Document behavior of relative difference merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>

--
June 17, 2017
https://issues.dlang.org/show_bug.cgi?id=15763

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9b4ae1e779a0d086b5e07c76df99f3c097884f5f fix issue 15763 - Document behavior of relative difference. Also fix

https://github.com/dlang/phobos/commit/74a339ea51fc8d568152be7bde1eb46d2e6df4d3 Merge pull request #5316 from schveiguy/fix15763

--
August 07, 2017
https://issues.dlang.org/show_bug.cgi?id=15763

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to newCTFE at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9b4ae1e779a0d086b5e07c76df99f3c097884f5f fix issue 15763 - Document behavior of relative difference. Also fix

https://github.com/dlang/phobos/commit/74a339ea51fc8d568152be7bde1eb46d2e6df4d3 Merge pull request #5316 from schveiguy/fix15763

--
January 05, 2018
https://issues.dlang.org/show_bug.cgi?id=15763

--- Comment #6 from github-bugzilla@puremagic.com ---
Commits pushed to dmd-cxx at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9b4ae1e779a0d086b5e07c76df99f3c097884f5f fix issue 15763 - Document behavior of relative difference. Also fix

https://github.com/dlang/phobos/commit/74a339ea51fc8d568152be7bde1eb46d2e6df4d3 Merge pull request #5316 from schveiguy/fix15763

--
September 09, 2019
https://issues.dlang.org/show_bug.cgi?id=15763

Berni <dlang@croco-puzzle.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang@croco-puzzle.com

--- Comment #7 from Berni <dlang@croco-puzzle.com> ---
PR https://github.com/dlang/phobos/pull/7180 makes clearer, that the function is not intended to be symmetric.

--