Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Complex numbers..How to use in upp??
Re: Complex numbers..How to use in upp?? [message #33836 is a reply to message #33821] Sat, 17 September 2011 12:12 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

There is a support for complex numbers in U++ Core: the Complex class. See uppsrc/Core/Complex.h for some details. It is based on the std::complex that Javier recommended in previous post, but adds some integration with U++, e.g. Value compatibility.

Simple usage:
#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN{
	Complex a(1,2);
	Cout() << "a = " << a << "\n";
	Cout() << "Im(a) = " << a.imag() << "\n";
	Cout() << "Re(a) = " << a.real() << "\n";
	Cout() << "|a| = " << abs(a) << "\n";
	Cout() << "2a = " << Complex(a+a) << "\n";
	Cout() << "a^2 = " << Complex(a*a) << "\n";
}


Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extend StaticText with method possible?
Next Topic: dli file for Oracle10g
Goto Forum:
  


Current Time: Fri May 10 07:36:27 CEST 2024

Total time taken to generate the page: 0.01387 seconds