{"id":19337286,"url":"https://github.com/infobip/redis-fpn","last_synced_at":"2026-03-05T09:01:42.303Z","repository":{"id":94549203,"uuid":"146584669","full_name":"infobip/redis-fpn","owner":"infobip","description":"Redis module for Fixed Point Number data type","archived":false,"fork":false,"pushed_at":"2018-08-29T11:18:43.000Z","size":38,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-18T15:52:47.627Z","etag":null,"topics":["c","redis","redis-module"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infobip.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-29T10:35:57.000Z","updated_at":"2024-10-20T16:54:06.000Z","dependencies_parsed_at":"2023-07-02T04:00:18.631Z","dependency_job_id":null,"html_url":"https://github.com/infobip/redis-fpn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/infobip/redis-fpn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Fredis-fpn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Fredis-fpn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Fredis-fpn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Fredis-fpn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infobip","download_url":"https://codeload.github.com/infobip/redis-fpn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Fredis-fpn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30117479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T08:19:04.902Z","status":"ssl_error","status_checked_at":"2026-03-05T08:17:37.148Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","redis","redis-module"],"created_at":"2024-11-10T03:13:58.159Z","updated_at":"2026-03-05T09:01:42.246Z","avatar_url":"https://github.com/infobip.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Overview\n\n**FPN** module - it is a **F**ixed **P**oint **N**umber module for Redis 4, which adds decimal data type and different commands for such type.\n\n\u003e **IMPORTANT:** This module works only from 4 Redis version...because modules API become available only in 4 version.\n\n## Contents\n\n- [How to load](#how-to-load)\n- [How to use](#how-to-use)\n- [Restrictions](#restrictions)\n- [Development](#development)\n  - [Prerequisites](#prerequisites)\n  - [Building](#building)\n- [Built With](#built-with)\n- [Changelog](#changelog)\n- [Contributing](#contributing)\n- [Versioning](#versioning)\n- [Authors](#authors)\n- [License](#license)\n\n## How to load\n\nJust run the Redis server like this:\n\n```bash\n$\u003e redis-server --loadmodule /\u003cpath_to_module\u003e/fpn_module.so\n```\n\nYou also can load the module using the following `redis.conf` configuration directive:\n\n```redis\nloadmodule /\u003cpath_to_module\u003e/fpn_module.so\n```\n\nIt is also possible to load a module at runtime using the following command:\n\n```redis\nMODULE LOAD /\u003cpath_to_module\u003e/fpn_module.so\n```\n\nIn order to list all loaded modules, use:\n\n```redis\nMODULE LIST\n```\n\nFinally, you can unload (and later reload if you wish) a module using the following command:\n\n```redis\nMODULE UNLOAD fpn_module\n```\n\n## How to use\n\nAvailable commands:\n\n* `FPN.SET` **key** **value** [**scale**] - sets a new **value** for **key** with specified **scale** (optional, default is 2). It returns previous value or **0**.\n\n* `FPN.GET` **key** [**scale**] - gets a value by its **key** with specified **scale** (optional). If now value - it returns `nil` value.\n\n* `FPN.ADD` **key** **value** [**scale**] - adds a **value** to the specified **key**, the result of the command could be converted to specific **scale** (optional) or it will be the max scale (ex: 12.34 + 5.678 = 18.018)\n\n* `FPN.SUBTRACT` **key** **value** [**scale**] - subtracts a **value** from the specified **key**, the result of the command could be converted to specific **scale** (optional) or it will be the max scale (ex: 1.234 - 5.6 = -4.366)\n\n* `FPN.MULTIPLY` **key** **value** [**scale**] - multiply the specified **key** by a **value**, the result of the command may be converted to specific **scale** (optional) or it will be the max scale\n\nExample:\n\n```bash\n$\u003e redis-cli FPN.GET popa.key\n\"\"\n$\u003e redis-cli FPN.SET popa.key 1.23\n\"0.00\"\n$\u003e redis-cli FPN.ADD popa.key 3.567\n\"4.797\"\n$\u003e redis-cli FPN.GET popa.key\n\"4.797\"\n$\u003e redis-cli FPN.GET popa.key 2\n\"4.80\"\n$\u003e redis-cli FPN.GET popa.key 0\n\"5\"\n$\u003e redis-cli FPN.SUBTRACT popa.key 3\n\"1.797\"\n$\u003e redis-cli FPN.MULTIPLY popa.key 2.36\n\"4.24092\"\n$\u003e redis-cli FPN.MULTIPLY popa.key 2 1\n\"8.5\"\n```\n\n## Restrictions\n\nThe value in this lib is present as a structure:\n\n```c\n/**\n * The structure represents decimal number.\n */\ntypedef struct {\n  int128_t value; // 128bit integer for storing a value\n  uint8_t scale;  // number of digits in mantissa\n} Decimal;\n```\n\n`int128_t` has 39 digits at all (plus a sign), but we use only **38** digits, so the maximum value, which we could store in that structure, is **99_999_999_999_999_999_999_999_999_999_999_999_999** and the lowest is **-99_999_999_999_999_999_999_999_999_999_999_999_999**. The lib also validates your input values, like this:\n\n```bash\n$\u003e redis-cli FPN.SET popa.key 1234567891234567890.0123456789123456789\n\"0.00\"\n$\u003e redis-cli FPN.GET popa.key\n\"1234567891234567890.0123456789123456789\"\n$\u003e redis-cli FPN.GET popa.key 19\n\"1234567891234567890.0123456789123456789\"\n$\u003e redis-cli FPN.GET popa.key 20\n(error) value must be greater or equal than -99_999_999_999_999_999_999_999_999_999_999_999_999 and lower or equal than 99_999_999_999_999_999_999_999_999_999_999_999_999\n```\n\nThe error above shows us, what it couldn't conver value `1234567891234567890.0123456789123456789` to `1234567891234567890.01234567891234567890` (we have set **20** as the scale parameter), because `12_345_678_912_345_678_900_123_456_789_123_456_789` is greater than `99_999_999_999_999_999_999_999_999_999_999_999_999` (we store the whole value as integer).\n\n## Development\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Prerequisites\n\nFor building the project you need only a [GCC](https://gcc.gnu.org).\n\n```bash\n$\u003e git https://github.com/infobip/redis-fpn\n$\u003e cd redis-fpn\n```\n\n### Building\n\nThe following `make` commands are useful:\n\n* **make build** - just for building the module for your machine.\n\n* **make container_build** - to build the module for `Debian` OS. It uses a Docker image with GCC inside it. After building, it compiles the module and puts the result into the target folder.\n\n* **make start_redis** - it builds `Debian` module and starts a Docker container with Redis 4 and loads this module.\n\n* **make integration_tests** - runs `Redis` with `FPN` module and executes integration tests against it.\n\n\u003e **IMPORTANT:** The last three commands required the Docker.\n\n## Built With\n\n* [C] - is a general-purpose, imperative computer programming language\n* [make] - is a build automation tool that automatically builds executable programs and libraries from source code\n\n## Changelog\n\nTo see what has changed in recent versions of Popout, see the [changelog](./CHANGELOG.md) file.\n\n## Contributing\n\nPlease read [contributing](./CONTRIBUTING.md) file for details on my code of conduct, and the process for submitting pull requests to me.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/infobip/redis-fpn/tags).\n\n## Authors\n\n* **[Artem Labazin](https://github.com/xxlabaza)** - creator and the main developer\n\n## License\n\nThis project is licensed under the Apache License 2.0 License - see the [license](./LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfobip%2Fredis-fpn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfobip%2Fredis-fpn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfobip%2Fredis-fpn/lists"}