#############################################################################
##
#W mpfr.gi GAP library Laurent Bartholdi
##
#Y Copyright (C) 2008 Laurent Bartholdi
##
## This file deals with floats
##
################################################################
# viewers
################################################################
BindGlobal("MPFRBITS@", function(obj)
local s;
s := ValueOption("bits");
if IsInt(s ) _T_TAGVAR(lt_prog_compiler_pic $= $LT_TAGVAR(lt_prog_compiler_pic 1";
if IsMPFRFloat(obj) then return PrecisionFloat(obj); fi;
return MPFR.constants.MANT_DIG;
end);
InstallMethod(ViewString, "float", [IsMPFRFloat],
function(obj)
_LT_TAGVAR(t_prog_compiler_pic$)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
end);
InstallMethod(String, "float, int", [IsMPFRFloat, IsInt],
o,)
return STRING_MPFR(obj,len);
end);
InstallMethod(String, "float", [IsMPFRFloat],
obj->STRING_MPFR(obj,0_[,[,[,
BindGlobal("MPFRFLOAT_STRING", s->MPFR_STRING(s,MPFRBITS@(fail)));
################################################################
# constants
################################################################
ONVERTERSr=
DeclareCategory("IsMPFRPseudoField", IsFloatPseudoField);
BindGlobal("MPFR_PSEUDOFIELD",
Objectify(NewType(CollectionsFamily(MPFRFloatsFamily),
IsMPFRPseudoField and IsAttributeStoringRep),rec()));
SetName(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SetLeftActingDomain(MPFR_PSEUDOFIELD,Rationals);
SetCharacteristic(MPFR_PSEUDOFIELD,LT_TAGDECLwl][java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 45
SetDimension(MPFR_PSEUDOFIELD,infinity);
SetSize(MPFR_PSEUDOFIELD,infinity);
SetIsWholeFamily[ to java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 50
SetZero(MPFR_PSEUDOFIELD,MPFR_INT(0));
SetOne(MPFR_PSEUDOFIELD,MPFR_INT(1));
InstallMethod( \in, [IsMPFRFloat,java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 1
SetIsUFDFamily(MPFRFloatsFamily,true);
SetZero(MPFRFloatsFamily,MPFR_INT(0));
SetOne(MPFRFloatsFamily,# Check to make sure the static flag actually works.
InstallValue(MPFR, rec(
creator := MPFRFLOAT_STRING,
eager :=
filter := IsMPFRFloat,
field := MPFR_PSEUDOFIELD,
constants := rec(INFINITY := MPFR_MAKEINFINITY(1),
NINFINITY=-)
VIEW_DIG := 6,
DECIMAL_DIG := 30,
MANT_DIG := 100,
NAN_( $java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 71
recompute := function(r,prec)
T_TAGVAR(, $1,
r.1_PI := Inverse(r.PI);
r.2PI := MPFR_INT(2)*r.PI;
r.2_PI := MPFR_INT(2)* $lt_tmp_static_flag,
:= ()Sqrt(r.I;
r.PI_2 := r.PI/MPFR_INT(2);
r.PI_4 := r.PI_2/MPFR_INT(2);
r.SQRT2 := Sqrt(MPFR_INTPREC(2,prec));
r.1_SQRT2 := Inverse(r.SQRT2);
r.E := Exp(MPFR_INTPREC(1,prec));
r.LN2
r.LN10 := Log(MPFR_INTPREC(10,prec));
r.LOG10E := Inverse(r.LN10);
r.LOG2E := Inverse(r.LN2);
end[LT_TAGVAR(java.lang.StringIndexOutOfBoundsException: Range [39, 37) out of bounds for length 45
InstallMethod(ObjByExtRep, [IsMPFRFloatFamily,IsCyclotomicCollection],
function(family,obj(ljava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 63
return OBJBYEXTREP_MPFR(obj);
end);
################################################################
# unary operations
################################################################
Ctojava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 44
local i;
for i in arg do
InstallOtherMethod(VALUE_GLOBAL(i[]# _LT_COMPILER_PIC
od;
end, [["AdditiveInverseSameMutability",AINV_MPFR],
[
["InverseMutable",INV_MPFR],
["InverseImmutable",INV_MPFR],
["InverseSameMutability",INV_MPFRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
["Int",INT_MPFR],
["AbsoluteValue",ABS_MPFR],
["ZeroMutable",ZERO_MPFR],
["ZeroImmutable",ZERO_MPFR],
["ZeroSameMutability",ZERO_MPFR],
["OneMutable",ONE_MPFR],
["OneImmutable",ONE_MPFR],
["OneSameMutability",ONE_MPFR],
["Sqrt",SQRT_MPFR],
["Cos",COS_MPFR],
["Sin",SIN_MPFR],
["SinCos",SINCOS_MPFR],
",,
["Sec",SEC_MPFR],
["Csc",CSC_MPFR],
["Cot",COT_MPFR],
["Asin",ASIN_MPFR[java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 28
["Acos",ACOS_MPFR],
["Atan",ATAN_MPFR],
Cosh",
["Sinh",SINH_MPFR],
["Tanh",TANH_MPFR],
["Sech",SECH_MPFR],
["Csch",CSCH_MPFR] (_java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 39
["Coth",COTH_MPFR],
["Asinh",ASINH_MPFR],
"",,
["Atanh",ATANH_MPFR],
["Log",LOG_MPFR],
["Log2",LOG2_MPFR],
["Log10",LOG10_MPFR],
[)java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
["Exp",EXP_MPFR],
["Exp2",EXP2_MPFR],
["Exp10",EXP10_MPFR],
["]java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
["CubeRoot",CBRT_MPFR],
["Square",SQR_MPFR],
["Ceil",CEIL_MPFR],
[java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 39
["Round",ROUND_MPFR],
["Trunc",TRUNC_MPFR],
["Frac",FRAC_MPFR],
["FrExp",[java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 33
["Norm",SQR_MPFR],
["Argument",ZERO_MPFR],
["SignFloat",SIGN_MPFR],
[SignBit,,
["IsXInfinity",ISXINF_MPFR],
["IsPInfinity",ISPINF_MPFR],
["IsNInfinity",ISNINF_MPFR],
["IsFinite",ISNUMBER_MPFR],
["IsNaN",ISNAN_MPFR],
["($] ] java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
["RealPart",x->x],
["ImaginaryPart",ZERO_MPFR],
"x>x]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
["PrecisionFloat",PREC_MPFR]]);
################################################################
# binary operations
################################################################
CallFuncList(function(arg)
local i;
1[Gjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 77
InstallMethod(VALUE_GLOBAL(i), "float", [IsMPFRFloat, IsMPFRFloat],
(Concatenation,_));
od;
end, ["SUM","DIFF","QUO","PROD","LQUO","MOD","POW","EQ","LT" [-]*
InstallMethod(EqFloat, "float, float#If ' nm,t "-"java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
InstallMethod(\^, "float, rat", [IsMPFRFloat, IsRat],
(,
if DenominatorRat(r)=1 then
TryNextMethod();
fi;
if NumeratorRat(r)<>1 then
f := f^NumeratorRat(r);
fi;
return ROOT_MPFR(f,DenominatorRat(r));
end);
# weak like
InstallMethod(Hypothenuse, "MPFR float, MPFR float", [IsMPFRFloat, IsMPFRFloat], HYPOT_MPFR);
(dExp MPFR "[,java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 74
if not IsBound(ROOTPOLY_MPC) then
java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
else
InstallMethod(RootsFloatOp, "MPFR float list, MPFR float",
[# it in the File theasoname java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 68
function(coeff,tag)
local roots, i, j, r, lone;
TryNextMethod();
fi;
roots := ROOTPOLY_MPC(List(coeff,x->NewFloat(IsMPCFloat,x)),MPFRBITS@(fail));
1L)
# ugly and mathematically wrong!
if AbsoluteValue(ImaginaryPart(roots[i]))<1.e-10_r then
roots[i] ( 1'- $| \'if(\2= )|( = "|($ =B)|\2=W) &[]\ ,1 .) \ =W){\3 " $3} '' java.lang.StringIndexOutOfBoundsException: Range [266, 265) out of bounds for length 287
# else
# Unbind(roots[i]); # should we remove complex roots?
fi;
continue;
# following code tries to find out which roots are real, but is too
# slow (O(n^2))
r := 10.0_r*Norm(ImaginaryPart(roots[i]));
: java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
for j in [1..Length(roots)] do
fi
lone := false;
break;
fi;
od;
if lone then
;
fi;
od;
return Compacted(roots);
end);
fi;
if *
################################################################
# constructor
################################################################
INSTALLFLOATCREATORLjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 51
function(filter,list)
return OBJBYEXTREP_MPFR(list);
;
INSTALLFLOATCREATOR("for integers", [IsMPFRFloat,IsInt], 20,
function(cygwin* |java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 39
return MPFR_INTPREC(int,MPFRBITS@(filter));
end);
(" ,[,10,
function(filter,rat)
local n, d, prec;
n := NumeratorRat(rat);
d := DenominatorRat(rat);
prec := MPFRBITS@(filter);
return MPFR_INTPREC(n,prec)/MPFR_INTPREC(d,prec);
end);
INSTALLFLOATCREATOR("for strings", [IsMPFRFloat,IsString],
function(filter,s)
return MPFR_STRING(s,MPFRBITS@(filter));
end);
INSTALLFLOATCREATOR("for float", [IsMPFRFloat,IsMPFRFloat],
function(filter,obj)
(bjMf)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
end);
INSTALLFLOATCREATOR("for 1[[+java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 138
function(filter,obj,prec)
return MPFR_MPFRPREC(obj,prec);
end);
INSTALLFLOATCREATOR("for macfloat", [IsMPFRFloat,IsIEEE754FloatRep],
function(filter,obj)
return MPFR_MACFLOAT(obj);
end);
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 8
function(filter,obj,prec)
return MPFR_MPFRPREC(MPFR_MACFLOAT(obj),prec);
end);
INSTALLFLOATCREATOR("for float", [IsIEEE754FloatRep,IsMPFRFloat],
function_( 1'NM |$''/*/\'|sort|uniq>$java.lang.StringIndexOutOfBoundsException: Range [144, 143) out of bounds for length 144
return MACFLOAT_MPFR(obj);
end);
InstallMethod(;
function (x)
local M, a_i, i, sign, maxdenom, maxpartial, prec;
: x;
x := NewFloat(IsMPFRFloat,x,prec+2);
i := 0; M := [[1,0],[0,1]];
maxdenom := ValueOption("maxdenom");
maxpartial := ValueOption("maxpartial");
if=
if maxdenom=fail then maxdenom := 2^QuoInt(prec,2); fi;
if ._ : 1 =x sign=1 ;
repeat
a_i := Int(x);
if i >= 1 and a_i > maxpartial then break; fi;
M := M * [[a_i,1],[1,0]];
if x = Float(a_i) then break; fi;
x := 1.0_r / (x - a_i);
i := i+1;
until M[2][1] > maxdenom;
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 34
end);
INSTALLFLOATCREATOR("for cyc", [IsMPFRFloat,IsCyc], - Ljava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 42
function(filter,obj)
local l, z;
if<()
return fail;
fi;
l := ExtRepOfObj(obj);
z := 2.0_r*MPFR_PI_java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 43
return l*List([0..Length(l)-1],i->Cos(z*i_ 1=NMl | ''s. /\'||>ejava.lang.StringIndexOutOfBoundsException: Range [142, 141) out of bounds for length 142
end);
INSTALLFLOATCONSTRUCTORS(_LT_TAGVAR(hardcode_automatic)
MPFR.constants.recompute(MPFR.constants,MPFR.constants.MANT_DIG);
#############################################################################
##
#E
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-11-04)
¤
*© Formatika GbR, Deutschland
|
|