I am trying to covert some code that was written in C++
dd=( ir + t - 3.1415927 / 4.0 * ( ir + kn1 * t ) ) * kn* 2
If I write the same formula in IWbasic, will the result be the same? Or do I need extra parenthesis to separate things?
Basically, I am not sure if IWBasic treats (+ - * /) the same way C++ does. I do not program in C++, so I am not sure.
Thanks in advance for your help.
I don't know C++ either but would assume that it follows the standard order of mathematical precedence.
Hi Obelisk.
The order of preference in C++ is the same as in IWB - ie: () * / + -
However, that is one awkward equation. If you consider it split into a few auxiliary parts -
a1 = ir + t
a2 = 4.0 * (ir + kn1 * t)
a3 = kn * 2
dd = (a1 - 3.1415927 / a2) * a3
Without knowing what physical application the equation relates to, I couldn't be sure if that evaluation is correct. ::)
Best wishes, :)
Graham
Thank you for your help!