{"id":18847618,"url":"https://github.com/everythingfunctional/quaff","last_synced_at":"2026-01-27T01:01:01.977Z","repository":{"id":41379232,"uuid":"476482128","full_name":"everythingfunctional/quaff","owner":"everythingfunctional","description":"Quantities For Fortran","archived":false,"fork":false,"pushed_at":"2022-10-11T22:12:11.000Z","size":1459,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-23T00:32:57.822Z","etag":null,"topics":["fortran","units-of-measure"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/everythingfunctional.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-31T21:20:26.000Z","updated_at":"2023-06-28T02:36:56.000Z","dependencies_parsed_at":"2023-01-19T19:40:14.776Z","dependency_job_id":null,"html_url":"https://github.com/everythingfunctional/quaff","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/everythingfunctional/quaff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everythingfunctional%2Fquaff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everythingfunctional%2Fquaff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everythingfunctional%2Fquaff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everythingfunctional%2Fquaff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/everythingfunctional","download_url":"https://codeload.github.com/everythingfunctional/quaff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everythingfunctional%2Fquaff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28794529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: 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":["fortran","units-of-measure"],"created_at":"2024-11-08T03:08:52.924Z","updated_at":"2026-01-27T01:01:01.948Z","avatar_url":"https://github.com/everythingfunctional.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"quaff\n=====\n\n[![pipeline status](https://gitlab.com/everythingfunctional/quaff/badges/main/pipeline.svg)](https://gitlab.com/everythingfunctional/quaff/commits/main)\n\nQuantities for Fortran. Make math with units more convenient.\n\nThis library provides all the functionality necessary to *almost* treat\nquantities with units associated with them as though they were just intrinsic\nreal values. However, since a quantity has it's own unique type, you get some\ncompile time safety that you don't mix them up in your argument lists, and you\ndon't have to worry about doing unit conversions or remembering what units you've\nstored things in when you start doing math with them.\n\nThe following gives a basic overview of how you use quaff,\nbut for more detailed information consult the [developer documentation](https://everythingfunctional.gitlab.io/quaff).\n\nTurning a number into a quantity is as easy as defining what units that number\nis in, like `1.0d0.unit.METERS`. And, if you need the number back out, just say\nwhat units you want the value in like `time.in.SECONDS`.\n\nOnce you've got your values in quantities, you can do math with them, and not\nhave to worry about doing unit conversions. All the possible combinations are\nappropriately defined. So, assuming these have the types you'd expect, this will\njust work: `speed = length / time`.\n\nA variety of `to_string` functions are also provided, so converting to strings\nin a variety of formats is easy too. `to_string` will use SI units, and\n`to_string_in` allows you to specify the units you'd like. There are also\n[quaff_gnuplot_units](https://gitlab.com/everythingfunctional/quaff_gnuplot_units)\nand [quaff_latex_units](https://gitlab.com/everythingfunctional/quaff_latex_units)\nprojects for units that provide formats for those.\nYou can also specify the number of significant digits you'd like for any of them.\n\nThere are `parse_quantity` functions provided for getting a quantity from its\nstring representation as well. These routines return a `fallible_quantity`\ntype that may have an `error_list_t`, in case the string could not be properly interpreted.\n\nFinally, all the `assert_equals` functions are provided for working with the\n[Vegetables](https://gitlab.com/everythingfunctional/vegetables) unit testing\nframework, so you can use quantities in your tests as well.\n\nWhat If You Don't Have What I Need?\n-----------------------------------\n\n### New Units\n\nIf a unit you need isn't already defined, you can define your own by simply\ndefining the conversion factor and strings associated with it. Somewhere, you\njust need to have something like the following:\n\n```Fortran\ntype(length_simple_unit_t), parameter :: CENTIMETERS = \u0026\n        length_simple_unit_t( \u0026\n                conversion_factor = CENTIMETERS_PER_METER, \u0026\n                symbol = \"cm\")\n```\n\nNote, that you'll need to provide an array of possible units you'd like to use\nthat includes your custom units to any `parse_quantity` functions. Otherwise they\nwon't know about them. You can change the default output units for any quantity\nif you'd like as well, since they aren't defined with the `parameter` attribute.\nYou could do this in some initialization routine in your code.\n\n### New Quantities\n\nA script is provided that will generate a new quantity for you at\n`tools/generate-new-quantity.sh`. It just needs to know the name of the quantity\nin lower and upper case, the name of its internal units in lower and upper case,\nand the symbol, and it will use the templates to generate the new quantity module,\nit's tests, and the assertions. You'll just need to define any additional units\nyou'd like to use, and the interfaces for the `*` and `/` operators if you'd\nlike it to do the math correctly with other quantities.\n\nAs you can see, if something you need isn't provided, it's highly likely you'll\nbe able to extend the library without having to actually make any changes to the\nupstream code (although pull requests are greatly appreciated :)). See the\n[Contributing](CONTRIBUTING.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feverythingfunctional%2Fquaff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feverythingfunctional%2Fquaff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feverythingfunctional%2Fquaff/lists"}