中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 11:38
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Mathematical calculation commands bc.exe and lmp.exe | Batch processing calculation tools
Printable Version  2,853 / 15
Floor1 yishanju Posted 2010-04-29 07:49
银牌会员 Posts 1,357 Credits 1,488
Mathematical calculation commands bc.exe and lmp.exe | Batch processing calculation tools | Command line calculation tools | Batch processing mathematical operation tools | Mathematical operation command line tools

Piling up the above keywords is only for facilitating others' search. The brief introductions of these two command line tools have been posted on my own blog:

Mathematical calculation command lmp.exe http://hi.baidu.com/yinkeju/blog/item/ffd845105dcd97f0c2ce795b.html

Usage of the batch processing bc command, usage of the dc command http://hi.baidu.com/yinkeju/blog/item/bb29d8b4286f067f8bd4b286.html
Floor2 HAT Posted 2010-04-29 17:03
版主 Posts 5,017 Credits 9,023
Is bc the same as the bc for Unix?
Floor3 yishanju Posted 2010-04-29 17:10
银牌会员 Posts 1,357 Credits 1,488
Originally posted by HAT at 2010-4-29 17:03:
Is bc similar to the Unix bc?


Yes
The gunwin32 version
Floor4 yishanju Posted 2010-04-29 17:11
银牌会员 Posts 1,357 Credits 1,488
Another download page for bc.exe: http://gnuwin32.sourceforge.net/packages/bc.htm
Floor5 yishanju Posted 2010-04-29 17:14
银牌会员 Posts 1,357 Credits 1,488
There is also a command-line tool called MATH.EXE, which has very limited functionality. Since it's not straightforward, it's not recommended.
Floor6 pdanniel66 Posted 2010-04-30 07:12
初级用户 Posts 64 Credits 68
Is lmp.exe tool Windows version ?
Floor7 yishanju Posted 2010-04-30 08:28
银牌会员 Posts 1,357 Credits 1,488
lmp.exe has a WINDOWS version: http://sourceforge.net/projects/lmp/files/
Floor8 plp626 Posted 2010-05-03 22:26
银牌会员 Posts 1,020 Credits 2,278
I tried it, very disappointed,
lmp calculates 2+1/3
displays result as 2! Why doesn't it even support floating-point numbers!
bc doesn't support infix expressions, and when calculating, you have to convert infix to postfix by yourself. Who has the mood for that?

Still, math is simple and practical,
Floor9 yishanju Posted 2010-05-03 22:35
银牌会员 Posts 1,357 Credits 1,488
Haha, is that so?

I use bc.exe and LMP.EXE very well

Only unhappy with MATH.EXE, too weak in function.

You mean support for floating point numbers means using floating point numbers to represent the calculation result?

My math is miserable, probably not even comparable to junior high school level
==I'll take a look/

Also, lmp.exe has not been updated by anyone since 2001

[ Last edited by yishanju on 2010-5-3 at 22:47 ]
Floor10 yishanju Posted 2010-05-03 22:52
银牌会员 Posts 1,357 Credits 1,488
bc.exe is a command for evaluating infix expressions
dc.exe is for postfix
Floor11 yishanju Posted 2010-05-03 23:01
银牌会员 Posts 1,357 Credits 1,488
```batch
echo off

lmp -p 20 "2+1/3"
echo lmp.exe is so wronged

pause

\Script\Batch Calculation>echo off
2.33333333333333348136
lmp.exe is so wronged
Press any key to continue. . .
```
Floor12 yishanju Posted 2010-05-03 23:07
银牌会员 Posts 1,357 Credits 1,488
...This result actually came out. Sweat
Floor13 plp626 Posted 2010-05-03 23:22
银牌会员 Posts 1,020 Credits 2,278
I just saw it now. I was going to add 5 points for you, but it turned into deducting 15 points. So sweaty.
Floor14 yishanju Posted 2010-05-03 23:24
银牌会员 Posts 1,357 Credits 1,488
This is how I use BC.exe to calculate factorials..
The BC command is claimed to be an arbitrary-precision calculator,
GUNWIN32's BC.EXE can calculate the factorial of 1800.

setlocal EnableDelayedExpansion

for /l %%a in (2,1,18) do (
set m=!m!*%%a
set a=%%a
)

echo %m%|bc.exe


\Scripts\Batch processing calculation>echo 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18 | bc.exe
6402373705728000

pause

[ Last edited by yishanju on 2010-5-3 at 23:27 ]
Floor15 HAT Posted 2010-05-04 10:23
版主 Posts 5,017 Credits 9,023
How to make the result of math retain a specified number of decimal places?
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023