Discussion:
std::ratio binary prefixes ?
VinceRev
2013-04-01 02:40:03 UTC
Permalink
With the upcoming normalization of a filesystem library for C++14, I think
that it could be useful to have the standard binary prefixes defined by IEC
60027-2 A.2 and ISO/IEC 80000 as a part of std::ratio.
Currently we have all the decimal prefixes from yocto to yotta, and my
suggestion would be to add :

std::kibi = std::ratio<1024, 1>
std::mebi = std::ratio<1048576, 1>
std::gibi = std::ratio<1073741824, 1>
std::tebi = std::ratio<1099511627776, 1>
std::pebi = std::ratio<1125899906842624, 1>
std::exbi = std::ratio<1152921504606846976, 1>
std::zebi = std::ratio<1180591620717411303424, 1>, if std::intmax_t can
represent the numerator
std::yobi = std::ratio<1208925819614629174706176, 1>, if std::intmax_t can
represent the numerator

What is your opinion about this ?
Thanks.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
Bb Hh
2013-04-06 18:53:59 UTC
Permalink
Sounds reasonable.
Post by VinceRev
With the upcoming normalization of a filesystem library for C++14, I think
that it could be useful to have the standard binary prefixes defined by IEC
60027-2 A.2 and ISO/IEC 80000 as a part of std::ratio.
Currently we have all the decimal prefixes from yocto to yotta, and my
std::kibi = std::ratio<1024, 1>
std::mebi = std::ratio<1048576, 1>
std::gibi = std::ratio<1073741824, 1>
std::tebi = std::ratio<1099511627776, 1>
std::pebi = std::ratio<1125899906842624, 1>
std::exbi = std::ratio<1152921504606846976, 1>
std::zebi = std::ratio<1180591620717411303424, 1>, if std::intmax_t can
represent the numerator
std::yobi = std::ratio<1208925819614629174706176, 1>, if std::intmax_t can
represent the numerator
What is your opinion about this ?
Thanks.
--
---
You received this message because you are subscribed to the Google Groups
"ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at
http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
3***@verizon.net
2013-04-08 20:30:27 UTC
Permalink
We did this in libstdc++ under as std::tr2::ratio in <tr2/ratio>.
Obviously we like it ;-).
Post by VinceRev
With the upcoming normalization of a filesystem library for C++14, I think
that it could be useful to have the standard binary prefixes defined by IEC
60027-2 A.2 and ISO/IEC 80000 as a part of std::ratio.
Currently we have all the decimal prefixes from yocto to yotta, and my
std::kibi = std::ratio<1024, 1>
std::mebi = std::ratio<1048576, 1>
std::gibi = std::ratio<1073741824, 1>
std::tebi = std::ratio<1099511627776, 1>
std::pebi = std::ratio<1125899906842624, 1>
std::exbi = std::ratio<1152921504606846976, 1>
std::zebi = std::ratio<1180591620717411303424, 1>, if std::intmax_t can
represent the numerator
std::yobi = std::ratio<1208925819614629174706176, 1>, if std::intmax_t can
represent the numerator
What is your opinion about this ?
Thanks.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
Loading...