Computer Science Canada Some help with real varibles... |
Author: | josh_65665 [ Mon Sep 15, 2008 12:02 pm ] |
Post subject: | Some help with real varibles... |
Lets say i have a varible thats a real right but i dont want it to be long like for example i want 12554.56 instead of 12554.562342534 is there a way to get rid of extra digits |
Author: | Tony [ Mon Sep 15, 2008 12:19 pm ] |
Post subject: | RE:Some help with real varibles... |
round() |
Author: | The_Bean [ Mon Sep 15, 2008 5:14 pm ] |
Post subject: | Re: Some help with real varibles... |
I you really want to "get rid" of extra numbers you can convert to a string, find the decimal position then cut off anything past 2 places after the decimal then convert back to real. An easier method would be num:= round( num*100)/100 |
Author: | lordroba [ Mon Sep 15, 2008 6:40 pm ] | ||
Post subject: | Re: Some help with real varibles... | ||
Or perhaps you mean something like this...
The first number is the width of the string, the second number is how many decimals you want. |