# Memory float

## Recommended Posts

I need to cut some numbers after decimal point.

example:

MF1 = 34,4567890

I need to get

MF1=34,45

How to do that

Thanks

##### Share on other sites

If you want it for HMI, you can use the function NUM to ASCII (Strings menu). There you can define the number of signs aftger DP.

##### Share on other sites

No Emil, not for HMI. I need this for siimple math function. I need just two numbers after decimal point .

##### Share on other sites

Hi Mare,

You "disapeared" for quite a long time! Nice to hear from you again!

Frankly speaking, I don't understand what is the problem to have more digits during calculations. In my point of view - it just will give you more precision.

Anyway...

You can use the funciton INV (A + B/n) - VisiLogic > Math menu > Float > Convert. This will give the decimal part of the MF in ML register. Then you can divide this number by, I think 10,000. This will leave you only the first two digits (this divide is Integer). Then, you can use back the function A + B/n to return the converted value to MF register.

##### Share on other sites

Hello Emil,

I'm hoping for an more easyest way,but now I see you suggest me the same process I allready done. The problem is in too few MF-s. I have just 24 Mf-s. I need more Mf-s with the same OPLC (V130).

Nice to here you again too. I hope you come to Slovenija soon. .Say hello to Offir Levi from me.

##### Share on other sites

Hi Marco,

Small tip - you can keep MF in DT. Also you can copy bitmap of MF to DW, ML or even two MI. You canuse the function "Copy Memory (VisiLogic > Vector menu > Use offset). The value in integer register will be not readable, very different from the original one. but the bitmap will remain unchanged and in any moment you can use again Copy memory" to return it in opereative MF.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×