![]() |
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-09-29 18:31 |
47,813 topics / 349,918 posts / today 0 new / 48,278 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] Real number addition and subtraction operation script! |
| Printable Version 7,075 / 23 |
| Floor16 不得不爱 | Posted 2006-10-12 23:50 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
The modification has been completed, and the error in subtraction has been resolved! Please test!
1111111111.1111111111-1111111111.1111111112=-0.0000000001 |
|
| Floor17 不得不爱 | Posted 2006-10-13 00:02 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
pengfei:Why does it seem that your code is much slower than mine?
|
|
| Floor18 pengfei | Posted 2006-10-13 00:34 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
Yours is slower. When testing the same operation, yours takes more than thirty milliseconds, and mine takes about fifty milliseconds.
Your code performs operations on decimals and integers together, taking a shortcut in judgment. My original intention when writing was to fully simulate manual calculation. Therefore, the code is the most primitive way of calculation. The variables used in my code are more, and the operations are more complex, which is also one of the reasons affecting the speed. The algorithm is the soul of the program, and the efficiency of solving the same problem will be different. Due to time constraints, the optimization and update of the code will be carried out later... [ Last edited by pengfei on 2006-10-13 at 01:18 ] |
|
| Floor19 pengfei | Posted 2006-10-13 00:37 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
Actually, it's not practical to calculate the numerical range of N bits with the above script, because the storage space of environment variables is limited...
|
|
| Floor20 不得不爱 | Posted 2006-10-13 01:27 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Code updated to correct the problem of comparison code errors when variables are too long! Please test!
|
|
| Floor21 pengfei | Posted 2006-10-13 02:00 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
Gaga~~~! I really can't bear to modify the code in the first paragraph of the first floor. Although the algorithm is the most primitive. But implementing such an algorithm with the three basic structures of batch processing to complete. I am a little complacent myself, hehe~ This is my hard work!!!
Still don't plan to modify it, either write a new code with a new algorithm. Brothers, please help test the bugs in the code of the first paragraph of the first floor... |
|
| Floor22 qasa | Posted 2007-02-23 06:20 |
| 高级用户 Posts 311 Credits 959 From 广东-LianJiang | |
|
After reading the old post, I think the algorithm in this post is worth learning from by everyone, so I'm bumping it up......
|
|
| Floor23 breakme | Posted 2008-11-04 01:04 |
| 新手上路 Posts 6 Credits 5 | |
|
So you guys have already handled this matter. I also wanted to write a calculator myself, but I want to combine all of yours to make a mixed-operation calc. Is there any batch script that supports square roots?
|
|
| Floor24 HAT | Posted 2008-11-04 01:32 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Search more and you'll have it
|
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |