Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :mathMacros
- if not exist FPU-Module.js echo WScript.Stdout.WriteLine(eval(WScript.Stdin.ReadLine().replace(/\x22/g,"")));> FPU-Module.js
- attrib +h +s FPU-Module.js
- set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
- set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
- set "SIN(x)=(a=(x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
- set "COS(x)=(a=(15708 - x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
- set "_SIN="
- set "Sqrt(N)=( x=(N)/(11*1024)+40, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2 )"
- set "Sign(n)=(n>>31)|((-n>>31)&1)"
- set "Abs(x)=(((x)>>31|1)*(x))"
- set "swap(x,y)=t=x, x=y, y=t"
- set "translate=x+=width / 2, y+=height / 2"
- set "checkBounds=if ^!x^! leq %width% if ^!y^! leq %height% if ^!x^! geq 0 if ^!y^! geq 0"
- goto :eof
- :: Javascript maths
- :math rtnvar expr
- echo "%~2" >%TMP%\in.txt
- Cscript //nologo FPU-Module.js <%TMP%\in.txt >%TMP%\out.txt
- set /p "%1=" <%TMP%\out.txt
- set "%1=!%1:,=.!"
- goto :eof
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement