martpet
martpetβ€’13mo ago

Deno KV: subtract with `sum` operation?

If I do .sum([key], 1n) the value is increased by 1. How can I decrease it? I tried .sum([key], -1n) but it doesn't work.
3 Replies
martpet
martpetβ€’13mo ago
Thank you so much. I don't know what 0xffffffffffffffffn is but it works πŸ™‚
MrKleeblatt
MrKleeblattβ€’13mo ago
This magic number represents negative one in a 64bit binary number system. There are good videos on youtube explaining that: https://www.youtube.com/watch?v=sJXTo3EZoxM or https://www.youtube.com/watch?v=dHjPgLZzZ24
The Organic Chemistry Tutor
YouTube
Binary Addition and Subtraction With Negative Numbers, 2's Compleme...
This video tutorial explains how to perform binary addition and subtraction with negative numbers. It also explains how to express numbers in binary form using two methods - the 2's complement and the signed magnitude method. My E-Book: https://amzn.to/3B9c08z Video Playlists: https://www.video-tutor.net Homework Help: https://bit.ly/Find-A...
Low Level Learning
YouTube
Negative Binary Numbers Can't Exist
In algebra, doing math with negative numbers is simple. By putting a negative sign in front of a number, the number is known to have negative value. But how does this work with binary numbers? Binary numbers cannot be "negative". By saying that a number is either unsigned or signed, the most significant bit of the number will denote if the num...