datatype *: 14 integer datatype 14^2 floating integer has 63 significant bits, floating has 53.
2^.+:^:(~: >:)^:_] 1 63 2^.+:^:(~: >:)^:_] 1^2 44 44 is actually an artifact of something else, which is comparison tolerance. To see the full precision, we'll need to override that: 2^.+:^:(~:!.0 >:)^:_] 1^2 53 https://en.wikipedia.org/wiki/Numerical_analysis for more general coverage of this issue. Thanks, -- Raul On Thu, Sep 7, 2017 at 11:43 AM, Rudolf Sykora <rudolf.syk...@gmail.com> wrote: >> (n^2) | 5729082486784839 >> >> is promoted to float, and loses precision. Same when the big number is >> extended - it's converted to float. >> > > Hello, > > I still do not understand the logic here. Why do these three differ? > > n =. 14 > > (*: n) | 5729082486784839 > 147 > > (n^2) | 5729082486784839 > 0 > > (n*n) | 5729082486784839 > 147 > > > And where can I find that they are expected to differ? > Can I read somewhere how the conversions/promotions are applied? > > Moreover (!), reading the vocabulary states: > ---- > For a non-negative integer y, the phrase x ^ y is equivalent to */y # x > ---- > thus n^2 should be---if I understand the vocabulary---the same as */2 # n , > but the latter gives the "correct" > > (*/2 # n) | 5729082486784839 > 147 > . > > Thus, I am puzzled... > > Thanks! > Ruda > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm