Sorry I was too late to the party to be of any direct use... But the guys probably found that one quicker and better than I would have been able to; C/C++ isn't my favourite language. (Oh, really?!? You could *never* have guessed! So, what else is totally new and unexpected? :-)
But, if I may comment on another issue, "coding style"...? From this snippet:
...the first and perhaps most important characteristic isn't immediately obvious: Is this code situated in the actual fmRefOsc.cpp file, or somewhere else? And if it is in some other "math routines library" file, it still gets called from fmRefOsc.cpp, for instance by a button-click event handler, right? (Though at a guess, I'd wager this is the actual button-click event handler.)//\n// Calculate Normalization factor from entered value.\n//\nfloat NORM1; // overflows 32-bit INT if m is too large.\nint m = StrToInt(fmRefOsc->edM1->Text);\n\nfmRefOsc->edM1->Text = m; /* Show/read the fitting interval */\nfmRefOsc->edInterval1->Text = 2*m + 1;\n\nNORM1 = (m * ((4 * m * m) - 1) * (2 * m + 3) * (m + 1) / 3);\n\n/* Show the calculated normalizing factor. */\n\nfmRefOsc->edNORM1->Text = NORM1;
Anywhichway, I think my point -- a small one, but hopefully one you'll find useful if you continue to work in "Delphi-style" IDEs, with their forms, components, properties, and events -- goes for both cases. It is this: the way you refer to components and their properties, as in "fmRefOsc->edM1->Text", is actually too precise; this can turn out to be a hindrance when later you try to re-use the code, or even if you just decide to alter your naming convention and re-name the form. Practice has shown that it is usually better (especially if this code does belong to the form itself) to use just "edM1->Text"; or, alternatively, (if you want to be anal about "precision and clarity" :-) "this->edM1->Text". But if this is a method of the form object itself, components it owns (like edM1) are visible to the method without the this-> self-reference, so adding it truly is "anal"... (What, no, what does me often doing it anyway have to do with this?!? :-)
Why, you ask? Well, simply: Because if you later change the form's name, you have to go through all these lines where you've referred to it by name, and change those to use the new name. Or, if you decide to expand your program and create multiple instances of this form... then you'll be waaay fucked, when whichever window your users click the button in, stuff only happens to one of them -- quite correctly, in the sense of doing what you ordered, not what you thought you ordered; the one your code is explicitly referring to! -- and you haven't the faintest idea what is wrong! (Listen carefully; this is the voice of experience talking... ;^[ )
The same -- only perhaps even more so -- goes for the case where you have this as a routine in a separate cpp file, with the intention of re-using this in other projects in the future.
HTH!