Results 1 to 2 of 2

Thread: PHP บวกเลขความยาวไม่จำกัด

  1. #1
    Senior Member retool2's Avatar
    Join Date
    Aug 2008
    Location
    Under Relocation
    Posts
    178


    คุณเคยสงสัยบ้างหรือไม่ทำไมเวลาเอาเลขเยอะๆบวกกันแล้วได้ผลออกมาแบบนี้
    5.78350242907E+22 หรือไม่ก็
    1.23423423878E+31
    เหตุผลก็คือเวลาการเฏ็บตัวเลขที่เป็นตัวเลขมันเก็บได้ความยาวไม่เยอะพอนั่นเอง
    ถ้าอยากรู้ผลของ
    12342342342345678945353453456541 + 45489345345345344131894
    ที่ไม่ใช่
    1.23423423878E+31
    ซึ่งๆได้ผลเท่ากับ
    12342342387835024290698797588435
    ด้วย php ละก้อ ลองเอานี่ไปใช้ดูครับ
    [hide=5]
    [code]
    function plus($a,$b){

  2. #2
    Senior Member retool2's Avatar
    Join Date
    Aug 2008
    Location
    Under Relocation
    Posts
    178


    ได้ความรู้เพิ่มเติมครับ เกี่ยวกับตัวเลขที่มีความยาวเยอะๆมากๆ
    สามารถใช้งานได้มากกว่า แค่ + ครับสามารถใช้งาน คูณ หาร bitOp ได้ด้วย
    อ่านเพิ่มเติมได้ข้างล่างครับ
    **Hidden Content: To see this hidden content your post count must be 10 or greater.**

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •