X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=blobdiff_plain;f=scilab%2Fmodules%2Felementary_functions%2Fhelp%2Fen_US%2Ffloating_point%2Fdouble.xml;h=e79930e95ab191be8e342f952468b88f5733f15e;hp=b1dc2c6b55f93650ced17b3f29dd2f224eeab33a;hb=a25e21e67aa30a82d8d1d94faaa04b211d49e1df;hpb=6fd243c16e0a734cfea358a91cb54ab6ceb4cbce diff --git a/scilab/modules/elementary_functions/help/en_US/floating_point/double.xml b/scilab/modules/elementary_functions/help/en_US/floating_point/double.xml index b1dc2c6..e79930e 100644 --- a/scilab/modules/elementary_functions/help/en_US/floating_point/double.xml +++ b/scilab/modules/elementary_functions/help/en_US/floating_point/double.xml @@ -2,7 +2,7 @@ i = int64(2)^52 // 52 bits, as for decimal numbers mantissa + i = + 4503599627370496 + +--> i = [i+(0:3:9)' i+(3:30:93)' i+(30:300:930)'] + i = + 4503599627370496 4503599627370499 4503599627370526 + 4503599627370499 4503599627370529 4503599627370826 + 4503599627370502 4503599627370559 4503599627371126 + 4503599627370505 4503599627370589 4503599627371426 + +--> err = i - double(i) // no errors for |integers|<= 2^52 + err = + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + +--> i = int64(2)^53 // 53 bits integers => more accurate than decimal numbers + i = + 9007199254740992 + +--> i = [i+(0:3:9)' i+(3:30:93)' i+(30:300:930)'] + i = + 9007199254740992 9007199254740995 9007199254741022 + 9007199254740995 9007199254741025 9007199254741322 + 9007199254740998 9007199254741055 9007199254741622 + 9007199254741001 9007199254741085 9007199254741922 + +--> err = i - double(i) // round-off errors appear + err = + 0 -1 0 + -1 1 0 + 0 -1 0 + 1 1 0 + +--> i = int64(2)^55 + i = + 36028797018963968 + +--> i = [i+(0:3:9)' i+(3:30:93)' i+(30:300:930)'] + i = + 36028797018963968 36028797018963971 36028797018963998 + 36028797018963971 36028797018964001 36028797018964298 + 36028797018963974 36028797018964031 36028797018964598 + 36028797018963977 36028797018964061 36028797018964898 + +--> err = i - double(i) + err = + 0 3 -2 + 3 1 2 + -2 -1 -2 + 1 -3 2 + +--> i = int64(2)^62 + i = + 4611686018427387904 + +--> i = [i+(0:3:9)' i+(3:30:93)' i+(30:300:930)'] + i = + 4611686018427387904 4611686018427387907 4611686018427387934 + 4611686018427387907 4611686018427387937 4611686018427388234 + 4611686018427387910 4611686018427387967 4611686018427388534 + 4611686018427387913 4611686018427387997 4611686018427388834 + +--> err = i - double(i) + err = + 0 3 30 + 3 33 330 + 6 63 -394 + 9 93 -94 +]]> + + + + b = (rand(1000,1000)<0.5); +--> tic(),for i=1:100, bool2s(b); end, toc() + ans = + 1.1680533 + +--> tic(),for i=1:100, double(b); end, toc() + ans = + 2.9003021 + +--> tic(),for i=1:100, iconvert(b,0); end, toc() + ans = + 2.1867567 +]]> + + + + i = int32((rand(1000,1000)-0.5)*10000); +--> tic(),for j=1:100, double(i); end, toc() + ans = + 2.2464656 + +--> tic(),for j=1:100, iconvert(i,0); end, toc() + ans = + 2.2771408 +]]> + See Also + iconvert + + + bool2s + + int8 @@ -73,6 +223,29 @@ double(x) type + + bin2dec + + + oct2dec + + + hex2dec + + + base2dec + + + History + + + 6.0 + + New int64 and uint64 encoded integers can now be converted. + + + +