Always Round Up

damica1

Member
Join Date
Aug 2015
Location
Illinois
Posts
839
I'm wondering how everyone else might handle this?

I'm reading a raw input value (word) that gets converted to a real, so my real number may be something like this 13685.489.

I would like to ALWAYS have that rounded up so the number I would end up processing would be 13686.00.

I don't want to "TRUNCATE" because that just knocks off the digits to the right of the decimal.

Does anyone recommend a way to do this?

Thanks
 
Split the real number into integer and fractional part, if the fractional > 0 then increment the integer by one
 
I've got a rounding AOI that I use - for any given input, it will return a rounded up, rounded down, and rounded to nearest value output.
 

Similar Topics

hello I have 7cp476 cpu why can led always open and No connection
Replies
1
Views
119
I have a program that I am gradually piecing together (my first program). There are 4 cascading timers that turn Y001 and Y001 + Y002 on and off...
Replies
8
Views
534
So I've been told time and time again that a PID (or PIDE) instruction should never be conditionally enabled/disabled and the only thing that...
Replies
7
Views
669
Found this online :hmmm: Kind of funny :) We use "Always Off" for Dummy Code to Monitor tags in the ladder to avoid [AFI]'s from throwing...
Replies
17
Views
2,977
It seems that the OPs always want to be secretive. Not just on this forum but also on reddit/control theory and especially on a Chinese forum we...
Replies
40
Views
9,851
Back
Top Bottom