File: mp.html

package info (click to toggle)
swi-prolog-packages 5.0.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 50,688 kB
  • ctags: 25,904
  • sloc: ansic: 195,096; perl: 91,425; cpp: 7,660; sh: 3,046; makefile: 2,750; yacc: 843; awk: 14; sed: 12
file content (72 lines) | stat: -rw-r--r-- 5,612 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Robert A. van Engelen">
   <meta name="GENERATOR" content="Mozilla/4.61 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
</head>
<body background="canvas.gif">

<h1>
The MP library interface for SWI-Prolog, version 1.2</h1>
This package contains the SWI-Prolog interface to the <a href="http://www.swox.com/gmp">GMP</a>
library (GNU Multiple Precision arithmetic library). GMP allows for arbitrary
size integers, arbitrary precision floats, and rational number arithmetic.
In addition, this package includes complex arithmetic added to GMP. Whenever
you run into number
<br>representation problems in SWI-Prolog, you can use this package. MP
integers are very useful as arbitrary sized bitvectors too!
<p>The MP package can be obtained from the SWI-Prolog <a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/packages/mp">MP
package</a> page.
<h1>
Examples of MP in SWI-Prolog</h1>
<font size=-1>?- X mp_is fac(1000).</font>
<br><font size=-1>X =</font>
<br><font size=-1>40238726007709377354370243392300398571937486421071463254379991042993851239862902</font>
<br><font size=-1>05920442084869694048004799886101971960586316668729948085589013238296699445909974</font>
<br><font size=-1>24504087073759918823627727188732519779505950995276120874975462497043601418278094</font>
<br><font size=-1>64649629105639388743788648733711918104582578364784997701247663288983595573543251</font>
<br><font size=-1>31853239584630755574091142624174743493475534286465766116677973966688202912073791</font>
<br><font size=-1>43853719588249808126867838374559731746136085379534524221586593201928090878297308</font>
<br><font size=-1>43139284440328123155861103697680135730421616874760967587134831202547858932076716</font>
<br><font size=-1>91324484262361314125087802080002616831510273418279777047846358681701643650241536</font>
<br><font size=-1>91398281264810213092761244896359928705114964975419909342221566832572080821333186</font>
<br><font size=-1>11681155361583654698404670897560290095053761647584772842188967964624494516076535</font>
<br><font size=-1>34081989013854424879849599533191017233555566021394503997362807501378376153071277</font>
<br><font size=-1>61926849034352625200015888535147331611702103968175921510907788019393178114194545</font>
<br><font size=-1>25722386554146106289218796022383897147608850627686296714667469756291123408243920</font>
<br><font size=-1>81601537808898939645182632436716167621791689097799119037540312746222899880051954</font>
<br><font size=-1>44414282012187361745992642956581746628302955570299024324153181617210465832036786</font>
<br><font size=-1>90611726015878352075151628422554026517048330422614397428693306169089796848259012</font>
<br><font size=-1>54583271682264580665267699586526822728070757813918581788896522081643483448259932</font>
<br><font size=-1>66043367660176999612831860788386150279465955131156552036093988180612138558600301</font>
<br><font size=-1>43569452722420634463179746059468257310379008402443243846565724501440282188525247</font>
<br><font size=-1>09351906209290231364932734975655139587205596542287497740114133469627154228458623</font>
<br><font size=-1>77387538230483865688976461927383814900140767310446640259899490222221765904339901</font>
<br><font size=-1>88601856652648506179970235619389701786004081188972991831102117122984590164192106</font>
<br><font size=-1>88843871218556461249607987229085192968193723886426148396573822911231250241866493</font>
<br><font size=-1>53143970137428531926649875337218940694281434118520158014123344828015051399694290</font>
<br><font size=-1>15348307764456909907315243327828826986460278986432113908350621709500259738986355</font>
<br><font size=-1>42771967428222487575867657523442202075736305694988250879689281627538488633969099</font>
<br><font size=-1>59826280956121450994871701244516461260379029309120889086942028510640182154399457</font>
<br><font size=-1>15680594187274899809425474217358240106367740459574178516082923013535808184009699</font>
<br><font size=-1>63725242305608559037006242712434169090041536901059339838357779394109700277534720</font>
<br><font size=-1>00000000000000000000000000000000000000000000000000000000000000000000000000000000</font>
<br><font size=-1>00000000000000000000000000000000000000000000000000000000000000000000000000000000</font>
<br><font size=-1>00000000000000000000000000000000000000000000000000000000000000000000000000000000</font>
<br><font size=-1>00000000</font>
<p><font size=-1>?- mp_setprec(1024).&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
% set FP precision to 1024 bits</font>
<br><font size=-1>?- X mp_is sqrt(2*i+3).</font>
<br><font size=-1>X = complex(1.817354021023970620075194486035821926469403643127136112063307705827</font>
<br><font size=-1>98994386836569367819201781006267822671005852516893257651651029460417693337196416</font>
<br><font size=-1>58609407469613555208001531461355466661881539728910310774041829617574975966192661</font>
<br><font size=-1>60904275805643425621489471039942081694990642059908662555678722605615719305582387</font>
<br><font size=-1>9, 5.502505227003375110556805653912514370755875596670069658341698224663216572058</font>
<br><font size=-1>03236089501280278961479474740464470806798487688507925589675776987246827344756714</font>
<br><font size=-1>67422712063019093687974321839253821015132556374583491366962882358657238438687375</font>
<br><font size=-1>216946896718239001798449052725072455114219458538995753807255299229557956E-1)</font>
<br>&nbsp;
<br>&nbsp;
</body>
</html>