Well, I did have
TFy: Single = 0.95;
Tfx: Single = 1 - TFy;
But that failed to compile.
It doesn't compile because those are not true constants. The compiler cannot evaluate Tfx because it involves TFy which is NOT a constant (it is stored somewhere in the data segment instead of only existing in the compiler's parsing table(s)).
"true constant"? What does that even mean? A constant is a constant whether integer or float... is pi a constant? Is it true? False?
Syntactically dumb since it will evaluate integers correctly as I noted above, and it's not hyperdrive-rocketry to evaluate the expression as I wrote it. I agree with Mr. Arioch that this appears to be a deficiency in the compiler. Or at least an inconsistency.
I really don't see the issue with a constant being set float, esp. if the code specifies the data size as I did: z: single = y*0.333;
I'm not a compiler expert to be sure, but allowing the integer constants to evaluate as I pointed out above, but not floating point seems to be a glaring inconsistency.
To whit, I'm not sure if the constant expression is inserted in the code - and therefore leaving me to wonder about the algebraic "sanity" of the whole thing.
Which is why people resort to hacks as Arioch suggests (not that I'd go there).
Anyway CodeZwerk's suggestion is fine and the universe did not break on compile or execution.
Never thought of a type cast in a constant statement.
Hmmm... I am not sure if I would call it a typecast, I would call it a typed constant
Usually a typed constant looks (to little old me) like:
x: word = 33333;
Your slipping in the parentheses seems hacky... but hacky-work is better than code that doesn't compile ---- !