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

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Rounding String or Float Variables

Post by medelec35 »

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) Downloaded 4896 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
(12.67 KiB) Downloaded 592 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Rounding String or Float Variables

Post by medelec35 »

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
(13.63 KiB) Downloaded 394 times
Last edited by medelec35 on Mon Dec 03, 2018 9:37 pm, edited 1 time in total.
Martin

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

Re: Rounding String or Float Variables

Post by jadiflow »

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

Post Reply