Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Complex.ino

Complex

Example of using the standard library complex numbers.

Boards: 🛈
AVR, AVR USB, Nano Every, Nano 33 IoT, Nano 33 BLE, UNO R4, Pi Pico, Due, Teensy 3.x, ESP8266, ESP32

Output

√(2i) = (1.00,1.00)

Written by PieterP, 2019-11-14 https://github.com/tttapa/Arduino-Helpers

#include <AH/STL/complex>
void setup() {
Serial.begin(115200);
while (!Serial)
;
// Create a complex number
std::complex<double> c{0, 2};
// Print the square root
Serial << "√(2i) = " << std::sqrt(c) << endl;
}
void loop() {}
Dummy header file for Arduino builder.