HP Forums
HP Prime: Operations with Large Numbers - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP Prime: Operations with Large Numbers (/thread-253179.html)



HP Prime: Operations with Large Numbers - Eddie W. Shore - 10-19-2013

Large Factorial (Version 2) - HP Prime

EXPORT LFACT(N)
BEGIN
LOCAL K,S,A;
FOR K FROM 2 TO N DO
S:=S+LOG(K);
END;
RETURN { ALOG(FP(S)), IP(S) };
END;

This is an approximation! Results: {mantissa, exponent}. To be interpreted like this: mantissa * 10^exponent

Examples (compared with actual calculations with HP 50g):

55!
LFACT: 1.2696403353 * 10^73
Actual: 1.26964033537 * 10^73

65!
LFACT: 8.24765059247 * 10^90
Actual: 8.24765059208 * 10^90

75!
LFACT: 2.48091408072 * 10^109
Actual: 2.48091408114 * 10^109

125!
LFACT: 1.88267716466 * 10^209
Actual: 1.88267717689 * 10^209

245!
LFACT: 3.44638099725 * 10^480
Actual: 3.44638108855 * 10^480

525!
LFACT: 6.89080261728 * 10^1201
Actual: 6.89080262404 * 10^1201

875!
LFACT: 1.31677044437 * 10^2196
Actual: 1.31677038751 * 10^2196

Large Powers - HP Prime

EXPORT LPWR(X,Y)
BEGIN
LOCAL S;
S:=Y*LOG(K);
RETURN { ALOG(FP(S)), IP(S) };
END;

This is an approximation! Results: {mantissa, exponent}. To be interpreted like this: mantissa * 10^exponent

Examples (compared with actual calculations with HP 50g):
50^38
LPWR: 3.63797880819 * 10^64
Actual: 3.63797880709 * 10^64

102^68:
LPWR: 3.84425050422 * 10^136
Actual: 3.84425050254 * 10^136

58^124:
LPWR: 4.624568333 * 10^218
Actual: 4.62456834156 * 10^218

302^219:
LPWR: 1.32288017481 * 10^543
Actual: 1.32288017363 * 10^543