ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

floating point problem with ramp pattern

Solved!
Go to solution

I have problems with floating point in LAbVIEW.

Increasing A (A is defined in a range for convenience) I obtain different results on X.

This is probably due to floating point of START and END on Ramp pattern inputs.


How can I modify the diagram in order to obtain always the same (Right) result on X?

 

 

0 Kudos
Message 1 of 4
(2,852 Views)
Solution
Accepted by topic author Mal123

Your N is not an integer and you are also running into limitations of floating point math. 

 

A difference on the order of 1e-16 is not an error. DBL only gives you about 15 good decimal digits and errors accumulate with every operation.

0 Kudos
Message 2 of 4
(2,815 Views)

Thank you Altenbach, yes is not an error, but when I put this diagram inside my program I obtain strange results because varying A I have in some cases X=0 or X=39.4 and Ramp Pattern has in some cases Nsamples=0 or Nsamples=1.

 

Do you have some suggestions how can I do? Truncating values?

0 Kudos
Message 3 of 4
(2,784 Views)

@Mal123 wrote:

Thank you Altenbach, yes is not an error, but when I put this diagram inside my program I obtain strange results because varying A I have in some cases X=0 or X=39.4 and Ramp Pattern has in some cases Nsamples=0 or Nsamples=1.

 

Do you have some suggestions how can I do? Truncating values?


Well, a ramp with 0 or 1 samples is not a ramp. Make sure you have at least two points. What is a "strange result" can you be more descriptive?

Where are the inputs coming from and why are they so unreasonable?

0 Kudos
Message 4 of 4
(2,779 Views)