Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > NumericUpDown > Bug? NumberOfDecimalDigits affects actual value

Not answered Bug? NumberOfDecimalDigits affects actual value

Feed from this thread
  • Alessandro avatar

    Posted on Mar 31, 2011 (permalink)

    Hi All,

    we're evaluating the Telerik Suite of controls for our products. While testing your RadNumericUpDown, I found a rather serious issue (or so it seems): setting the NumberOfDecimalDigits actually rounds the inner value to that precision. I am expecting that the value stays the same and the aforementioned property only affects the DISPLAY of that value.

    Code to reproduce:

    [Test]
    public void Value_NumberDecimalDigitsIsLessThanPrecision_IsNotModified()
    {
        _nud.NumberFormatInfo.NumberDecimalDigits = 3;
        _nud.Value = 100.12345;
        _nud.NumberFormatInfo.NumberDecimalDigits = 0;
        Assert.That(_nud.Value, Is.EqualTo(100.12345));
    }

    this unit test fails with:

    Expected: 100.12345000000001d
    But was:  100.123d

    this means that the value gets immediately truncated to the NumberOfDecimalDigits and then further changes to NumberOfDecimalDigits do not modify it anymore... Really odd!

    Can you tell me more about this?

    Thanks a lot.

    Alessandro

    Reply

  • Yana Yana admin's avatar

    Posted on Apr 4, 2011 (permalink)

    Hi Alessandro,

    Thank you for your interest in RadControls for Silverlight.

    Actually this behavior of RadNumericUpDown is by design - the reason for this is to avoid showing a wrong value in the control (because when NumberOfDecimalDigits is set, the value is rounded).

    We  hope that this is not a major show-stopper for you.

    All the best,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > NumericUpDown > Bug? NumberOfDecimalDigits affects actual value
Related resources for "Bug? NumberOfDecimalDigits affects actual value"

Silverlight NumericUpDown Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]