package org.real2space.neumann.approssi.core.value;

import org.real2space.neumann.approssi.core.structure.Complex;

/**
 * Project Neumann
 *
 * @author RealTwo-Space
 * @version 0
 *          created     2016/11/14
 */

public class Complex32 implements Complex<Float> {
    private float re;
    private float im;

    public Complex32 (float re, float im) {
        this.re = re;
        this.im = im;
    }
    
    public final Float re () {
        return this.re;
    }
    
    public final Float im () {
        return this.im;
    }
    
    public Complex32 conjugate () {
        return new Complex32 (this.re, - this.im);
    }
    
    public void add (Complex<Float> other) {
        this.re += other.re();
        this.im += other.im();
    }
    
    public void subtract (Complex<Float> other) {
        this.re -= other.re();
        this.im -= other.im();
    }
    
    public void multiply (Complex<Float> other) {
        this.re = this.re * other.re() - this.im * other.im();
        this.im = this.re * other.im() + this.im * other.re();
    }
    
    public void divide (Complex<Float> other) {
        this.re = (this.re() * other.re() + this.im() * other.im()) / (other.re() * other.re() + other.im() * other.im());
        this.re = (this.im() * other.re() - this.re() * other.im()) / (other.re() * other.re() + other.im() * other.im());
    }
    
    public Float abs () {
        return 0f;
    }
    
    public Float arg () {
        return 0f;
    }
    
    public Complex32 deepCopy () {
        return new Complex32 (this.re, this.im);
    }

}
@@ -943,27 +943,52 @@
     
-this.re
+float oim
  = 
+o
 th
-is.re *
+er.im ();%0A        float ore =
  oth
@@ -996,33 +996,40 @@
 r.re
+ 
 ()
- - this.im * other
+;%0A        float tim = this
 .im
-()
 ;%0A  
@@ -1038,61 +1038,118 @@
     
-this.im = this.re * other.im() + this.im * other.re()
+float tre = this.re;%0A        %0A        this.re = tre * ore - tim * oim;%0A        this.im = tre * oim + tim * ore
 ;%0A  
@@ -1217,30 +1217,52 @@
     
-this.re = (this.re() *
+float oim = other.im ();%0A        float ore =
  oth
@@ -1270,89 +1270,146 @@
 r.re
+ 
 ()
- + this.im() * other.im()) / (other.re() * other.re() + other.im() * other.im()
+;%0A        float tim = this.im;%0A        float tre = this.re;%0A        %0A        this.re = (tre * ore + tim * oim) / (ore * ore + oim * oim
 );%0A 
@@ -1424,115 +1424,61 @@
 his.
-re
+im
  = (t
-his.im() * other.re() - this.re() * other.im()) / (other.re() * other.re() + other.im() * other.im()
+im * ore - tre * oim) / (ore * ore + oim * oim
 );%0A 
@@ -1689,10 +1689,115 @@
 ;%0A    %7D%0A
+    %0A    public String toString () %7B%0A        return this.re + %22 + %22  + this.im + %22i : (Complex32)%22;%0A    %7D
 %0A%7D

add toString to complex32