*/ and ** operator
Tumbler
Posts: 323
Hello,
Can somebody tell me what the */ and the ** operators do?
and are there more of these?
grtz
Can somebody tell me what the */ and the ** operators do?
and are there more of these?
grtz
Comments
Also, Tracy Allen's website discusses these under "math" (see: www.emesystems.com).
x ** y = (x * y) / 65536
Note that the (x * Y) value CAN exceed the 65535 limitation.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Example: Want to multiply a value by pi in PBASIC? Multiply pi by 256 and you get 804.247... So, you can use 804 with */
result = value */ 804············· '·Multiply by ~ pi
Example: Want to multiply a value by 1/sqrt(2) ~ 0.707? You can use */, but ** will give you a more accurate result. Multiply 1/sqrt(2) by 65536, and you get 46340.95..., so use 46341 with **:
result = value ** 46341········· ' Multiply by ~ 1/sqrt(2)
With */ you can multiply by fractional values that are less than 256. With **, you can multiply by values that are less than 1 (max 65535/65536).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/1/2007 11:58:45 PM GMT