Hello,
I am looking for a function to limit the number after the decimal point of a real.
The input parameters of this function are Val type and Reel NBdigit of type Int.
The output parameter is a real
Here is an example My_Fonction (3.45789, 2). The output value is 3.45.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PROGRAMReal_To_RealVAR_INPUT  rIn:REAL;      Digit:INT;      END_VARVAR_OUTPUT rOut    :REAL;   END_VARVAR  d1:DINT;  r0,r1,r2,Rdigit:REAL;          END_VAR//**********************************************************************************//*********************************************************************************rdigit  :=INT_TO_REAL(Digit);r0:=EXPT(10,rdigit);r1:=rIn*r0;d1:=TRUNC(r1);r2:=DINT_TO_REAL(d1);rout:=r2/r0;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am looking for a function to limit the number after the decimal point of a real.
The input parameters of this function are Val type and Reel NBdigit of type Int.
The output parameter is a real
Here is an example My_Fonction (3.45789, 2). The output value is 3.45.
J'ai fait ma function
Voici le code :
have a look at w www.oscat.de w for a lot of functions you can use.