Yes, this was better.
And even better,specially, if s is already a double we can also write :
1 2 3
|
pi4 += s / i;
//...
pi = pi4*4;
|
Wau ... constexpr is superb, i dont know before about it.
Now i already ready read about it. It is really useful in many cases.
.. About shorter or longer variables, i also like to comment :
My opinion is if a ranche of a variable is longer, it is better give a good name for this variable, for understand it better. So i think same as TheldeasMan, however if it is a code in which we use vey often a variable and it is clear which function it have, it would be more readable if it is shorter. For example :
1 2 3 4
|
for(int t=0;t<n; t++) {
arr1[t] = ...;
arr2[t] = ...;
}
|
In some case i already use a superlong name for a variable, such in :
|
checkChangePropCondDelegateBinpartLowTriang();
|
Ok, this was a name of function, but sometimes it will happen for variables. So sometimes, if i use inside a function many times a longer variable or name of a function or a name of a class, i use
* typedef LongNameClass shortClassName;
* className& shortName = longName;
...
greatings, Daniel