## Rounding String or Float Variables

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

medelec35
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3450 times
Contact:

### Rounding String or Float Variables

I though I would develop a different way to round off a float variable.
Using pot you can select number of decimal places (0 to 6)
Rounding off.png (21.54 KiB) Viewed 3205 times

Decimal numbers are basically cut off, and not rounded up or down.
E.g 1.29 to 1dp = 1.2 and not 1.3

Martin

Edit: Temp2 with original flowchart is not required, so it's fine just to delete it.
I have updated flowchart with Temp2 removed.
Attachments
Rounding Float Or String Numbers.fcf
These users thanked the author medelec35 for the post (total 4):
brandonb (Tue Nov 27, 2012 11:35 pm) • Benj (Wed Nov 28, 2012 12:10 pm) • Steven_SS (Mon Dec 03, 2018 9:09 pm) • jgu1 (Tue Dec 04, 2018 4:47 pm)
Rating: 21.05%

Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

medelec35
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3450 times
Contact:

### Re: Rounding String or Float Variables

Hi Steven,
Steven_SS wrote:
medelec35 wrote:I though I would develop a different way to round off a float variable.
Using pot you can select number of decimal places (0 to 6)
Rounding off.png
Decimal numbers are basically cut off, and not rounded up or down.
E.g 1.29 to 1dp = 1.2 and not 1.3
Martin

How can I open this in flowcode V8 Martin? Thanks

Sorry you can't now, take a look at this post
I'm happy to convert any flowcharts for anyone from any version to version 8.

Edit:
Although you have figured it out and now deleted your post, I will leave this post for anyone else who has V8
Attachments
Rounding Float Or String Numbers.fcfx
Last edited by medelec35 on Mon Dec 03, 2018 9:37 pm, edited 1 time in total.
These users thanked the author medelec35 for the post (total 3):
Benj (Mon Dec 03, 2018 10:13 pm) • Steven_SS (Mon Dec 03, 2018 10:17 pm) • jgu1 (Tue Dec 04, 2018 4:47 pm)
Rating: 15.79%

Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Flowcode v5 User
Posts: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

### Re: Rounding String or Float Variables

Can I add my vote that someone fixes this? fround(x,y) doesn't work, instead it work like round(). The floating point number is rounded to the next integer instead of actually rounded up.

If it can't be fixed, maybe indicate in the help file that it doesn't work for PIC processors.

Jan Didden
Linear Audio