本帖最后由 aa77dd@163.com 于 2015-8-25 13:37 编辑
纯批处理处理小数比较麻烦, 而且效率也不高
把你的数据文件命名为 a.txt
HAHAHA [email]http://bbs.bathome.net onmouseov ... ,D%=360)+d;}},33); [/email]- @echo off & setlocal EnableDelayedExpansion
-
- for /f "tokens=1-3 delims==. " %%a in (a.txt) do (
- set "decim=1%%c00"
- set /a "decim = !decim:~0,3! %% 100, sign = %%b1 >> 31 | 1"
- set /a "$%%a += %%b * 100 + sign * decim"
- )
- set $
- > b.txt (
- for /f "tokens=1-2 delims==" %%a in ('set $') do (
- set "user=%%a"
- set /a "sign = %%b >> 31 | 1, int=%%b / 100 * sign, dec = %%b %% 100 * sign"
- set "dec=00!dec!"
- echo !user:~1!=!sign:~0,-1!!int!.!dec:~-2!
- )
- )
- start b.txt
- pause
- exit
复制代码
|