LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Number to Fractional String not using "round to even"?

Solved!
Go to solution

Number to Fractional String rounding question.png

For sanity check:

https://www.calculatestuff.com/math/rounding-numbers-calculator?number=1.055&round_to_places=2&round... 

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 Kudos
Message 1 of 8
(4,484 Views)
Solution
Accepted by topic author billko

Betcha it's the same basic problem as this recent thread.

 

Even though you typed "1.055", and the display format is set to only show 1.055, try expanding to 20 digits of precision...

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 8
(4,468 Views)

Still yet, proper rounding ignores everything right of the significant digit.  If I say to round to two places, you should look no further than three.

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 Kudos
Message 3 of 8
(4,458 Views)

@billko wrote:

Still yet, proper rounding ignores everything right of the significant digit.  If I say to round to two places, you should look no further than three.


e.g., 1.05509 should round to two digits the same as 1.05500.

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 Kudos
Message 4 of 8
(4,456 Views)

That's also why I made the bottom branch of the code.  It shows how it gets rounded if the same digits get treated as a floating point value with just one decimal place and rounded using the rounding primitive.

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 Kudos
Message 5 of 8
(4,449 Views)
Solution
Accepted by topic author billko

@billko wrote:

@billko wrote:

Still yet, proper rounding ignores everything right of the significant digit.  If I say to round to two places, you should look no further than three.


e.g., 1.05509 should round to two digits the same as 1.05500.


But going to 20 dig. precision, the number is 1.05499999999999994, thus round down to 1.05

0 Kudos
Message 6 of 8
(4,443 Views)

@RavensFan wrote:

@billko wrote:

@billko wrote:

Still yet, proper rounding ignores everything right of the significant digit.  If I say to round to two places, you should look no further than three.


e.g., 1.05509 should round to two digits the same as 1.05500.


But going to 20 dig. precision, the number is 1.05499999999999994, thus round down to 1.05


Ouch - that's awesome.  I thought it was going to be something like 1.05500000000001

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 Kudos
Message 7 of 8
(4,437 Views)

@billko wrote:


Ouch - that's awesome.  I thought it was going to be something like 1.05500000000001


Sometimes those tails of the number will go that way.  Sometimes they are under.

Message 8 of 8
(4,431 Views)