package Reldb.RelUserCode;

import org.reldb.rel.v0.types.*;
import org.reldb.rel.v0.types.builtin.*;
import org.reldb.rel.v0.types.userdefined.*;
import org.reldb.rel.v0.values.*;
import org.reldb.rel.v0.vm.Context;

public class op_SQRT__RATIONAL {
	private static final ValueRational do_SQRT(Context context, ValueRational a) {
		          
		// Returns the correctly rounded positive square root of a RATIONAL
		// value.
			return ValueRational.select(context.getGenerator(), Math.sqrt(a.doubleValue()));
	}

	public static final void execute(Context context) {
		ValueRational p0 = (ValueRational)context.pop();
		context.push(do_SQRT(context, p0));
	}
}