C # Infinity (number Infinity)

Source: Internet
Author: User

A JSON fragment

"Rate":Infinity, "CarNum2": 0, "DayNum2": 0, "RealDayNum2": 0, "Quota2": 0

We know that there are several numeric types in C #: int, long, decimal, float, and double. For the first three kinds, if except 0, you will be prompted for an expression error (write a number directly) or a DivideByZeroException exception (using a variable), for the next two, except 0 will be positive and negative infinity, unless you are 0.0/0.0 then get Nan (not a number).

Recently, a bug in the previous code, the data through the AJAX asynchronous request can not be bound to the table in the foreground, through the error of Ajax to find the serialized JSON data errors, to locate the JSON fragment of the case, the rate field should be the return number, But here it returns infinity, then changes the background Division code, when the divisor is 0 o'clock returns 0, no longer do the division operation.

C # Infinity (number Infinity)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.