mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 07:10:40 +01:00
[poincare] Replace complex constructors by named constructors
Change-Id: I6aad82edfb1bd243c4537a48888655608b90eeb5
This commit is contained in:
@@ -12,14 +12,16 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Complex::Complex(float a, float b, bool polar) :
|
||||
m_a(a),
|
||||
m_b(b)
|
||||
{
|
||||
if (polar) {
|
||||
m_a = a * cosf(b);
|
||||
m_b = a * sinf(b);
|
||||
}
|
||||
Complex Complex::Float(float x) {
|
||||
return Complex(x,0.0f);
|
||||
}
|
||||
|
||||
Complex Complex::Cartesian(float a, float b) {
|
||||
return Complex(a,b);
|
||||
}
|
||||
|
||||
Complex Complex::Polar(float r, float th) {
|
||||
return Complex(r*cosf(th),r*sinf(th));
|
||||
}
|
||||
|
||||
static inline float setSign(float f, bool negative) {
|
||||
@@ -55,7 +57,7 @@ Complex::Complex(const char * integralPart, int integralPartLength, bool integra
|
||||
}
|
||||
|
||||
Expression * Complex::clone() const {
|
||||
return new Complex(m_a, m_b);
|
||||
return new Complex(Cartesian(m_a, m_b));
|
||||
}
|
||||
|
||||
float Complex::privateApproximate(Context& context, AngleUnit angleUnit) const {
|
||||
@@ -136,6 +138,12 @@ int Complex::convertFloatToText(float f, char * buffer, int bufferSize,
|
||||
return requiredLength;
|
||||
}
|
||||
|
||||
Complex::Complex(float a, float b) :
|
||||
m_a(a),
|
||||
m_b(b)
|
||||
{
|
||||
}
|
||||
|
||||
int Complex::convertComplexToText(char * buffer, int bufferSize, FloatDisplayMode displayMode) const {
|
||||
assert(displayMode != FloatDisplayMode::Default);
|
||||
int numberOfChars = 0;
|
||||
|
||||
Reference in New Issue
Block a user