How can we deal with the problem of turning numbers into scientific notation when they are too long?

Source: Internet
Author: User
When the number is too long, it turns into scientific notation. the numeric value is obtained from the database. because the value is a little large (50 digits), it is immediately counted by science, how can this problem be avoided ?, 50 digits are indeed big enough. You can use strings for storage, because MYSQL cannot process data types of 50 digits. PHP is naturally not so long as a number. Why does it become a scientific notation?
The numeric value is obtained from the database. because the value is a little large (50 digits), it is immediately counted scientifically. how can this problem be avoided?

------ Solution --------------------
50 digits are indeed big enough.
You can use strings for storage, because MYSQL cannot process data types of 50 digits.
PHP does not naturally have such high-precision data types. you can use gmp series functions or BC Math Series functions for processing.
------ Solution --------------------
Well, it is estimated that your max (model_id + 0) is sometimes inaccurate...

If you have to do this, you can
Select model_id from ***
Order by max (model_id + 0) desc
Limit 1;

Depending on your model_id, or this can also be
Select model_id from ***
Order by length (model_id) desc, model_id desc
Limit 1;

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.