{"id":23023636,"url":"https://github.com/lighterowl/libpascalreal","last_synced_at":"2025-07-28T17:07:19.396Z","repository":{"id":70909304,"uuid":"586072006","full_name":"lighterowl/libpascalreal","owner":"lighterowl","description":"C APIs for using Turbo Pascal 48-bit floating-point numbers","archived":false,"fork":false,"pushed_at":"2023-01-07T12:19:29.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T19:38:25.576Z","etag":null,"topics":["c99","floating-point","retro-computing","turbo-pascal"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lighterowl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-01-06T21:37:57.000Z","updated_at":"2024-12-03T16:08:41.000Z","dependencies_parsed_at":"2023-03-17T12:00:33.060Z","dependency_job_id":null,"html_url":"https://github.com/lighterowl/libpascalreal","commit_stats":null,"previous_names":["lighterowl/libpascalreal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lighterowl/libpascalreal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lighterowl%2Flibpascalreal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lighterowl%2Flibpascalreal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lighterowl%2Flibpascalreal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lighterowl%2Flibpascalreal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lighterowl","download_url":"https://codeload.github.com/lighterowl/libpascalreal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lighterowl%2Flibpascalreal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267552097,"owners_count":24106000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c99","floating-point","retro-computing","turbo-pascal"],"created_at":"2024-12-15T13:14:30.308Z","updated_at":"2025-07-28T17:07:19.375Z","avatar_url":"https://github.com/lighterowl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `libpascalreal` - C APIs for using Turbo Pascal 48-bit floating-point numbers\n\nThis is a (very) small library meant to provide interfaces for converting Turbo\nPascal `real` into C `double` and back.\n\nInformation about this format is scarce, and it appears to never have been\nofficially documented, so this implementation (like any other) cannot be\nreliably treated as a reference one.\n\n# Compilation\n\nYou're encouraged to integrate this library directly into your project. The only\nthing that's needed is a C99 compiler with a math library.\n\n# Known issues / caveats\n\n* The library was not tested with a compiler or platform that doesn't use the\n  double-precision IEEE 754 floating-point format for representing the `double`\n  type.\n* Denormals, NaNs and infinities are converted to negative zero.\n* Numbers too large to be expressed as a `real` are converted to the maximum\n  legal value.\n* Similarly, numbers too small are converted to zero.\n\n# The format\n\n8-bit exponent with an exponent offset of 129, 39-bit mantissa and a sign bit.\n\nAccording to _Delphi in a Nutshell_ by Ray Lischner released in March 2000, this\ntype is (was?) supported by Delphi as well under the name `Real48`.\n\nAdditionally, it straight out states that\n\n\u003e It cannot store denormalized values, infinity, or not-a-number. If the\n\u003e exponent is zero, the number is zero.\n\n[(source)](https://www.oreilly.com/library/view/delphi-in-a/1565926595/re260.html)\n\n## Memory layout\n\n```\n 0        1        2        3        4        5        \n 76543210 76543210 76543210 76543210 76543210 76543210 \n+--------+--------+--------+--------+--------+--------+\n|EEEEEEEE|MMMMMMMM|MMMMMMMM|MMMMMMMM|MMMMMMMM|SMMMMMMM|\n+--------+--------+--------+--------+--------+--------+\n```\n\n## Real-world usage\n\nAccording to [Modding Wiki](https://moddingwiki.shikadi.net/wiki/Turbo_Pascal_Real),\nthis binary format is used by save game files by some games written in Turbo\nPascal.\n\nIt is also used in a Polish industrial automation protocol called GAZ-MODEM\n(later renamed GAZ-MODEM 1), standardised by PGNiG in ZN-G-4007:1995 Appendix A.\n\n# Legal\n\nThe licence of the library itself is available in `LICENCE.BSD`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flighterowl%2Flibpascalreal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flighterowl%2Flibpascalreal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flighterowl%2Flibpascalreal/lists"}