Home AMX User Forum NetLinx Studio

Why No Decimal Display?

fFrequency=(1000/(nTime*100))
SEND_STRING 0,"FORMAT('%5.3f,fFrequency)"
fFrequency is defined as a float.
nTime is an integer value from a counter where a value of 10 should equal a frequency of one.

All I get for output is integer values as xx.000

Thanks.

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    fFrequency=(1000/(nTime*100))
    SEND_STRING 0,"FORMAT('%5.3f,fFrequency)"
    
    fFrequency is defined as a float.
    nTime is an integer value from a counter where a value of 10 should equal a frequency of one.

    All I get for output is integer values as xx.000

    Thanks.
    You can do one of the following to force a float result:

    Change nTime from an Integer to a Float

    Or

    Change
    fFrequency=(1000/(nTime*100))
    

    To this:
    fFrequency=(1000.0/(nTime*100))
    

    Or to this:
    fFrequency=(1000/(nTime*100.0))
    

    HTH
Sign In or Register to comment.