The modification has been completed, and the error in subtraction has been resolved! Please test!
1111111111.1111111111-1111111111.1111111112=-0.0000000001
1111111111.1111111111-1111111111.1111111112=-0.0000000001
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
set a=2
set/p p=Please enter the number for square root (between 0~89999999)
set/p w=Please enter the number of decimal places to be precise (within 9)
:lp
set /a a=(p/a+a)/2,n=a*a,r=a,y=p-n
if %n% lss 0 goto lp
if %n% gtr %p% goto lp
if %n% equ %p% goto ok
if "%w%"=="" goto ok
set/a m=10,x=r*20,y*=100,b+=1
:lp1
set/a m-=1,s=(x+m)*m
if %s% gtr %y% goto lp1
if %w% neq 0 set/a y-=s,r=r*10+m,t=t*10+m,m=10,x=r*20,y*=100,w-=1&goto lp1
:ok
if not "%t%" == "" set a=%a%.%t%
echo The square root result of %p%: %a%
pause>nul