Skip to content

Update numeric.d#1893

Closed
9il wants to merge 4 commits intodlang:masterfrom
9il:patch-3
Closed

Update numeric.d#1893
9il wants to merge 4 commits intodlang:masterfrom
9il:patch-3

Conversation

@9il
Copy link
Member

@9il 9il commented Jan 31, 2014

Modify private oppositeSigns.
Reason: findRoot!(double, real) failed to compile.

Modify `private oppositeSigns`.
Reason: `findRoot!(double, real)` failed to compile.
@9il
Copy link
Member Author

9il commented Jan 31, 2014

Error (without fix)

/usr/include/dmd/phobos/std/numeric.d(837): Error: template std.numeric.oppositeSigns does not match any function template declaration. Candidates are:
/usr/include/dmd/phobos/std/numeric.d(682):        std.numeric.oppositeSigns(T)(T a, T b)
/usr/include/dmd/phobos/std/numeric.d(837): Error: template std.numeric.oppositeSigns(T)(T a, T b) cannot deduce template function from argument types !()(double, real)
/usr/include/dmd/phobos/std/numeric.d(715): Error: template instance std.numeric.findRoot!(double, real) error instantiating
source/app.d(307):        instantiated from here: findRoot!(double, real)
source/app.d(307): Error: template instance std.numeric.findRoot!(double, real) error instantiating

@Poita
Copy link
Contributor

Poita commented Feb 1, 2014

LGTM

Edit: there should be a unit test for the bug to protect against regressions.

@ghost
Copy link

ghost commented Feb 1, 2014

The usual convention is T1/T2/etc.., not Ta/Tb.

@9il
Copy link
Member Author

9il commented Feb 1, 2014

@Poita, unittest added.
@AndrejMitrovic , T1/T2 fixed.

@9il
Copy link
Member Author

9il commented Feb 1, 2014

One test failed after T1 and T2 fix:
Internal error: backend/cg87.c 925.
Probably it is unrelated bug.

@ghost
Copy link

ghost commented Feb 1, 2014

Could you file the ICE? Thanks.

@9il
Copy link
Member Author

9il commented Feb 1, 2014

@monarchdodra
Copy link
Collaborator

The usual convention is T1/T2/etc.., not Ta/Tb.

Yeah, that or T and U (and V). The "issue" with T1/T2, is that if you change them to T..., then T1 becomes T[0], and T2 becomes T[1]. Not really a huge issue here, but I have encountered this once or twice when "upgrading" code before. Kind of off topic, but just wanted to throw that in there. Something to think about.

@ghost
Copy link

ghost commented Feb 2, 2014

Btw where does T/U/V come from?

@ghost
Copy link

ghost commented Feb 2, 2014

Something to think about.

Hmm yep. It's funny how we're used to 0-indexing but we often use T1/T2 rather than T0/T1.

@monarchdodra
Copy link
Collaborator

Btw where does T/U/V come from?

Simply the alphabet I guess. Kind of like we start with x, and then we have y and z for dimensions. For Meta programming, we started with T, and the next logical letter is simply U.

@monarchdodra
Copy link
Collaborator

Hmm yep. It's funny how we're used to 0-indexing but we often use T1/T2 rather than T0/T1.

In C++, migrating from pair to tuple is a bit painful for at first because of that too: The member names are literally first and second!

@9il
Copy link
Member Author

9il commented Feb 2, 2014

I will create new PR because I delete my clone of Phobos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants