Code Monkey home page Code Monkey logo

Dual Balanced Ternary Calculator

explanation

"Dual Balanced Ternary" is an extend version of "Balanced Ternary" for 2d plane. It uses digits from 1 to 9 to represent each number, and & for ..

Instead of 1 0 -1 in Balanced Ternary, Dual Balanced Ternary uses digits like this:

  6  1  8
  7  5  3
  2  9  4

Usage

npm install --save dual-balanced-ternary

+ represents plus, so do -, \*, /, \\, %.
@ will return the integral part of a given number.

ops = require 'dual-balanced-ternary'
ops.add '1&', '1&'
# => '19&'
ops.add '1&', '1&'
# => '19&'
ops.subtract '345&', '353&'
# => '47&'
ops..multiply '4&4', '3&47'
# => '74&968'
ops.divide '74&968', '4&4'
# => '3&47'
ops.aliquot '74&968', '4&4'
# => '3&'
ops.modular '74&968', '4&4'
# => '7&368'
ops.integer '74&968'
# => '74&'

ternary.decimal_to_ternary -9.296296296296298, 37.2962962962963
# returns '3453&456544656564654...'
ternary.ternary_to_decimal '3453&456'
# returns [ -9.296296296296298, 37.2962962962963 ]

License

MIT

Dual Balanced Ternary's Projects

luoshu-grids icon luoshu-grids

A demo of digital map of luoshu in dual-balanced-ternary

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.