dgkf / R

An experimental reimagining of R
https://dgkf.github.io/R
GNU General Public License v3.0
136 stars 5 forks source link

Printing of doubles shows different number of digits for values #190

Open sebffischer opened 1 month ago

sebffischer commented 1 month ago

dgkf/R:

> rnorm(100)
  [1]    -0.7922742292955669     0.8129505266497179    0.27059359218109624
  [4]    -0.6953356171139822    0.48938197437494907    -0.3799180565634475
  [7]     1.8383613877676377     0.7029318693904651     -0.817448849519668
 [10]     0.1728942790726076    -0.5364394980147491     0.7996033382822558
 [13]    0.09309572640255367      0.715521956745741      1.202077823439144
 [16]   -0.37648566860694566   -0.12494784391225255    -0.9572818095197885
 [19]     0.8665010652026899   -0.16568078946202097     0.2224226276184238
 [22]     0.4726474433669805      1.940011882937557      1.681720087424463
 [25]     -1.562882860236296      1.551613206799103     -1.462342197712859
 [28]    0.20825774655229917   -0.39862047586337573    -0.5506201553843126
 [31]   -0.25259315045078495    -0.7126654794570113     1.1266942536411413
 [34]    0.42501439129890795 -0.0023944317775159755    -0.9376052762828491
 [37]    -0.5228904127886049     -0.886073539851033    -0.4175548581624305
 [40]    0.38729930556351955     1.9272095220272865    0.05945427225053132
 [43]    -0.7230856675213021    0.11459020581668737     1.5236479317765426
 [46]    -1.8792146267222931  -0.022838866282781256     -0.381816286913902
 [49]    0.04068261813759359    -0.6460826145092992    0.38038022023132995
 [52]    0.49399897075683874   -0.19431855042807866   -0.49878337032033176
 [55]    -0.7776535021155133     0.0860698964481046   -0.49101956570592553
 [58]     0.6695375647962615     1.0569461287501911    -1.6769077234212106

R:

 > rnorm(100)
  [1]  0.240893444  0.855633402 -0.778536987  0.906413743  1.362360009
  [6]  0.679174750  0.631897988  0.244273179 -2.084515412 -0.451828067
 [11]  0.863778789  0.264102475 -0.238275958 -0.541976371  0.833037219
 [16]  0.301112228  0.014958022  0.051472917  1.288206894  0.287773410
 [21] -0.922330586  0.087404935  2.509353087  0.712236809  0.789910877
 [26] -0.276626701  1.012641872 -1.904956208  1.058920778  0.487140478
 [31]  0.272268312  0.529231940  0.853527563 -0.603480916 -0.833801531
 [36]  0.380114391 -0.186833628  0.812969649 -0.540145229 -0.028106635
 [41]  1.491715245 -0.903089543  0.254226789 -0.059203951  0.005937881
 [46]  0.471183330  0.805273952 -0.361090543 -0.567821865  0.586226415
 [51] -0.547309827  0.750616401  0.446055714 -0.334961363 -0.136862204
 [56]  0.640169593 -0.316639867 -0.477504119  1.069877972 -1.163607126
 [61] -0.383184077  1.286455681  0.530527539  0.288473888  0.360279937
 [66] -0.249468509  0.081319198  0.318358575 -0.277290582  0.506254763
 [71] -2.081674925  1.110894236 -0.489002511 -1.152355600  0.020729569
 [76]  0.859239022 -0.348914203 -0.897750223 -0.255809207  1.431431261
 [81] -1.594110567  0.054755534 -0.338811306  1.277316180  0.242391943
 [86]  1.740229269  0.785415927  1.356406291  1.000950010  1.219581198
 [91] -1.574941601  1.744207113 -0.558926928 -0.600459452  2.259120675
 [96]  0.715473463 -1.285184021  1.082221689 -0.107516760  1.099125644