中国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-10 16:57
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Discussion]Feasibility Discussion on Using Batch Processing to Calculate Square Roots and Reciprocals
Printable Version  1,683 / 3
Floor1 electronixtar Posted 2006-10-15 09:25
铂金会员 Posts 2,672 Credits 7,493
In the Quake3 engine, there is such a "mars algorithm":



Personally, I think that set /a supports bit operations, and it should be possible to implement the reciprocal of the square root.
Floor2 namejm Posted 2006-10-15 09:40
荣誉版主 Posts 1,737 Credits 5,226 From 成都
```
In the SET command, two new command-line switches are added:

SET /A expression
SET /P variable=

The /A command-line switch specifies that the string to the right of the equal sign is a numerical expression to be evaluated. This expression evaluator is simple and supports the following operations in decreasing order of precedence:

() - Grouping
! ~ - - Unary operators
* / % - Arithmetic operators
+ - - Arithmetic operators
<< >> - Logical shifts
- Bitwise "AND"
^ - Bitwise "XOR"
| - Bitwise "OR"
= *= /= %= += -= - Assignment
&= ^= |= <<= >>=
, - Expression separator
```
  Microsoft's explanations have always been vague. Except for being able to use arithmetic operators and assignment symbols proficiently, I have never understood the rest. Please explain if anyone has used it.

  In CMD, you can't directly calculate decimal multiplication; you still have to operate bit by bit. If you can understand how the set /a symbols are used, the problem of square roots is estimated to be solved easily.
Floor3 不得不爱 Posted 2006-10-15 11:08
超级版主 Posts 2,044 Credits 5,310 From 四川南充
Square root can be solved using Pascal's triangle
Floor4 vkill Posted 2006-10-16 00:08
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Using set /a is too cumbersome, and division is anyway cumbersome

[ Last edited by he200377 on 2006-10-16 at 00:34 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023