package org.psjava.math.ns;

import java.util.Comparator;

public class Float64NumberSystem implements DivisableNumberSystem<Float64>, Comparator<Float64> {

	@Override
	public Float64 getOne() {
		return Float64.valueOf(1);
	}

	@Override
	public Float64 getZero() {
		return Float64.valueOf(0);
	}

	@Override
	public boolean isNegative(Float64 v) {
		return v.toPrimitive() < 0;
	}

	@Override
	public boolean isOne(Float64 v) {
		return v.toPrimitive() == 1;
	}

	@Override
	public boolean isPositive(Float64 v) {
		return v.toPrimitive() > 0;
	}

	@Override
	public boolean isZero(Float64 v) {
		return v.toPrimitive() == 0;
	}

	@Override
	public boolean areEqual(Float64 o1, Float64 o2) {
		return o1.toPrimitive() == o2.toPrimitive();
	}

	@Override
	public int compare(Float64 o1, Float64 o2) {
		return Double.compare(o1.toPrimitive(), o2.toPrimitive());
	}

	@Override
	public int getSign(Float64 v) {
		return Double.compare(v.toPrimitive(), 0);
	}

	@Override
	public Float64 add(Float64 v1, Float64 v2) {
		return Float64.valueOf(v1.toPrimitive() + v2.toPrimitive());
	}

	@Override
	public Float64 subtract(Float64 minuend, Float64 subtrahend) {
		return Float64.valueOf(minuend.toPrimitive() - subtrahend.toPrimitive());
	}

	@Override
	public Float64 divide(Float64 dividend, Float64 divisor) {
		return Float64.valueOf(dividend.toPrimitive() / divisor.toPrimitive());
	}

	@Override
	public Float64 multiply(Float64 v1, Float64 v2) {
		return Float64.valueOf(v1.toPrimitive() * v2.toPrimitive());
	}
}

@@ -153,24 +153,179 @@
 oat64%3E %7B%0D%0A%0D%0A
+%09private static Float64NumberSystem INSTANCE = new Float64NumberSystem();%0D%0A%0D%0A%09public static Float64NumberSystem getInstance() %7B%0D%0A%09%09return INSTANCE;%0D%0A%09%7D%0D%0A%0D%0A
 %09@Override%0D%0A

add static factory method