• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

4.27.1 Special purpose integer arithmetic
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Arithmetic
          • Special purpose integer arithmetic
            • between/3
            • succ/2
            • plus/3
            • divmod/4
            • nth_integer_root_and_remainder/4
    • Packages
Availability:built-in
nth_integer_root_and_remainder(+N, +I, -Root, -Remainder)
True when Root ** N + Remainder = I. N and I must be integers.125This predicate was suggested by Markus Triska. The final name and argument order is by Richard O'Keefe. The decision to include the remainder is by Jan Wielemaker. Including the remainder makes this predicate about twice as slow if Root is not exact. N must be one or more. If I is negative and N is odd, Root and Remainder are negative, i.e., the following holds for I < 0:
%   I < 0,
%   N mod 2 =\= 0,
    nth_integer_root_and_remainder(
        N, I, Root, Remainder),
    IPos is -I,
    nth_integer_root_and_remainder(
        N, IPos, RootPos, RemainderPos),
    Root =:= -RootPos,
    Remainder =:= -RemainderPos.

ClioPatria (version V3.1.1-51-ga0b30a5)