I would like to know how to convert from an integer to a floating point value without assigning an intermediate variable. This code is as follows:
Format('Theoretical peak scaling %6.2f', [ThreadCount])
This is not explicitly executed at run time because it ThreadCountis an integer.
I tried the obvious
Format('Theoretical peak scaling %6.2f', [Double(ThreadCount)])
and the compiler rejects this with
E2089 Invalid typecast
I know I can write
Format('Theoretical peak scaling %6.2f', [ThreadCount*1.0])
but it is poorly read and will simply tempt the future maintainer to remove the multiplication error.
Does anyone know of a clean way to do this without an intermediate variable, and in a way that makes codes clear for future readers?
source
share