China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

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!

中国DOS联盟论坛
The time now is 2026-08-12 09:07
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Mathematical calculation commands bc.exe and lmp.exe | Batch processing calculation tools View 2,843 Replies 15
Original Poster Posted 2010-04-29 07:49 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
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
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
plp626 -15 2010-05-03 22:27
moniuming +15 2010-05-04 00:03

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 2 Posted 2010-04-29 17:03 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Is bc the same as the bc for Unix?
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
yishanju +1 2015-10-13 20:02
Floor 3 Posted 2010-04-29 17:10 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Originally posted by HAT at 2010-4-29 17:03:
Is bc similar to the Unix bc?


Yes
The gunwin32 version

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 4 Posted 2010-04-29 17:11 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Another download page for bc.exe: http://gnuwin32.sourceforge.net/packages/bc.htm

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 5 Posted 2010-04-29 17:14 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
There is also a command-line tool called MATH.EXE, which has very limited functionality. Since it's not straightforward, it's not recommended.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 6 Posted 2010-04-30 07:12 ·  中国 台湾 台湾宽频通讯顾问股份有限公司
初级用户
★★
Credits 68
Posts 64
Joined 2009-05-23 20:43
17-year member
UID 145803
Gender Male
Status Offline
Is lmp.exe tool Windows version ?
Floor 7 Posted 2010-04-30 08:28 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
lmp.exe has a WINDOWS version: http://sourceforge.net/projects/lmp/files/

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 8 Posted 2010-05-03 22:26 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
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,
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Floor 9 Posted 2010-05-03 22:35 ·  中国 北京 大兴区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
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 ]

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 10 Posted 2010-05-03 22:52 ·  中国 北京 大兴区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
bc.exe is a command for evaluating infix expressions
dc.exe is for postfix

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 11 Posted 2010-05-03 23:01 ·  中国 北京 大兴区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
```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. . .
```

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 12 Posted 2010-05-03 23:07 ·  中国 北京 大兴区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
...This result actually came out. Sweat

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 13 Posted 2010-05-03 23:22 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
I just saw it now. I was going to add 5 points for you, but it turned into deducting 15 points. So sweaty.
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Floor 14 Posted 2010-05-03 23:24 ·  中国 北京 大兴区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
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 ]

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 15 Posted 2010-05-04 10:23 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
How to make the result of math retain a specified number of decimal places?
Forum Jump: