-
Notifications
You must be signed in to change notification settings - Fork 103
feat!: add number concepts #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
JohelEGP
wants to merge
16
commits into
mpusz:master
Choose a base branch
from
JohelEGP:number_concepts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bab7acf
feat!: add number concepts
JohelEGP 2b64931
docs(ref): add reference documentations
JohelEGP 3661010
docs: apply feedback and fixes
JohelEGP 8e5d84d
refactor: apply feedback
JohelEGP fa7c0b3
fix: add missing `#include <chrono>`
JohelEGP c5ac0e0
feat: add concept `common_number_with`
JohelEGP 008175d
docs(ref): add concept `common_number_with`
JohelEGP a30d972
refactor: disable branch `__cpp_lib_chrono`
JohelEGP b6027be
refactor!: rename to `vector_scalar`
JohelEGP 4a52e64
docs(ref): rename to `vector_scalar`
JohelEGP 5117eeb
fix: require the common type to be a number
JohelEGP 582cbba
docs(ref): add missing definition of `common_number_with`
JohelEGP e44a677
refactor!: rename to `enable_number`
JohelEGP 2cb7b2d
docs(ref): rename to `enable_number`
JohelEGP 3ce672d
test: disable LA unit test
JohelEGP 48b931f
fix(example): make `ranged_representation` model `vector_space`
JohelEGP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
cmake/.cmake-format-additional_commands-jegp.cmake_modules.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
parse: | ||
additional_commands: | ||
_jegp_common_yaml_anchors: | ||
kwargs: | ||
PUBLIC_INTERFACE_PRIVATE: &public_interface_private | ||
kwargs: | ||
PUBLIC: + | ||
INTERFACE: + | ||
PRIVATE: + | ||
jegp_add_standardese_sources: | ||
pargs: | ||
nargs: 1 | ||
flags: | ||
- EXCLUDE_PDF_FROM_MAIN | ||
- EXCLUDE_HTML_FROM_MAIN | ||
- EXCLUDE_FROM_ALL | ||
kwargs: | ||
LIBRARIES: + | ||
APPENDICES: + | ||
EXTENSIONS: + | ||
CHECKED: 1 | ||
PDF_PATH: 1 | ||
HTML_PATH: 1 | ||
jegp_add_module: | ||
pargs: &jegp_add_module_pargs | ||
nargs: 1 | ||
flags: | ||
- IMPORTABLE_HEADER | ||
kwargs: | ||
SOURCES: + | ||
COMPILE_OPTIONS: *public_interface_private | ||
LINK_LIBRARIES: *public_interface_private | ||
jegp_cpp_module: | ||
pargs: *jegp_add_module_pargs | ||
jegp_target_link_header_units: | ||
pargs: | ||
nargs: 1+ | ||
jegp_add_headers_test: | ||
pargs: | ||
nargs: 1+ | ||
kwargs: | ||
PRIVATE_REGEXES: + | ||
jegp_add_test: | ||
pargs: | ||
nargs: 1+ | ||
flags: | ||
- COMPILE_ONLY | ||
kwargs: | ||
TYPE: 1 | ||
SOURCES: + | ||
COMPILE_OPTIONS: + | ||
LINK_LIBRARIES: + | ||
jegp_add_build_error: | ||
pargs: | ||
nargs: 1+ | ||
kwargs: | ||
AS: 1 | ||
TYPE: 1 | ||
SOURCE: 1 | ||
COMPILE_OPTIONS: + | ||
LINK_LIBRARIES: + |
JohelEGP marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2018 Mateusz Pusz | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
cmake_minimum_required(VERSION 3.19.0) | ||
project(mp-units-reference-documentations LANGUAGES NONE) | ||
|
||
include(JEGPAddStandardeseSources) | ||
|
||
set(pdf_title "mp-units - A Physical Quantities and Units library for C++") | ||
set(page_license "MIT License") | ||
set(first_library_chapter "nums") | ||
set(last_library_chapter "qties") | ||
# set(pdf_creator "") # Defaults to "the `user.name` of Git's configuration". | ||
# set(document_number [[\unspec]]) | ||
# set(previous_document_number [[\unspec]]) | ||
set(cover_title "mp-units Library Reference Documentations") | ||
set(reply_to "\\href{${PROJECT_HOMEPAGE_URL}/discussions}{Discussions}, \\href{${PROJECT_HOMEPAGE_URL}/issues}{issues}") | ||
jegp_add_standardese_sources( | ||
mp-units-reference-documentations | ||
LIBRARIES intro numbers;quantities | ||
EXTENSIONS macros_extensions | ||
# CHECKED TRUE | ||
PDF_PATH "mp_units.pdf" | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
%!TEX root = std.tex | ||
|
||
|
||
\rSec0[scope]{Scope} | ||
|
||
\pnum | ||
\indextext{scope|(}% | ||
This document describes the contents of the \defn{mp-units library}. | ||
\indextext{scope|)} | ||
|
||
|
||
\rSec0[refs]{References} | ||
|
||
\pnum | ||
\indextext{references|(}% | ||
The following documents are referred to in the text | ||
in such a way that some or all of their content | ||
constitutes requirements of this document. | ||
For dated references, only the edition cited applies. | ||
For undated references, | ||
the latest edition of the referenced document | ||
(including any amendments) applies. | ||
\begin{itemize} | ||
\item | ||
The \Cpp{} Standards Committee. | ||
N4892: \doccite{Working Draft, Standard for Programming Language \Cpp{}}. | ||
Edited by Thomas K\"{o}ppe. | ||
Available from: \url{https://wg21.link/N4892} | ||
\item | ||
The \Cpp{} Standards Committee. | ||
P1841R1: \doccite{Wording for Individually Specializable Numeric Traits}. | ||
Edited by Walter E. Brown. | ||
Available from: \url{https://wg21.link/P1841R1} | ||
\item | ||
The \Cpp{} Standards Committee. | ||
SD-8: \doccite{Standard Library Compatibility}. | ||
Edited by Bryce Lelbach. | ||
Available from: \url{https://wg21.link/SD8} | ||
\item | ||
ISO 80000-2:2019, \doccite{Quantities and units --- Part 2: Mathematics} | ||
\item | ||
IEC 60050 (all parts), | ||
\doccite{International Electrotechnical Vocabulary (IEV)} | ||
\item | ||
IEC 60050-102:2007/AMD3:2021, | ||
\doccite{Amendment 3 --- International Electrotechnical Vocabulary (IEV) --- | ||
Part 102: Mathematics --- General concepts and linear algebra} | ||
\item | ||
IEC 60050-112:2010/AMD2:2020, | ||
\doccite{Amendment 2 --- International Electrotechnical Vocabulary (IEV) --- | ||
Part 112: Quantities and units} | ||
\end{itemize} | ||
|
||
\pnum | ||
N4892 is hereinafter called \defn{\Cpp{}}. | ||
|
||
\pnum | ||
IEC 60050 is hereinafter called \defn{IEV}. | ||
\indextext{references|)} | ||
|
||
|
||
\rSec0[defs]{Terms and definitions} | ||
|
||
\pnum | ||
\indextext{definitions|(}% | ||
For the purposes of this document, | ||
the terms and definitions given in | ||
\Cpp{}, | ||
IEC 60050-102:2007/AMD3:2021, | ||
IEC 60050-112:2010/AMD2:2020, | ||
the terms, definitions, and symbols given in | ||
ISO 80000-2:2019, | ||
and the following apply. | ||
|
||
\pnum | ||
ISO and IEC maintain terminology databases | ||
for use in standardization | ||
at the following addresses: | ||
\begin{itemize} | ||
\item ISO Online browsing platform: available at \url{https://www.iso.org/obp} | ||
\item IEC Electropedia: available at \url{http://www.electropedia.org} | ||
\end{itemize} | ||
|
||
\pnum | ||
Terms that are used only in a small portion of this document | ||
are defined where they are used and italicized where they are defined. | ||
|
||
\indexdefn{modulo}% | ||
\definition{modulo}{def.mod} | ||
operation performed on a set for which a division\irefiev{102-01-21} and an addition\irefiev{102-01-11} are defined, | ||
the result of which, for elements $a$ and $b$ of the set, | ||
is the unique element $r$, if it exists in the set, | ||
such that $a = \lfloor a/b \rfloor b + r$ | ||
|
||
|
||
\rSec0[spec]{Specification} | ||
|
||
\rSec1[spec.ext]{External} | ||
|
||
\pnum | ||
The specification of the mp-units library subsumes | ||
\refcpp{description}, \refcpp{requirements}, \refcpp{concepts.equality}, and SD-8, | ||
all assumingly amended for the context of this library. | ||
\begin{note} | ||
This means that, non exhaustively, | ||
\begin{itemize} | ||
\item \tcode{::mp_units2} is a reserved namespace, and | ||
mpusz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
\item | ||
\tcode{std::vector<mp_units::\placeholdernc{type}>} | ||
JohelEGP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
is a program-defined specialization and a library-defined specialization | ||
from the point of view of \Cpp{} and this library, respectively. | ||
\end{itemize} | ||
\end{note} | ||
|
||
\pnum | ||
The mp-units library is not part of the \Cpp{} implementation. | ||
|
||
\rSec1[spec.cats]{Categories} | ||
|
||
\pnum | ||
Detailed specifications for each of the components in the library are in | ||
\ref{\firstlibchapter}--\ref{\lastlibchapter}, | ||
as shown in \tref{lib.cats}. | ||
|
||
\begin{floattable}{Library categories}{lib.cats} | ||
{ll} | ||
\topline | ||
\hdstyle{Clause} & \hdstyle{Category} \\ \capsep | ||
\ref{nums} & Numbers library \\ | ||
\ref{qties} & Quantities library \\ | ||
\end{floattable} | ||
|
||
\pnum | ||
The numbers library\iref{nums} | ||
describes components for dealing with numbers. | ||
|
||
\pnum | ||
The quantities library\iref{qties} | ||
describes components for dealing with quantities. | ||
|
||
\rSec1[headers]{Headers} | ||
|
||
\pnum | ||
The mp-units library provides the | ||
\defnx{mp-units library headers}{header!mp-units library}, | ||
shown in \tref{headers.mp.units}. | ||
|
||
\begin{multicolfloattable}{mp-units library headers}{headers.mp.units} | ||
{l} | ||
\tcode{<mp-units/numbers.h>} \\ | ||
\tcode{<mp-units/quantity.h>} \\ | ||
\end{multicolfloattable} | ||
|
||
\rSec1[spec.reqs]{Library-wide requirements} | ||
|
||
\rSec2[spec.res.names]{Reserved names} | ||
|
||
\pnum | ||
The mp-units library reserves macro names that start with | ||
\tcode{MP_UNITS\opt{\gterm{digit-sequence}}_}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
% \newcommand{\idxmdl}[1]{#1@\CodeStylex{#1}} | ||
\newcommand{\idxexposid}[1]{#1@\ExposStylex{#1}} | ||
|
||
\newcommand{\indexlibraryspec}[2]{\indexlibrarymisc{#1}{\idxcode{#2}}} | ||
|
||
\newcommand{\ExposStylex}[1]{\CodeStylex{\textit{#1}}} | ||
|
||
\newnoteenvironment{source}{Source}{end source} | ||
|
||
\newcommand{\dvalue}{\Fundesc{Default value}} | ||
|
||
%% Inline non-parenthesized C++ reference | ||
\newcommand{\refcpp}[1]{\href{https://wg21.link/#1}{\Cpp{} [#1]}} | ||
\newcommand{\irefcpp}[1]{\nolinebreak[3] (\refcpp{#1})} | ||
\newcommand{\refcppx}[2]{\href{https://wg21.link/#1\##2}{\Cpp{} [#1]}} | ||
\newcommand{\irefcppx}[2]{\nolinebreak[3] (\refcppx{#1}{#2})} | ||
|
||
%% Inline IEV reference | ||
\newcommand{\refiev}[1]{\href{https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=#1}{IEV #1}} | ||
\newcommand{\irefiev}[1]{\nolinebreak[3] (\refiev{#1})} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.