MakeAlgebraicNumber:
PUBLIC
PROC [minPolyRing:
AC.Structure, minimalPolynomial:
POL.Polynomial, real:
BOOL ←
FALSE, isolatingInterval:
RI.RatInterval ←
NIL]
RETURNS [AlgebraicNumber] ~ {
data: POL.PolynomialRingData ← NARROW[minPolyRing.instanceData];
groundStructure: AC.Structure ← data.coeffRing;
IF groundStructure.class.flavor#field AND groundStructure.class.flavor#divisionAlgebra THEN ERROR BadGroundField[groundStructure];
IF
NOT real
THEN {
IF groundStructure.class.algebraicallyClosedField THEN ERROR;
RETURN[
NEW[AlgebraicNumberRec ← [
minPolyRing: minPolyRing,
minimalPolynomial: minimalPolynomial
]] ]
}
ELSE {
IF NOT groundStructure.class.realField THEN ERROR;
IF groundStructure.class.realClosedField THEN ERROR;
IF isolatingInterval = NIL THEN ERROR;
RETURN[
NEW[AlgebraicNumberRec ← [
minPolyRing: minPolyRing,
minimalPolynomial: minimalPolynomial,
real: TRUE,
isolatingInterval: isolatingInterval
]] ]
};
};