ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Float
I’m trying to display a float value derived from some math with .00 precession. So I’ve done this with integer values all the time (with whole numbers). The thing that ain’t working is:
string text= numtostring(FLOATNUMBER,0,0); I’m assuming I need to find a Float to String command. I’ve searched everywhere and can’t find it. I also need to round so I’m not dealing with this: 0.000000000000. I looked at the doc. for the round command and it seems like it only rounds up to whole numbers? Any Help?
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502 |
#2
|
|||
|
|||
Hi Gavin,
What are really want to do? Can you give some example? If you want to round down, take a look at the trunc command. Lars-Olof |
#4
|
|||
|
|||
Gavin,
If you want to round to example 2 decimals and then use the rounded value later. You can do like this: Code:
double roundedfloat=round(FLOATNUMBER*100)/100; |
#5
|
||||
|
||||
Joe,
Your command does exactly what you want. Try this in the script window: numtostring(11.236,0,2) It will return 11.24 as a string.
__________________
Best, Alan |
The Following User Says Thank You to AlanZhang For This Useful Post: | ||
Gavin Douglas (09-25-2008) |