Forum Discussion

Nuno_Paulino_10's avatar
Nuno_Paulino_10
Icon for Nimbostratus rankNimbostratus
Aug 09, 2006

Floating values in iRules

Hello!

 

 

I am trying to use floating values in iRules and I am having some problems. When i run the following code:

 

 

when HTTP_RESPONSE {

 

set clicks_server_response [expr [clock clicks -milliseconds] / 1000.0]

 

log local1.info $clicks_server_response

 

}

 

 

I am getting in the logs the string "%g", instead of the corresponding floating value:

 

... : %g ...

 

 

I tryed to use the "format function" and i found the same problems. Does the iRules "TCL subset" suports floating values ?

 

 

I even tryed a simple example from manuals and the result is also the "%g" string

 

% set result [expr (4.0+6)/4]

 

=> %g

 

 

Any ideas?

 

 

Best regards,

 

 

Nuno Paulino

 

 

 

 

 

3 Replies

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I dug into this a bit and found also that using [format %f ...] to force to floating point returns "%f" instead of a numeric value.

     

     

    I opened a case, will let you know what I find out.

     

     

    /deb
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    From Support:

     

    "CR68915 has created to track this issue.

     

    The problem is that we use a scaled down (optimized) version of printf in tmm. We currently do not support "%f" and "%g" calculations in our printf. Thus the default output (the string %f or %g) is returned instead of desired calculation."

     

     

    If this issue is important to you, you can increase its visibility in Development by openning a new case with F5 Support referencing this CR.

     

     

    /deb
  • Optimized.... so that's what we're calling bugs these days! We used to call them *features* (he he)