取消
显示结果 
搜索替代 
您的意思是: 

LabVIEW Equivilant to excel functions?

已解决!
转到解答

For anyone who is interested in using what I call "conventional rounding," where everything greater than 0.5 is rounded up (statistically less accurate, but sometimes insisted upon by non-techies (i.e. management), here's some code I ripped from someplace here and put it in a drop-in replacement for the "Round to Nearest."  Whoever wrote this please come forward to take credit.

 Round To Conventional.JPG

 

 

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
11 条消息(共 17 条)
2,346 次查看

billko wrote:

For anyone who is interested in using what I call "conventional rounding," where everything greater than 0.5 is rounded up (statistically less accurate, but sometimes insisted upon by non-techies (i.e. management), here's some code I ripped from someplace here and put it in a drop-in replacement for the "Round to Nearest."  Whoever wrote this please come forward to take credit.

 Round To Conventional.JPG


What is it that you don't like at the "Round to Nearest" vi?

Because your code reacts just the same as that one!

 

x.000 to x.5000 result in x

x.50001 to x.99999 result in x+1

 

So I'm 吃惊表情

0 项奖励
12 条消息(共 17 条)
2,336 次查看

Alain S wrote:

billko wrote:

For anyone who is interested in using what I call "conventional rounding," where everything greater than 0.5 is rounded up (statistically less accurate, but sometimes insisted upon by non-techies (i.e. management), here's some code I ripped from someplace here and put it in a drop-in replacement for the "Round to Nearest."  Whoever wrote this please come forward to take credit.

 Round To Conventional.JPG


What is it that you don't like at the "Round to Nearest" vi?

Because your code reacts just the same as that one!

 

x.000 to x.5000 result in x

x.50001 to x.99999 result in x+1

 

So I'm 吃惊表情


 

Technically.... and I mean very technically there is a slight difference.

His example rounds either up or down depending if it is > or < than 0.5


Round to nearest will round to the nearest even integer.

So 13.5 will round up to 14

But 12.5 will round down to 12.

 

But of course, 13.2 will round to 13 even if it is odd.

It only applies if the decimal is exactly 0.5


I believe this is the accepted method is statistics.

Message Edited by Cory K on 08-13-2009 12:59 PM
Cory K
0 项奖励
13 条消息(共 17 条)
2,334 次查看
Oh, no - not THIS again.  Yes, it is not as statistically accurate as LabVIEW's rounding (called "banker's rounding," among other things), and I have indicated as much.  I *like* LabVIEW's rounding better, but some people (management, mostly) insist on using the old way because that's what they're used to so I made the little VI to appease the management gods...  😉
Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 项奖励
14 条消息(共 17 条)
2,325 次查看

billko wrote:
Oh, no - not THIS again.  Yes, it is not as statistically accurate as LabVIEW's rounding (called "banker's rounding," among other things), and I have indicated as much.  I *like* LabVIEW's rounding better, but some people (management, mostly) insist on using the old way because that's what they're used to so I made the little VI to appease the management gods...  😉

 

Yes, I agree that there are uses for both cases.
I was simply pointing out that there was a difference.

I also agree that you never want to upset your boss 眨眼表情

... dont bite the hand that feeds

Cory K
0 项奖励
15 条消息(共 17 条)
2,322 次查看

Ha Ha! The first time I ever encounterred this issue I speculated that it was a bug. Its seem that no matter where you were schooled, we were all taught to "round up" to the nearest high number  (unless you are rounding a -ve number obviously).

 

The rounding standard that LabVIEW uses adheres to the IEEE 754 standard. There is loads of information on the web regarding the standard, but here is a link to the wiki article.

http://en.wikipedia.org/wiki/IEEE_754-2008#Roundings_to_nearest

 

Best wishes,

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
0 项奖励
16 条消息(共 17 条)
2,288 次查看

Jeff Bohrer wrote:


So Round(x,d) will impement as round.PNG I missed the negate of d on the first shot

Message Edited by Jeff Bohrer on 08-13-2009 11:01 AM

Of course, the representation of control X should be DBL not I32! 吃惊表情  or the function will be "pointless"


"Should be" isn't "Is" -Jay
0 项奖励
17 条消息(共 17 条)
2,268 次查看