Upload 2 files
Browse files- .gitattributes +1 -0
- index.html +17 -19
- pi-art.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
pi-art.jpg filter=lfs diff=lfs merge=lfs -text
|
index.html
CHANGED
|
@@ -1,19 +1,17 @@
|
|
| 1 |
-
<!doctype html>
|
| 2 |
-
<
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
</body>
|
| 19 |
-
</html>
|
|
|
|
| 1 |
+
<!doctype html><html lang="fa" dir="rtl"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="theme-color" content="#25112f"><title>π ∞ | عدد پی</title>
|
| 2 |
+
<style>
|
| 3 |
+
:root{--pink:#ff8fc5;--gold:#ffd95c;--ink:#21102d;--glass:rgba(44,20,54,.72)}*{box-sizing:border-box}body{margin:0;min-height:100vh;color:#fff;font-family:Tahoma,Arial,sans-serif;background:radial-gradient(circle at 80% 0%,#ff9ecb55,transparent 34%),linear-gradient(145deg,#1c1230,#43234f 48%,#152d59);overflow-x:hidden}body:before{content:"";position:fixed;inset:0;background:url('pi-art.jpg') center 18%/cover no-repeat;opacity:.22;filter:saturate(1.3);z-index:-2}body:after{content:"";position:fixed;inset:0;background:linear-gradient(180deg,#1a0e2a55,#1a0e2aee 65%);z-index:-1}.wrap{max-width:760px;margin:auto;padding:18px 14px 40px}.hero{text-align:center;padding:15px 8px 20px}.orb{width:92px;height:92px;margin:auto;border-radius:28px;display:grid;place-items:center;font-size:55px;color:#8a3500;background:linear-gradient(145deg,#fff6a6,#ffc629 55%,#ff8b32);box-shadow:0 0 35px #ffcb4b88,inset 0 3px 8px #fff9;border:2px solid #fff0b8}.hero h1{margin:12px 0 5px;font-size:28px;color:#ffe58a;text-shadow:0 2px 16px #ff8bc5}.hero p{margin:0;color:#f9d8ed;font-size:13px}.panel{background:var(--glass);border:1px solid #ffc9e955;border-radius:24px;padding:17px;margin:12px 0;box-shadow:0 12px 35px #09051266;backdrop-filter:blur(12px)}.label{font-size:12px;color:#ffd5eb;margin-bottom:10px}.digits{direction:ltr;text-align:left;overflow-wrap:anywhere;max-height:180px;overflow:auto;background:#10091dcc;border:1px solid #ffb6df55;border-radius:16px;padding:14px;color:#fff3b2;font:16px/1.8 ui-monospace,monospace;letter-spacing:.4px}.stats{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.stat{background:#ffffff0d;border:1px solid #ffffff1c;border-radius:16px;padding:12px}.stat b{display:block;color:#ffe38a;font-size:22px;direction:ltr;text-align:right}.stat span{font-size:11px;color:#f5cfe6}.controls{display:flex;gap:9px;flex-wrap:wrap}.controls button,.action{border:0;border-radius:14px;padding:13px 16px;font-weight:bold;font-size:13px;cursor:pointer}.primary{background:linear-gradient(120deg,#ffe77a,#ffae52);color:#55233c;box-shadow:0 5px 18px #ffbd4b44}.secondary{background:#ffffff18;color:#fff;border:1px solid #ffc5e866!important}.controls input{width:100%;background:#10091dcc;color:white;border:1px solid #ffb6df66;border-radius:13px;padding:13px;font-size:15px}.hint{font-size:11px;line-height:1.9;color:#e8cce0}.status{font-size:12px;color:#ffdf8a;margin-top:10px;min-height:20px}.footer{text-align:center;color:#e7c6dc;font-size:10px;margin-top:18px}button:disabled{opacity:.5}.spark{color:#ffacd7}
|
| 4 |
+
</style></head><body><main class="wrap"><header class="hero"><div class="orb">π</div><h1>π ∞</h1><p>کارگاه محاسبهٔ بیپایان عدد پی ✨</p></header>
|
| 5 |
+
<section class="panel"><div class="label">نمایش رقمهای محاسبهشده</div><div class="digits" id="digits">3.14159265358979323846264338327950288419716939937510</div><div class="status" id="status">آمادهایم؛ یک دقت انتخاب کن و شروع بزن.</div></section>
|
| 6 |
+
<section class="panel"><div class="stats"><div class="stat"><b id="count">50</b><span>رقم اعشار نمایشدادهشده</span></div><div class="stat"><b id="speed">—</b><span>زمان آخرین محاسبه</span></div></div></section>
|
| 7 |
+
<section class="panel"><div class="label">چند رقم اعشار محاسبه شود؟</div><input id="target" type="number" min="20" max="10000" step="100" value="500" inputmode="numeric"><p class="hint">برای حفظ پایداری گوشی، هر بار تا ۱۰٬۰۰۰ رقم در نظر گرفته شده است. ارقام با الگوریتم چودنوفسکی و محاسبات BigInt تولید میشوند.</p><div class="controls"><button class="primary" id="go">✦ محاسبه کن</button><button class="secondary" id="copy">کپی رقمها</button><button class="secondary" id="save">ذخیره TXT</button></div></section>
|
| 8 |
+
<section class="panel"><div class="label">دربارهٔ این محاسبهگر</div><p class="hint">این برنامه رقمها را از روی فرمول ریاضی محاسبه میکند و به فهرست آمادهٔ رقمهای پی متکی نیست. محدودیت واقعی، توان پردازنده و حاف��هٔ دستگاه است؛ برای عددهای خیلی بزرگ، گوشی ممکن است کند شود.</p></section><div class="footer">ساختهشده با عشق به ریاضیات و کمی جادوی صورتی <span class="spark">♥</span></div></main>
|
| 9 |
+
<script>
|
| 10 |
+
const $=id=>document.getElementById(id);let busy=false;
|
| 11 |
+
function isqrt(n){if(n<2n)return n;let x=n,y=(x+1n)>>1n;while(y<x){x=y;y=(x+n/x)>>1n;}return x;}
|
| 12 |
+
function computePi(digits){const guard=12,prec=digits+guard,scale=10n**BigInt(prec);let M=1n,L=13591409n,X=1n,K=6n,S=L*scale;const terms=Math.ceil(digits/14.181647462+1);for(let i=1;i<terms;i++){M=(M*(K*K*K-16n*K))/(BigInt(i)*BigInt(i)*BigInt(i));L+=545140134n;X*=-262537412640768000n;S+=(M*L*scale)/X;K+=12n;}const root=isqrt(10005n*scale*scale);let pi=(426880n*root*scale)/S;const rounded=pi/10n**BigInt(guard);let raw=rounded.toString().padStart(digits+1,'0');return raw[0]+'.'+raw.slice(1,digits+1);}
|
| 13 |
+
$('go').addEventListener('click',()=>{if(busy)return;let n=Math.floor(Number($('target').value));if(!Number.isFinite(n)||n<20||n>10000){$('status').textContent='عدد باید بین ۲۰ تا ۱۰٬۰۰۰ باشد.';return;}busy=true;$('go').disabled=true;$('status').textContent='در حال محاسبه… ممکن است چند لحظه طول بکشد.';setTimeout(()=>{try{let t=performance.now();let result=computePi(n);$('digits').textContent=result;$('count').textContent=n;$('speed').textContent=((performance.now()-t)/1000).toFixed(2)+'s';$('status').textContent='محاسبه کامل شد ✨';try{localStorage.setItem('pi-infinity-last',result)}catch(e){}}catch(e){$('status').textContent='محاسبه ناموفق بود؛ تعداد رقم کمتری امتحان کن.';}finally{busy=false;$('go').disabled=false;}},40);});
|
| 14 |
+
$('copy').onclick=async()=>{try{await navigator.clipboard.writeText($('digits').textContent);$('status').textContent='رقمها کپی شدند ♥';}catch(e){$('status').textContent='کپی خودکار در این دستگاه در دسترس نیست.';}};
|
| 15 |
+
$('save').onclick=()=>{const blob=new Blob([$('digits').textContent],{type:'text/plain;charset=utf-8'});const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='pi-infinity.txt';a.click();URL.revokeObjectURL(a.href);};
|
| 16 |
+
try{const old=localStorage.getItem('pi-infinity-last');if(old&&old.length>50){$('digits').textContent=old;$('count').textContent=old.length-2;$('status').textContent='آخرین نتیجهٔ ذخیرهشده بازیابی شد.'}}catch(e){}
|
| 17 |
+
</script></body></html>
|
|
|
|
|
|
pi-art.jpg
ADDED
|
Git LFS Details
|