LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our General Code Repository Files. Also, before posting here, check to see if your post doesn't fit into another subforum by category.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Rounding, unexpected "Round to Nearest Integer"
Cloedu
post Aug 25 2008, 10:00 AM
Post #1


Enough LAVA to be dangerous


Member
Posts: 4
Joined: 10-October 05
Member No.: 3193
Using LabVIEW Since:2002
LV:8.2.1 ,7.0 ,7.1.1
Switzerland Nothing Selected Nothing Selected


Hello,

i have found unexpexted rounding effects with the function "Round to nearest integer"

Input 0.5
output 0

Input 1.5
output 2

Input 2.5
Output 2

Input 3.5
Output 3

Labview is alwas rounding to a even integer.... but why?
What is the sense of these implementation of auf Rounding alghorithm?

Thanx
Claude

--------------------
Cloedu


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Aug 25 2008, 10:00 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Ton
post Aug 25 2008, 10:40 AM
Post #2


CCT It
*****

Premium Member
Posts: 1337
Joined: 13-June 05
From: Woerden, Netherlands
Member No.: 2399
Using LabVIEW Since:2001
LV:8.5.1 ,6.1 ,8.2.1
Netherlands hol_utrecht Nothing Selected My Blog My Gallery


This is standard behavior and noted in the help. I've just written a wiki article on rounding.

Ton

--------------------
Certified LabVIEW Developer
Shouldn't you be programming a Code Repository solution?


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
tnt
post Aug 25 2008, 10:43 AM
Post #3


More Active
**

Member
Posts: 48
Joined: 27-May 05
Member No.: 2311
Using LabVIEW Since:1999
LV:8.5.1 ,8.0.1 ,7.1
Belgium bel_vlaanderen Netherlands


QUOTE (Cloedu @ Aug 25 2008, 12:00 PM) *
Labview is alwas rounding to a even integer.... but why?
Hi,

as far as I remember this had to do with statistics,
assume you have a big pile of points and they all get rounded up when ending on .5,
you end up with a higher average,
with this statistical rounding, the average would not change that much.

I hope this helps a bit

edit: Ton was a bit quicker in typing as me...

This post has been edited by tnt: Aug 25 2008, 10:44 AM


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
jgcode
post Aug 25 2008, 11:44 AM
Post #4


Very Active
***

Premium Member
Posts: 218
Joined: 1-January 08
From: Perth, Australia
Member No.: 10325
Using LabVIEW Since:2006
LV:8.5.1 ,8.6 ,.
Australia Poland Nothing Selected


QUOTE (Cloedu @ Aug 25 2008, 06:00 PM) *
i have found unexpexted rounding effects with the function "Round to nearest integer"


Thats how I was taught in school.

--------------------
all day...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
mross
post Aug 25 2008, 01:39 PM
Post #5


Very Active
***

Premium Member
Posts: 217
Joined: 31-January 03
From: Wilson NC USA
Member No.: 48
Using LabVIEW Since:2001
LV:8.5 ,. ,.
United States us_north_carolina Kiribati


QUOTE (Cloedu @ Aug 25 2008, 06:00 AM) *
Hello,

Labview is alwas rounding to a even integer.... but why?
What is the sense of these implementation of auf Rounding alghorithm?

Thanx
Claude


LabVIEW follows IEEE standard
round up the odd whole numbers ending with .5,
round down even numbers ending with .5.

From message by
Lew Drake
Process Automation Corporation, and the info LabVIEW mailing list, 4/12/07.

This method accumulates less error over time, it is statistically defensible. If you look around on line you will find detailed explanations, no problem.

--------------------
Michael E. Ross
Senior Design Engineer
Standard Motor Products, Inc.
2717 Commerce Road
Wilson, NC 27893
mross@smpcorp.com
252.234.5821


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Yair
post Aug 25 2008, 05:45 PM
Post #6


Extwemely Active
*****

Premium Member
Posts: 1632
Joined: 23-January 05
From: Here
Member No.: 1431
Using LabVIEW Since:2003
LV:8.6 ,7.0 ,.
Israel Nothing Selected Nothing Selected


If you want to implement common rounding, you can do this by adding 0.5 and then rounding down. Here's an example.

--------------------
More than meets the eye...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 1st December 2008 - 09:34 PM