标题: [数值计算] 批处理怎样进行大数计算? [打印本页]
作者: am873 时间: 2013-11-20 17:07 标题: 批处理怎样进行大数计算?
本帖最后由 am873 于 2013-11-20 19:17 编辑
大数文本a.txt每行的数字+b.txt中对应行的数字,结果输出为c.txt
a.txt+b.txt=c.txt
如:
a.txt的内容为:
123456789012345
543210987654321
b.txt的内容为:
36912345678
25454321098
得出的c.txt为:
123456789012345+36912345678=?
543210987654321+25454321098=?
运行以下批处理后,CMD窗口显示“无效数字。数字精确度限为32位。”,输出c.txt的结果为:
123456789012345+36912345678=
123456789012345+25454321098=
543210987654321+36912345678=
543210987654321+25454321098=
该如何修改,谢谢。- @echo off
- (for /f "delims=" %%i in (a.txt) do (
- for /f "delims=" %%j in (b.txt) do (
- set /a m=%%i+%%j
- call echo %%i+%%j=%%m%%
- )
- ))>c.txt
复制代码
作者: 1270697389 时间: 2013-11-20 17:50
本帖最后由 1270697389 于 2013-11-20 17:52 编辑
@echo off
(for /f "delims=" %%i in (a.txt) do (
for /f "delims=" %%j in (b.txt) do (
set /a m=%%i+%%j
call echo %%i+%%j=%%m%%
)
)>>c.txt
)
作者: am873 时间: 2013-11-20 18:15
本帖最后由 am873 于 2013-11-20 18:27 编辑
@echo off
(for /f "delims=" %%i in (a.txt) do (
for /f "delims=" %%j in (b.txt) do (
...
1270697389 发表于 2013-11-20 17:50
谢谢。不过结果还是一样。
作者: foxJL 时间: 2013-11-20 19:15
计算任意位数的正整数加法
看看这篇贴子
http://bbs.bathome.net/redirect. ... 13886&pid=91057
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |