Unplanned
Last Updated: 26 Sep 2024 12:33 by ADMIN
Patrik Madliak
Created on: 24 Jan 2024 14:34
Category: NumericTextBox
Type: Bug Report
3
When value is decimal.MaxValue, pressing the up arrow throws an exception

If I type the maximum value for a decimal (79228162514264337593543950335) and then try to increase the number through the arrow buttons, I get the following exception:

System.OverflowException: Value was either too large or too small for a Decimal.

The behavior is reproducible with or without setting the Max parameter to decimal.MaxValue: https://blazorrepl.telerik.com/mSuFwebI299wPCzV25.

5 comments
ADMIN
Tsvetomir
Posted on: 01 Aug 2024 07:50

Hi Patrik,

We discussed this case with the design team and decided to handle the exception by restricting the overflow behavior of the NumericTextBox for all data types. The end user does not expect the value to overflow when it reaches the maximum value of the bound data type.

To indicate this behavior to the user, we will disable the respective arrow button when the Value matches Min or Max. This will ensure that users are visually informed when they have reached the limit.
  1. Are you okay with our decision to restrict the overflow behavior of the NumericTextBox component?
  2. Do you have any concerns or issues with this approach?

I look forward to hearing back from you.

Regards,
Tsvetomir
Progress Telerik

Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out.
-> Start The State of Designer-Developer Collaboration Survey 2024

Patrik Madliak
Posted on: 03 Jul 2024 12:57

Hi Tsvetomir,

Here are answers for your questios:

  • Can you please give me an example where you use the NumericTextBox bound to a decimal and encounter an OverflowException?

 

  • Is there a real-life use case where a NumericTextBox bound to a decimal is configured in this exact manner?
  • What is the reason the NumericTextBox component is configured like that in your scenario?

 

  • Boundary Testing and Validation: It can be used in testing and validation to ensure that your applications correctly handle very large values without causing overflows or errors.
  • Financial Applications: In theoretical or specific financial calculations where extremely large values are involved, it may be necessary to verify that the system can correctly handle the maximum possible values.
  • Does the value (decimal.MaxValue) hold specific significance to your clients?

 

  • Yes, It does.

Regards

Patrik

 

 

 

 

 



ADMIN
Tsvetomir
Posted on: 03 Jul 2024 07:34

Hi Patrik,

I understand your concerns. The reason for this behavior is that in our source code, we first attempt to increment the value and then clamp it to the maximum if needed.

Additionally, we are constantly trying to improve our product, and I would like to gather more information about this specific case with the following questions:

  • Can you please give me an example where you use the NumericTextBox bound to a decimal and encounter an OverflowException?
  • Is there a real-life use case where a NumericTextBox bound to a decimal is configured in this exact manner?
  • What is the reason the NumericTextBox component is configured like that in your scenario?
  • Does the value (decimal.MaxValue) hold specific significance to your clients?

Answering these questions will provide us with better insight into this scenario and help us make a more informed decision.

Regards,
Tsvetomir
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Patrik Madliak
Posted on: 26 Jun 2024 14:36
Hi Tsvetomir,

However, this behavior doesn't reflect the numeric box correctly. If the numeric box has a Max parameter with a value type of decimal, it's logical that if the user clicks on the arrows to increase the number and the current input value is equal to the Max value of the parameter, the value should not increase further.

For example: If my Max value is 10 and the input already shows 10, then when I use the arrow to increase the number, the input should still display 10 (the Max value). Why doesn't this happen for decimal.MaxValue?

Is it really that difficult to implement logic in the NumericTextBox component to check the Max parameter (and similarly the Min parameter) so that if the input value reaches the Max, it stays at the Max value instead of throwing an exception?

Like here:
https://blazorrepl.telerik.com/QIYAGUvI23xLYjwN49 

Regards

Patrik
ADMIN
Tsvetomir
Posted on: 25 Jun 2024 14:03

Hello all,

After a discussion with the dev team regarding potential improvements and recent research on handling decimal overflow, we are planning to maintain the current behavior. The reason is that the existing behavior follows Microsoft's specifications and prevents the potential precision loss associated with silently managing decimal overflow. This ensures our NumericTextBox component maintains accuracy and compatibility with established standards across various platforms and systems.

For further understanding, you can refer to the Microsoft official documentation on floating-point arithmetic overflow, which details this decimal behavior here. Additionally, to see a practical demonstration of decimal overflow, where a standalone decimal (outside of a NumericTextBox component) reaches MaxValue during incrementation and throws an error, please visit this REPL example.

Note

Following the above, we would be interested in seeing examples of real-life cases where the end-user overflows the Numeric input. If anyone has such examples or additional feedback, we would be happy to review and consider them.

Regards,
Tsvetomir
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!