Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Add two negabinary integers

Jelly, 6 bytes ḅSbɗ-2 Try it online! Takes input and output as a pair of lists of digits. The Footer converts to and from. Jelly's generalised base conversion works for all integer bases, and...

posted 3y ago by caird coinheringaahing‭  ·  edited 3y ago by caird coinheringaahing‭

Answer
#3: Post edited by user avatar caird coinheringaahing‭ · 2021-07-07T22:52:18Z (over 3 years ago)
  • # [Jelly], 6 bytes
  • ḅSbɗ-2
  • [Try it online!][TIO-kqu2kus9]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqu2kus9]: https://tio.run/##y0rNyan8///hjtbgpJPTdY3@uxxuf7ij5/9/QwMw1FEwNAQxDAA "Jelly – Try It Online"
  • Takes input and output as a pair of lists of digits. The Footer converts to and from
  • # [Jelly], 6 bytes
  • ḅSbɗ-2
  • [Try it online!][TIO-kqu2o0v3]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqu2o0v3]: https://tio.run/##y0rNyan8///hjtbgpJPTdY3@uxxuf7ijRzPy//9oQx2DWB0FIGUIpQwhfAOoAJA2MIQywVBHwdAQxDCIBQA "Jelly – Try It Online"
  • Takes input and output as a pair of lists of digits. The Footer converts to and from.
  • Jelly's generalised base conversion works for all integer bases, and allows converting from complex bases.
  • ## How it works
  • ḅSbɗ-2 - Main link. Takes [a, b] on the left
  • ɗ-2 - Last 3 links as a dyad f([a,b], -2):
  • ḅ - Convert from base -2
  • S - Sum
  • b - Convert to base -2
#2: Post edited by user avatar caird coinheringaahing‭ · 2021-07-07T22:46:48Z (over 3 years ago)
  • # [Jelly], 6 bytes
  • ḅSbɗ-2
  • [Try it online!][TIO-kqu2kus9]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqu2kus9]: https://tio.run/##y0rNyan8///hjtbgpJPTdY3@uxxuf7ij5/9/QwMw1FEwNAQxDAA "Jelly – Try It Online"
  • # [Jelly], 6 bytes
  • ḅSbɗ-2
  • [Try it online!][TIO-kqu2kus9]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqu2kus9]: https://tio.run/##y0rNyan8///hjtbgpJPTdY3@uxxuf7ij5/9/QwMw1FEwNAQxDAA "Jelly – Try It Online"
  • Takes input and output as a pair of lists of digits. The Footer converts to and from
#1: Initial revision by user avatar caird coinheringaahing‭ · 2021-07-07T22:46:04Z (over 3 years ago)
# [Jelly], 6 bytes

    ḅSbɗ-2

[Try it online!][TIO-kqu2kus9]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kqu2kus9]: https://tio.run/##y0rNyan8///hjtbgpJPTdY3@uxxuf7ij5/9/QwMw1FEwNAQxDAA "Jelly – Try It Online"