[Jprogramming] Puzzling result

Erling Hellenäs erling at erlinghellenas.se
Wed Sep 13 12:41:57 UTC 2017


In Nial 14^2 is integer, so Nial handles our little problem nicely. The 
mod operator accepts no floating point arguments.

      5729082486784839 mod (14 power 2)
147
      5729082486784839. mod (14 power 2.)
?A
      (14 power 2)
196
      isinteger (14 power 2)
l
      (14 power 2.)
196.
      isreal (14 power 2.)
l

In F# you have to convert integer arguments to floating point: "The 
exponentiation operator works only with floating-point types."

Cheers,

Erling

Den 2017-09-13 kl. 00:57, skrev Raul Miller:
>     R2=: |
>     R1=: (] - [ * [: <.!.0 ] % [)"0
>     R0=: (|&x:)"0
>
>     (14^2) R1 5729082486784839
> 147
>     (14^2) R2 5729082486784839
> 0
>
>     X=: (0.1-0.1)+i.1000
>     Y=: 5729082486784839+i:1000
>
>     datatype X
> floating
>
>     +/,X (R0/ ~: R2/) Y
> 1845046
>     +/,X (R0/ ~: R1/) Y
> 0
>
> Good question.
>
> Thanks,
>



More information about the Programming mailing list