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

Determining whether an integer is a floating-point number

已解决!
转到解答

I want to create a program that when an integer is input into the numeric constant, a floating-point number with all zeros to the right of its decimal point will light the LED on the front panel. The LED will remain unlit for any other floating-point number. I know I want to use a Round to Nearest function, but not sure where to go from there. 

0 项奖励
1 条消息(共 4 条)
5,884 次查看

Hi rtufaro,

 

to put your request into a simple statement:

if number MODULO 1 == 0 then "number is integer"

LabVIEW also has a modulo operation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 项奖励
2 条消息(共 4 条)
5,876 次查看
解答
已被主题作者 dancer8913 接受

@rtufaro wrote:

I want to create a program that when an integer is input into the numeric constant,


You mean CONTROL, right?

 

You just need a type of rounding.  Doesn't matter if you round up or down.  So you just round and then compare the input to the rounded value.  If they are equal, you light up your LED.  So all you need is a numeric control, 2 functions, and a boolean indicator.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 项奖励
3 条消息(共 4 条)
5,873 次查看

Here is basically Gerds suggestion, but in plain LabVIEW.

 

 

Note that this (AND Tim's solution above)  is only relatively safe for user-entered values. If the vaue is the result of some operations, you might run into typical issues with floating point math, so watch out for that.

0 项奖励
4 条消息(共 4 条)
5,827 次查看