Sign check for Numbers #1027

Merged
merged 4 commits into from Jul 8, 2016

Projects

None yet

3 participants

@rajithv
Contributor
rajithv commented Jul 7, 2016

In order to implement, <,<=,> and >= for numbers in Ruby Wrappers.
They are required for the tests of evalf function.

@rajithv rajithv Sign check for Numbers
d4c0735
@rajithv
Contributor
rajithv commented Jul 7, 2016
@isuruf isuruf commented on an outdated diff Jul 7, 2016
symengine/cwrapper.h
@@ -206,6 +206,8 @@ int basic_diff(basic s, const basic expr, const basic sym);
int basic_eq(const basic a, const basic b);
//! Returns 1 if both basic are not equal, 0 if they are
int basic_neq(const basic a, const basic b);
+//! Returns +1 if s is positive, 0 if 0, -1 if negative
@isuruf
isuruf Jul 7, 2016 Member

Can you mention that s should be a Number object?

@isuruf isuruf commented on the diff Jul 7, 2016
symengine/cwrapper.cpp
@@ -394,6 +394,17 @@ int basic_neq(const basic a, const basic b)
return SymEngine::neq(*(a->m), *(b->m)) ? 1 : 0;
}
+int basic_number_sign(const basic s)
+{
@isuruf
isuruf Jul 7, 2016 Member

Add an assert here to check that s is a Number

@certik
certik Jul 7, 2016 Contributor

We should finish up #746, then the (Debug time) assert statement will be inside the rcp_static_cast function.

@certik
Contributor
certik commented Jul 7, 2016

What @isuruf said. Otherwise +1.

@rajithv rajithv Assert for Number in basic_number_sign
81a6019
@rajithv
Contributor
rajithv commented Jul 8, 2016

Same issue as with the parser for the appveyor tests. (https://ci.appveyor.com/project/rajithv/symengine/build/114).

rajithv added some commits Jul 8, 2016
@rajithv rajithv is_a_Number method wrapped
cbcba18
@rajithv rajithv imaginary_part and real_part for ComplexMPC
28d9dcc
@isuruf
Member
isuruf commented Jul 8, 2016

This time a different test failed while uploading artifacts.

@isuruf isuruf merged commit bb18f1c into symengine:master Jul 8, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@isuruf
Member
isuruf commented Jul 8, 2016

Thanks for the PR @rajithv. Ignore appveyor test failures for now

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