Whenever PHP has a large number, it uses scientific notation. I would like PHP to use the full number rather than scientific notation because it results in a loss of precision which my program needs.

If anyone can help me prevent PHP from using scientific notation, i would preciate it.

Note: I need to multiply one number, so just having a string with " " at the beginning wont work.

    By the time PHP starts using scientific notation, it has already lost precision - this is inherent in double-precision arithmetic because no matter how you cut it, you can't fit infinity into 64 bits.

    For arbitrary-precision arithmetic you can look at the [man]bc[/man]math functions.

      but I can fit an entire 33kb template page into one variable... so you should be able to fit 9999999999.... ect into one variable as well. I will try the functions you suggested. they seem like they will be perfect for my cause. all i wanted was strings... i never wanted them to be recognized as numbers anway.

        there is a value in php.ini called precision

        its how many digits it will display for a floating point number.

        in your case, maybe increasing this value would help.

        i think theres also a setting for serialize precision.

          Originally posted by Cavour
          but I can fit an entire 33kb template page into one variable... so you should be able to fit 9999999999.... ect into one variable as well.

          You could if you stored it as a string of digits. Storing it as a number is an entirely different proposition. Computer processors and their circuitry for performing arithmetic are only a certain size and can only accommodate numbers of a certain magnitude. The de facto standard is 32 bits, although 64-bit processors are becoming more common. If you want to store a larger number than can be fit into that many bits, you have to break it into pieces and store and work with the pieces.

          I will try the functions you suggested. they seem like they will be perfect for my cause. all i wanted was strings... i never wanted them to be recognized as numbers anway.

          Since these functions convert all numbers going into them into strings of digits, and work with them that way.

            thanks a lot for your help, everything is working great

              Write a Reply...