{"id":15659774,"url":"https://github.com/inokinoki/softfpu-rs","last_synced_at":"2025-05-05T19:53:31.110Z","repository":{"id":53767733,"uuid":"341481480","full_name":"Inokinoki/softfpu-rs","owner":"Inokinoki","description":"A WIP Float32 soft FPU implementation","archived":false,"fork":false,"pushed_at":"2021-06-25T13:13:50.000Z","size":60,"stargazers_count":22,"open_issues_count":9,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T23:12:10.573Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inokinoki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"inokinoki"}},"created_at":"2021-02-23T08:26:08.000Z","updated_at":"2025-02-07T17:34:38.000Z","dependencies_parsed_at":"2022-09-10T14:21:05.400Z","dependency_job_id":null,"html_url":"https://github.com/Inokinoki/softfpu-rs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inokinoki%2Fsoftfpu-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inokinoki%2Fsoftfpu-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inokinoki%2Fsoftfpu-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inokinoki%2Fsoftfpu-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inokinoki","download_url":"https://codeload.github.com/Inokinoki/softfpu-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252567129,"owners_count":21769175,"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","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":[],"created_at":"2024-10-03T13:19:00.705Z","updated_at":"2025-05-05T19:53:31.081Z","avatar_url":"https://github.com/Inokinoki.png","language":"Rust","funding_links":["https://github.com/sponsors/inokinoki"],"categories":[],"sub_categories":[],"readme":"# Software-emulated FPU in Rust\n\nUse 32-bit unsigned integer to represent Float32 in [IEEE-754](https://en.wikipedia.org/wiki/IEEE_754) and do float calculation.\n\n# Usage\n\nThere is an operator-trait-based API:\n\n## Add\n\n```rust\nlet v0_1 = soft_f32::F32::from_u32(0x3DCCCCCD);  // 0.1\nlet v0_2 = soft_f32::F32::from_u32(0x3E4CCCCD);  // 0.2\n\nlet v0_3 = v0_1 + v0_2; // 0.1 + 0.2\n\nassert_eq!(v0_3.value(), 0x3E99999A);\n```\n\nand a procedure-style API:\n\n```rust\nlet v0_1 = 0x3DCCCCCD;  // 0.1\nlet v0_2 = 0x3E4CCCCD;  // 0.2\n\nlet v0_3 = soft_f32::f32_add(v0_1, v0_2); // 0.1 + 0.2\n\nassert_eq!(v0_3, 0x3E99999A);\n```\n\n## Subtract\n\n```rust\nlet v0_1 = soft_f32::F32::from_u32(0x3DCCCCCD);  // 0.1\nlet v0_2 = soft_f32::F32::from_u32(0x3E4CCCCD);  // 0.2\n\nlet v0_1_result = v0_2 - v0_1;  // 0.2 - 0.1\n\nassert_eq!(v0_1_result.value(), 0x3DCCCCCD);\n```\n\n## Multiply\n\n```rust\nlet v0_1 = soft_f32::F32::from_u32(0x3DCCCCCD);  // 0.1\nlet v0_2 = soft_f32::F32::from_u32(0x3E4CCCCD);  // 0.2\n\nlet v0_02 = v0_2 * v0_1;    // 0.2 * 0.1\n\nassert_eq!(v0_02.value(), 0x3CA3D70B);\n```\n\n## Division\n\n```rust\nlet v0_1 = soft_f32::F32::from_u32(0x3DCCCCCD);  // 0.1\nlet v0_2 = soft_f32::F32::from_u32(0x3E4CCCCD);  // 0.2\n\nlet v0_5 = v0_1 / v0_2; // 0.1 / 0.2\n\nassert_eq!(v0_5.value(), 0x3F000000);\n```\n\n## Squared-root\n\n```rust\nlet v0_01 = crate::soft_f32::F32::from_u32(0x3C23D70A); // 0.01\n\nlet v0_1 = v0_01.sqrt();    // sqrt(0.01)\n\nassert_eq!(v0_1.value(), 0x3DCCCCCD);\n```\n\n## Comparison\n\n```rust\nlet v0_1 = 0x3DCCCCCD;  // 0.1\nlet v0_2 = 0x3E4CCCCD;  // 0.2\n\nassert_eq!(v0_1 \u003c v0_2, true);\nassert_eq!(v0_1 \u003c= v0_2, true);\nassert_eq!(v0_1 \u003c v0_1, false);\nassert_eq!(v0_1 \u003c= v0_1, true);\nassert_eq!(v0_1 == v0_1, true);\nassert_eq!(v0_1 != v0_1, false);\n```\n\n# Development\n\nCurrently only aiming at implementing Float32.\n\n## TODOs\n\n- [ ] Publish on crate.io\n- [ ] Float32 Log2 (v0.2.X)\n- [ ] Float32 Exp (v0.2.X)\n- [ ] Float32 Sin, Cos (v0.2.X)\n- [ ] Float80 (v0.3.X)\n\n# Conclusion\n\nIt is a by-product of one of my projects to bring a float number subsystem into a PL that is not capable of handling float numbers. And finally, implement a more complex system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finokinoki%2Fsoftfpu-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finokinoki%2Fsoftfpu-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finokinoki%2Fsoftfpu-rs/lists"}