Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
b04928d2c8 | |||
ceb8e6a113 | |||
900a7172bf | |||
fe0576a2d6 | |||
a5b84deca7 | |||
24056d53c5 | |||
d62f29abd1 | |||
f2eb99bab0 |
@ -847,35 +847,13 @@ if (is(Unqual!From == bool) && isNumeric!To && !is(Unqual!To == Unqual!From))
|
|||||||
assert(false.to!int == 0);
|
assert(false.to!int == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
deprecated("Use tanya.format.format instead")
|
||||||
* Converts $(D_PARAM From) to a $(D_PSYMBOL String).
|
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
* From = Source type.
|
|
||||||
* To = Target type.
|
|
||||||
* from = Source value.
|
|
||||||
*
|
|
||||||
* Returns: $(D_PARAM from) converted to $(D_PSYMBOL String).
|
|
||||||
*/
|
|
||||||
To to(To, From)(auto ref From from)
|
To to(To, From)(auto ref From from)
|
||||||
if (is(Unqual!To == String))
|
if (is(Unqual!To == String))
|
||||||
{
|
{
|
||||||
return format!"{}"(from);
|
return format!"{}"(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
@nogc nothrow pure @safe unittest
|
|
||||||
{
|
|
||||||
assert(true.to!String == "true");
|
|
||||||
assert(false.to!String == "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
@nogc nothrow pure @safe unittest
|
|
||||||
{
|
|
||||||
static assert(is(typeof((const String("true")).to!bool)));
|
|
||||||
static assert(is(typeof(false.to!(const String) == "false")));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a stringish range to an integral value.
|
* Converts a stringish range to an integral value.
|
||||||
*
|
*
|
||||||
|
@ -3,8 +3,32 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This package doesn't yet contain public symbols. Refer to
|
* This module provides $(D_PSYMBOL format) function that can convert different
|
||||||
* $(D_PSYMBOL tanya.conv) for basic formatting and conversion functionality.
|
* data types to a $(D_PSYMBOL String) according to a specified format.
|
||||||
|
*
|
||||||
|
* Format string is a $(D_PSYMBOL string) which can contain placeholders for
|
||||||
|
* arguments. Placeholder marker is `{}`, i.e. all occurrences of `{}` are
|
||||||
|
* replaced by the arguments passed to $(D_PSYMBOL format). An argument will be
|
||||||
|
* first converted to a string, then inserted into the resulting string instead
|
||||||
|
* of the corresponding placeholder. The number of the placeholders and
|
||||||
|
* arguments must match. The placeholders are replaced with the arguments in
|
||||||
|
* the order arguments are passed to $(D_PSYMBOL format).
|
||||||
|
*
|
||||||
|
* To escape `{` or `}`, use `{{` and `}}` respectively. `{{` will be outputted
|
||||||
|
* as a single `{`, `}}` - as a single `}`.
|
||||||
|
*
|
||||||
|
* If a custom data type (like $(D_KEYWORD struct) or $(D_KEYWORD class))
|
||||||
|
* defines a `stringify()` function that is callable without arguments and
|
||||||
|
* returns a $(D_PSYMBOL String), this function is used to produce a string
|
||||||
|
* representation for the value. String conversions for the most built-in
|
||||||
|
* data types a also available.
|
||||||
|
*
|
||||||
|
* $(D_KEYWORD char), $(D_KEYWORD wchar) and $(D_KEYWORD dchar) ranges are
|
||||||
|
* outputted as plain strings (without any delimiters between their elements).
|
||||||
|
*
|
||||||
|
* All floating point numbers are handled as $(D_KEYWORD double)s.
|
||||||
|
*
|
||||||
|
* More advanced formatting is currently not implemented.
|
||||||
*
|
*
|
||||||
* Copyright: Eugene Wissner 2017-2018.
|
* Copyright: Eugene Wissner 2017-2018.
|
||||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||||
@ -1233,7 +1257,7 @@ private uint128 raise2ToExp(double value) @nogc nothrow pure @safe
|
|||||||
|
|
||||||
private int indexMismatch(ulong low, ulong high) @nogc nothrow pure @safe
|
private int indexMismatch(ulong low, ulong high) @nogc nothrow pure @safe
|
||||||
{
|
{
|
||||||
enum ulong power10 = 10000000000U;
|
enum ulong power10 = 10000000000UL;
|
||||||
const ulong a = low / power10;
|
const ulong a = low / power10;
|
||||||
const ulong b = high / power10;
|
const ulong b = high / power10;
|
||||||
int index;
|
int index;
|
||||||
@ -1346,6 +1370,574 @@ do
|
|||||||
assert(e == 26);
|
assert(e == 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private char[] errolFixed(double value,
|
||||||
|
return ref char[512] buffer,
|
||||||
|
out int exponent) @nogc nothrow pure @safe
|
||||||
|
in
|
||||||
|
{
|
||||||
|
assert(value >= 16.0 && value <= 9.007199254740992e15);
|
||||||
|
}
|
||||||
|
do
|
||||||
|
{
|
||||||
|
auto decimal = cast(ulong) value;
|
||||||
|
auto n = cast(double) decimal;
|
||||||
|
|
||||||
|
double midpoint = value - n;
|
||||||
|
double leftBoundary = (previous(value) - n + midpoint) / 2.0;
|
||||||
|
double rightBoundary = (next(value) - n + midpoint) / 2.0;
|
||||||
|
|
||||||
|
char[21] intBuffer;
|
||||||
|
auto intSlice = integral2String(decimal, intBuffer);
|
||||||
|
copy(intSlice, buffer);
|
||||||
|
exponent = cast(int) intSlice.length;
|
||||||
|
|
||||||
|
size_t position = exponent;
|
||||||
|
if (midpoint != 0.0)
|
||||||
|
{
|
||||||
|
while (midpoint != 0.0)
|
||||||
|
{
|
||||||
|
leftBoundary *= 10.0;
|
||||||
|
const leftDigit = cast(ubyte) leftBoundary;
|
||||||
|
leftBoundary -= leftDigit;
|
||||||
|
|
||||||
|
midpoint *= 10.0;
|
||||||
|
const middleDigit = cast(ubyte) midpoint;
|
||||||
|
midpoint -= middleDigit;
|
||||||
|
|
||||||
|
rightBoundary *= 10.0;
|
||||||
|
const rightDigit = cast(ubyte) rightBoundary;
|
||||||
|
rightBoundary -= rightDigit;
|
||||||
|
|
||||||
|
buffer[position++] = cast(char) (middleDigit + '0');
|
||||||
|
|
||||||
|
if (rightDigit != leftDigit || position > 50)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (midpoint > 0.5
|
||||||
|
|| ((midpoint == 0.5) && (buffer[position - 1] & 0x1)))
|
||||||
|
{
|
||||||
|
++buffer[position - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (; buffer[position - 1] == '0'; --position)
|
||||||
|
{
|
||||||
|
buffer[position - 1] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer[0 .. position];
|
||||||
|
}
|
||||||
|
|
||||||
|
@nogc nothrow pure @safe unittest
|
||||||
|
{
|
||||||
|
char[512] num;
|
||||||
|
int exponent;
|
||||||
|
{
|
||||||
|
assert(errolFixed(16.0, num, exponent) == "16");
|
||||||
|
assert(exponent == 2);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assert(errolFixed(38234.1234, num, exponent) == "382341234");
|
||||||
|
assert(exponent == 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[] errol3(double value,
|
||||||
|
return ref char[512] buffer,
|
||||||
|
out int exponent) @nogc nothrow pure @safe
|
||||||
|
{
|
||||||
|
static struct Pathology
|
||||||
|
{
|
||||||
|
ulong representation;
|
||||||
|
string digits;
|
||||||
|
int exponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static immutable Pathology[432] pathologies = [
|
||||||
|
{ 0x001d243f646eaf51, "40526371999771488", -307 },
|
||||||
|
{ 0x002d243f646eaf51, "81052743999542975", -307 },
|
||||||
|
{ 0x00ab7aa3d73f6658, "1956574196882425", -304 },
|
||||||
|
{ 0x00bb7aa3d73f6658, "391314839376485", -304 },
|
||||||
|
{ 0x00cb7aa3d73f6658, "78262967875297", -304 },
|
||||||
|
{ 0x00f5d15b26b80e30, "4971131903427841", -303 },
|
||||||
|
{ 0x010b7aa3d73f6658, "1252207486004752", -302 },
|
||||||
|
{ 0x011b7aa3d73f6658, "2504414972009504", -302 },
|
||||||
|
{ 0x012b7aa3d73f6658, "5008829944019008", -302 },
|
||||||
|
{ 0x0180a0f3c55062c5, "19398723835545928", -300 },
|
||||||
|
{ 0x0180a0f3c55062c6, "1939872383554593", -300 },
|
||||||
|
{ 0x0190a0f3c55062c5, "38797447671091856", -300 },
|
||||||
|
{ 0x0190a0f3c55062c6, "3879744767109186", -300 },
|
||||||
|
{ 0x01f393b456eef178, "29232758945460627", -298 },
|
||||||
|
{ 0x03719f08ccdccfe5, "44144884605471774", -291 },
|
||||||
|
{ 0x037be9d5a60850b5, "69928982131052126", -291 },
|
||||||
|
{ 0x03dc25ba6a45de02, "45129663866844427", -289 },
|
||||||
|
{ 0x05798e3445512a6e, "27497183057384368", -281 },
|
||||||
|
{ 0x05798e3445512a6f, "2749718305738437", -281 },
|
||||||
|
{ 0x05898e3445512a6e, "54994366114768736", -281 },
|
||||||
|
{ 0x05898e3445512a6f, "5499436611476874", -281 },
|
||||||
|
{ 0x06afdadafcacdf85, "17970091719480621", -275 },
|
||||||
|
{ 0x06bfdadafcacdf85, "35940183438961242", -275 },
|
||||||
|
{ 0x06ceb7f2c53db97f, "69316187906522606", -275 },
|
||||||
|
{ 0x06cfdadafcacdf85, "71880366877922484", -275 },
|
||||||
|
{ 0x06e8b03fd6894b66, "22283747288943228", -274 },
|
||||||
|
{ 0x06f8b03fd6894b66, "44567494577886457", -274 },
|
||||||
|
{ 0x07bfe89cf1bd76ac, "23593494977819109", -270 },
|
||||||
|
{ 0x07c1707c02068785, "25789638850173173", -270 },
|
||||||
|
{ 0x07cfe89cf1bd76ac, "47186989955638217", -270 },
|
||||||
|
{ 0x08567a3c8dc4bc9c, "17018905290641991", -267 },
|
||||||
|
{ 0x08667a3c8dc4bc9c, "34037810581283983", -267 },
|
||||||
|
{ 0x089c25584881552a, "3409719593752201", -266 },
|
||||||
|
{ 0x08ac25584881552a, "6819439187504402", -266 },
|
||||||
|
{ 0x08dfa7ebe304ee3d, "6135911659254281", -265 },
|
||||||
|
{ 0x08dfa7ebe304ee3e, "61359116592542813", -265 },
|
||||||
|
{ 0x096822507db6a8fd, "23951010625355228", -262 },
|
||||||
|
{ 0x097822507db6a8fd, "47902021250710456", -262 },
|
||||||
|
{ 0x09e41934d77659be, "51061856989121905", -260 },
|
||||||
|
{ 0x0b8f3d82e9356287, "53263359599109627", -252 },
|
||||||
|
{ 0x0c27b35936d56e27, "4137829457097561", -249 },
|
||||||
|
{ 0x0c27b35936d56e28, "41378294570975613", -249 },
|
||||||
|
{ 0x0c43165633977bc9, "13329597309520689", -248 },
|
||||||
|
{ 0x0c43165633977bca, "1332959730952069", -248 },
|
||||||
|
{ 0x0c53165633977bc9, "26659194619041378", -248 },
|
||||||
|
{ 0x0c53165633977bca, "2665919461904138", -248 },
|
||||||
|
{ 0x0c63165633977bc9, "53318389238082755", -248 },
|
||||||
|
{ 0x0c63165633977bca, "5331838923808276", -248 },
|
||||||
|
{ 0x0c7e9eddbbb259b4, "1710711888535566", -247 },
|
||||||
|
{ 0x0c8e9eddbbb259b4, "3421423777071132", -247 },
|
||||||
|
{ 0x0c9e9eddbbb259b4, "6842847554142264", -247 },
|
||||||
|
{ 0x0e104273b18918b0, "6096109271490509", -240 },
|
||||||
|
{ 0x0e104273b18918b1, "609610927149051", -240 },
|
||||||
|
{ 0x0e204273b18918b0, "12192218542981019", -239 },
|
||||||
|
{ 0x0e204273b18918b1, "1219221854298102", -239 },
|
||||||
|
{ 0x0e304273b18918b0, "24384437085962037", -239 },
|
||||||
|
{ 0x0e304273b18918b1, "2438443708596204", -239 },
|
||||||
|
{ 0x0f1d16d6d4b89689, "7147520638007367", -235 },
|
||||||
|
{ 0x0fd6ba8608faa6a8, "2287474118824999", -231 },
|
||||||
|
{ 0x0fd6ba8608faa6a9, "22874741188249992", -231 },
|
||||||
|
{ 0x0fe6ba8608faa6a8, "4574948237649998", -231 },
|
||||||
|
{ 0x0fe6ba8608faa6a9, "45749482376499984", -231 },
|
||||||
|
{ 0x1006b100e18e5c17, "18269851255456139", -230 },
|
||||||
|
{ 0x1016b100e18e5c17, "36539702510912277", -230 },
|
||||||
|
{ 0x104f48347c60a1be, "40298468695006992", -229 },
|
||||||
|
{ 0x105f48347c60a1be, "80596937390013985", -229 },
|
||||||
|
{ 0x10a4139a6b17b224, "16552474403007851", -227 },
|
||||||
|
{ 0x10b4139a6b17b224, "33104948806015703", -227 },
|
||||||
|
{ 0x12cb91d317c8ebe9, "39050270537318193", -217 },
|
||||||
|
{ 0x13627383c5456c5e, "26761990828289327", -214 },
|
||||||
|
{ 0x138fb24e492936f6, "1838927069906671", -213 },
|
||||||
|
{ 0x139fb24e492936f6, "3677854139813342", -213 },
|
||||||
|
{ 0x13afb24e492936f6, "7355708279626684", -213 },
|
||||||
|
{ 0x13f93bb1e72a2033, "18738512510673039", -211 },
|
||||||
|
{ 0x14093bb1e72a2033, "37477025021346077", -211 },
|
||||||
|
{ 0x1466cc4fc92a0fa6, "21670630627577332", -209 },
|
||||||
|
{ 0x1476cc4fc92a0fa6, "43341261255154663", -209 },
|
||||||
|
{ 0x148048cb468bc208, "619160875073638", -209 },
|
||||||
|
{ 0x149048cb468bc209, "12383217501472761", -208 },
|
||||||
|
{ 0x14a048cb468bc209, "24766435002945523", -208 },
|
||||||
|
{ 0x1504c0b3a63c1444, "2019986500244655", -206 },
|
||||||
|
{ 0x1514c0b3a63c1444, "403997300048931", -206 },
|
||||||
|
{ 0x161ba6008389068a, "35273912934356928", -201 },
|
||||||
|
{ 0x162ba6008389068a, "70547825868713855", -201 },
|
||||||
|
{ 0x168cfab1a09b49c4, "47323883490786093", -199 },
|
||||||
|
{ 0x175090684f5fe997, "22159015457577768", -195 },
|
||||||
|
{ 0x175090684f5fe998, "2215901545757777", -195 },
|
||||||
|
{ 0x176090684f5fe997, "44318030915155535", -195 },
|
||||||
|
{ 0x176090684f5fe998, "4431803091515554", -195 },
|
||||||
|
{ 0x17e4116d591ef1fb, "13745435592982211", -192 },
|
||||||
|
{ 0x17f4116d591ef1fb, "27490871185964422", -192 },
|
||||||
|
{ 0x1804116d591ef1fb, "54981742371928845", -192 },
|
||||||
|
{ 0x18a710b7a2ef18b7, "64710073234908765", -189 },
|
||||||
|
{ 0x18cde996371c6060, "33567940583589088", -188 },
|
||||||
|
{ 0x18d99fccca44882a, "57511323531737074", -188 },
|
||||||
|
{ 0x18dde996371c6060, "67135881167178176", -188 },
|
||||||
|
{ 0x199a2cf604c30d3f, "2406355597625261", -184 },
|
||||||
|
{ 0x19aa2cf604c30d3f, "4812711195250522", -184 },
|
||||||
|
{ 0x1b5ebddc6593c857, "75862936714499446", -176 },
|
||||||
|
{ 0x1c513770474911bd, "27843818440071113", -171 },
|
||||||
|
{ 0x1d1b1ad9101b1bfd, "1795518315109779", -167 },
|
||||||
|
{ 0x1d2b1ad9101b1bfd, "3591036630219558", -167 },
|
||||||
|
{ 0x1d3b1ad9101b1bfd, "7182073260439116", -167 },
|
||||||
|
{ 0x1e3035e7b5183922, "28150140033551147", -162 },
|
||||||
|
{ 0x1e4035e7b5183923, "563002800671023", -162 },
|
||||||
|
{ 0x1e5035e7b5183923, "1126005601342046", -161 },
|
||||||
|
{ 0x1e6035e7b5183923, "2252011202684092", -161 },
|
||||||
|
{ 0x1e7035e7b5183923, "4504022405368184", -161 },
|
||||||
|
{ 0x1fd5a79c4e71d028, "2523567903248961", -154 },
|
||||||
|
{ 0x1fe5a79c4e71d028, "5047135806497922", -154 },
|
||||||
|
{ 0x20cc29bc6879dfcd, "10754533488024391", -149 },
|
||||||
|
{ 0x20dc29bc6879dfcd, "21509066976048781", -149 },
|
||||||
|
{ 0x20e8823a57adbef8, "37436263604934127", -149 },
|
||||||
|
{ 0x20ec29bc6879dfcd, "43018133952097563", -149 },
|
||||||
|
{ 0x2104dab846e19e25, "1274175730310828", -148 },
|
||||||
|
{ 0x2114dab846e19e25, "2548351460621656", -148 },
|
||||||
|
{ 0x2124dab846e19e25, "5096702921243312", -148 },
|
||||||
|
{ 0x218ce77c2b3328fb, "45209911804158747", -146 },
|
||||||
|
{ 0x220ce77c2b3328fb, "11573737421864639", -143 },
|
||||||
|
{ 0x220ce77c2b3328fc, "1157373742186464", -143 },
|
||||||
|
{ 0x221ce77c2b3328fb, "23147474843729279", -143 },
|
||||||
|
{ 0x221ce77c2b3328fc, "2314747484372928", -143 },
|
||||||
|
{ 0x222ce77c2b3328fb, "46294949687458557", -143 },
|
||||||
|
{ 0x222ce77c2b3328fc, "4629494968745856", -143 },
|
||||||
|
{ 0x229197b290631476, "36067106647774144", -141 },
|
||||||
|
{ 0x233f346f9ed36b89, "65509428048152994", -138 },
|
||||||
|
{ 0x240a28877a09a4e0, "44986453555921307", -134 },
|
||||||
|
{ 0x240a28877a09a4e1, "4498645355592131", -134 },
|
||||||
|
{ 0x243441ed79830181, "27870735485790148", -133 },
|
||||||
|
{ 0x243441ed79830182, "2787073548579015", -133 },
|
||||||
|
{ 0x244441ed79830181, "55741470971580295", -133 },
|
||||||
|
{ 0x244441ed79830182, "557414709715803", -133 },
|
||||||
|
{ 0x245441ed79830181, "11148294194316059", -132 },
|
||||||
|
{ 0x245441ed79830182, "1114829419431606", -132 },
|
||||||
|
{ 0x246441ed79830181, "22296588388632118", -132 },
|
||||||
|
{ 0x246441ed79830182, "2229658838863212", -132 },
|
||||||
|
{ 0x247441ed79830181, "44593176777264236", -132 },
|
||||||
|
{ 0x247441ed79830182, "4459317677726424", -132 },
|
||||||
|
{ 0x248b23b50fc204db, "11948502190822011", -131 },
|
||||||
|
{ 0x249b23b50fc204db, "23897004381644022", -131 },
|
||||||
|
{ 0x24ab23b50fc204db, "47794008763288043", -131 },
|
||||||
|
{ 0x2541e4ee41180c0a, "32269008655522087", -128 },
|
||||||
|
{ 0x2633dc6227de9148, "1173600085235347", -123 },
|
||||||
|
{ 0x2643dc6227de9148, "2347200170470694", -123 },
|
||||||
|
{ 0x2653dc6227de9148, "4694400340941388", -123 },
|
||||||
|
{ 0x277aacfcb88c92d6, "16528675364037979", -117 },
|
||||||
|
{ 0x277aacfcb88c92d7, "1652867536403798", -117 },
|
||||||
|
{ 0x278aacfcb88c92d6, "33057350728075958", -117 },
|
||||||
|
{ 0x278aacfcb88c92d7, "3305735072807596", -117 },
|
||||||
|
{ 0x279aacfcb88c92d6, "66114701456151916", -117 },
|
||||||
|
{ 0x279aacfcb88c92d7, "6611470145615192", -117 },
|
||||||
|
{ 0x279b5cd8bbdd8770, "67817280930489786", -117 },
|
||||||
|
{ 0x27bbb4c6bd8601bd, "27467428267063488", -116 },
|
||||||
|
{ 0x27cbb4c6bd8601bd, "54934856534126976", -116 },
|
||||||
|
{ 0x289d52af46e5fa69, "4762882274418243", -112 },
|
||||||
|
{ 0x289d52af46e5fa6a, "47628822744182433", -112 },
|
||||||
|
{ 0x28b04a616046e074, "10584182832040541", -111 },
|
||||||
|
{ 0x28c04a616046e074, "21168365664081082", -111 },
|
||||||
|
{ 0x28d04a616046e074, "42336731328162165", -111 },
|
||||||
|
{ 0x297c2c31a31998ae, "74973710847373845", -108 },
|
||||||
|
{ 0x2a3eeff57768f88c, "33722866731879692", -104 },
|
||||||
|
{ 0x2a4eeff57768f88c, "67445733463759384", -104 },
|
||||||
|
{ 0x2b8e3a0aeed7be19, "69097540994131414", -98 },
|
||||||
|
{ 0x2bdec922478c0421, "22520091703825729", -96 },
|
||||||
|
{ 0x2beec922478c0421, "45040183407651457", -96 },
|
||||||
|
{ 0x2c2379f099a86227, "45590931008842566", -95 },
|
||||||
|
{ 0x2cc7c3fba45c1271, "5696647848853893", -92 },
|
||||||
|
{ 0x2cc7c3fba45c1272, "56966478488538934", -92 },
|
||||||
|
{ 0x2cf4f14348a4c5db, "40159515855058247", -91 },
|
||||||
|
{ 0x2d04f14348a4c5db, "8031903171011649", -91 },
|
||||||
|
{ 0x2d44f14348a4c5db, "12851045073618639", -89 },
|
||||||
|
{ 0x2d44f14348a4c5dc, "1285104507361864", -89 },
|
||||||
|
{ 0x2d54f14348a4c5db, "25702090147237278", -89 },
|
||||||
|
{ 0x2d54f14348a4c5dc, "2570209014723728", -89 },
|
||||||
|
{ 0x2d5a8c931c19b77a, "3258302752792233", -89 },
|
||||||
|
{ 0x2d64f14348a4c5db, "51404180294474556", -89 },
|
||||||
|
{ 0x2d64f14348a4c5dc, "5140418029447456", -89 },
|
||||||
|
{ 0x2d6a8c931c19b77a, "6516605505584466", -89 },
|
||||||
|
{ 0x2efc1249e96b6d8d, "23119896893873391", -81 },
|
||||||
|
{ 0x2f0c1249e96b6d8d, "46239793787746783", -81 },
|
||||||
|
{ 0x2f0f6b23cfe98807, "51753157237874753", -81 },
|
||||||
|
{ 0x2fa387cf9cb4ad4e, "32943123175907307", -78 },
|
||||||
|
{ 0x2fe91b9de4d5cf31, "67761208324172855", -77 },
|
||||||
|
{ 0x3081eab25ad0fcf7, "49514357246452655", -74 },
|
||||||
|
{ 0x308ddc7e975c5045, "8252392874408775", -74 },
|
||||||
|
{ 0x308ddc7e975c5046, "82523928744087755", -74 },
|
||||||
|
{ 0x309ddc7e975c5045, "1650478574881755", -73 },
|
||||||
|
{ 0x30addc7e975c5045, "330095714976351", -73 },
|
||||||
|
{ 0x30bddc7e975c5045, "660191429952702", -73 },
|
||||||
|
{ 0x3149190e30e46c1d, "28409785190323268", -70 },
|
||||||
|
{ 0x3150ed9bd6bfd003, "3832399419240467", -70 },
|
||||||
|
{ 0x3159190e30e46c1d, "56819570380646536", -70 },
|
||||||
|
{ 0x317d2ec75df6ba2a, "26426943389906988", -69 },
|
||||||
|
{ 0x318d2ec75df6ba2a, "52853886779813977", -69 },
|
||||||
|
{ 0x321aedaa0fc32ac8, "2497072464210591", -66 },
|
||||||
|
{ 0x322aedaa0fc32ac8, "4994144928421182", -66 },
|
||||||
|
{ 0x32448050091c3c24, "15208651188557789", -65 },
|
||||||
|
{ 0x32548050091c3c24, "30417302377115577", -65 },
|
||||||
|
{ 0x328f5a18504dfaac, "37213051060716888", -64 },
|
||||||
|
{ 0x329f5a18504dfaac, "74426102121433776", -64 },
|
||||||
|
{ 0x3336dca59d035820, "55574205388093594", -61 },
|
||||||
|
{ 0x33beef5e1f90ac34, "1925091640472375", -58 },
|
||||||
|
{ 0x33ceef5e1f90ac34, "385018328094475", -58 },
|
||||||
|
{ 0x33deef5e1f90ac34, "77003665618895", -58 },
|
||||||
|
{ 0x33eeef5e1f90ac35, "15400733123779001", -57 },
|
||||||
|
{ 0x33feef5e1f90ac35, "30801466247558002", -57 },
|
||||||
|
{ 0x340eef5e1f90ac35, "61602932495116004", -57 },
|
||||||
|
{ 0x341eef5e1f90ac35, "12320586499023201", -56 },
|
||||||
|
{ 0x34228f9edfbd3420, "14784703798827841", -56 },
|
||||||
|
{ 0x342eef5e1f90ac35, "24641172998046401", -56 },
|
||||||
|
{ 0x34328f9edfbd3420, "29569407597655683", -56 },
|
||||||
|
{ 0x343eef5e1f90ac35, "49282345996092803", -56 },
|
||||||
|
{ 0x344eef5e1f90ac35, "9856469199218561", -56 },
|
||||||
|
{ 0x345eef5e1f90ac35, "19712938398437121", -55 },
|
||||||
|
{ 0x346eef5e1f90ac35, "39425876796874242", -55 },
|
||||||
|
{ 0x347eef5e1f90ac35, "78851753593748485", -55 },
|
||||||
|
{ 0x35008621c4199208, "21564764513659432", -52 },
|
||||||
|
{ 0x35108621c4199208, "43129529027318865", -52 },
|
||||||
|
{ 0x35e0ac2e7f90b8a3, "35649516398744314", -48 },
|
||||||
|
{ 0x35ef1de1f7f14439, "66534156679273626", -48 },
|
||||||
|
{ 0x361dde4a4ab13e09, "51091836539008967", -47 },
|
||||||
|
{ 0x366b870de5d93270, "15068094409836911", -45 },
|
||||||
|
{ 0x367b870de5d93270, "30136188819673822", -45 },
|
||||||
|
{ 0x368b870de5d93270, "60272377639347644", -45 },
|
||||||
|
{ 0x375b20c2f4f8d49f, "4865841847892019", -41 },
|
||||||
|
{ 0x375b20c2f4f8d4a0, "48658418478920193", -41 },
|
||||||
|
{ 0x37f25d342b1e33e5, "33729482964455627", -38 },
|
||||||
|
{ 0x3854faba79ea92ec, "24661175471861008", -36 },
|
||||||
|
{ 0x3854faba79ea92ed, "2466117547186101", -36 },
|
||||||
|
{ 0x3864faba79ea92ec, "49322350943722016", -36 },
|
||||||
|
{ 0x3864faba79ea92ed, "4932235094372202", -36 },
|
||||||
|
{ 0x3a978cfcab31064c, "19024128529074359", -25 },
|
||||||
|
{ 0x3a978cfcab31064d, "1902412852907436", -25 },
|
||||||
|
{ 0x3aa78cfcab31064c, "38048257058148717", -25 },
|
||||||
|
{ 0x3aa78cfcab31064d, "3804825705814872", -25 },
|
||||||
|
{ 0x47f52d02c7e14af7, "45035996273704964", 39 },
|
||||||
|
{ 0x490cd230a7ff47c3, "80341375308088225", 44 },
|
||||||
|
{ 0x4919d9577de925d5, "14411294198511291", 45 },
|
||||||
|
{ 0x4929d9577de925d5, "28822588397022582", 45 },
|
||||||
|
{ 0x4931159a8bd8a240, "38099461575161174", 45 },
|
||||||
|
{ 0x4939d9577de925d5, "57645176794045164", 45 },
|
||||||
|
{ 0x49ccadd6dd730c96, "32745697577386472", 48 },
|
||||||
|
{ 0x49dcadd6dd730c96, "65491395154772944", 48 },
|
||||||
|
{ 0x4a6bb6979ae39c49, "32402369146794532", 51 },
|
||||||
|
{ 0x4a7bb6979ae39c49, "64804738293589064", 51 },
|
||||||
|
{ 0x4b9a32ac316fb3ab, "16059290466419889", 57 },
|
||||||
|
{ 0x4b9a32ac316fb3ac, "1605929046641989", 57 },
|
||||||
|
{ 0x4baa32ac316fb3ab, "32118580932839778", 57 },
|
||||||
|
{ 0x4baa32ac316fb3ac, "3211858093283978", 57 },
|
||||||
|
{ 0x4bba32ac316fb3ab, "64237161865679556", 57 },
|
||||||
|
{ 0x4bba32ac316fb3ac, "6423716186567956", 57 },
|
||||||
|
{ 0x4c85564fb098c955, "42859354584576066", 61 },
|
||||||
|
{ 0x4cef20b1a0d7f626, "4001624164855121", 63 },
|
||||||
|
{ 0x4cff20b1a0d7f626, "8003248329710242", 63 },
|
||||||
|
{ 0x4e2e2785c3a2a20a, "4064803033949531", 69 },
|
||||||
|
{ 0x4e2e2785c3a2a20b, "40648030339495312", 69 },
|
||||||
|
{ 0x4e3e2785c3a2a20a, "8129606067899062", 69 },
|
||||||
|
{ 0x4e3e2785c3a2a20b, "81296060678990625", 69 },
|
||||||
|
{ 0x4e6454b1aef62c8d, "4384946084578497", 70 },
|
||||||
|
{ 0x4e80fde34c996086, "1465909318208761", 71 },
|
||||||
|
{ 0x4e90fde34c996086, "2931818636417522", 71 },
|
||||||
|
{ 0x4ea9a2c2a34ac2f9, "8846583389443709", 71 },
|
||||||
|
{ 0x4ea9a2c2a34ac2fa, "884658338944371", 71 },
|
||||||
|
{ 0x4eb9a2c2a34ac2f9, "17693166778887419", 72 },
|
||||||
|
{ 0x4eb9a2c2a34ac2fa, "1769316677888742", 72 },
|
||||||
|
{ 0x4ec9a2c2a34ac2f9, "35386333557774838", 72 },
|
||||||
|
{ 0x4ec9a2c2a34ac2fa, "3538633355777484", 72 },
|
||||||
|
{ 0x4ed9a2c2a34ac2f9, "70772667115549675", 72 },
|
||||||
|
{ 0x4ed9a2c2a34ac2fa, "7077266711554968", 72 },
|
||||||
|
{ 0x4f28750ea732fdae, "21606114462319112", 74 },
|
||||||
|
{ 0x4f38750ea732fdae, "43212228924638223", 74 },
|
||||||
|
{ 0x503ca9bade45b94a, "3318949537676913", 79 },
|
||||||
|
{ 0x504ca9bade45b94a, "6637899075353826", 79 },
|
||||||
|
{ 0x513843e10734fa57, "18413733104063271", 84 },
|
||||||
|
{ 0x514843e10734fa57, "36827466208126543", 84 },
|
||||||
|
{ 0x51a3274280201a89, "18604316837693468", 86 },
|
||||||
|
{ 0x51b3274280201a89, "37208633675386937", 86 },
|
||||||
|
{ 0x51e71760b3c0bc13, "35887030159858487", 87 },
|
||||||
|
{ 0x521f6a5025e71a61, "39058878597126768", 88 },
|
||||||
|
{ 0x522f6a5025e71a61, "78117757194253536", 88 },
|
||||||
|
{ 0x52c6a47d4e7ec633, "57654578150150385", 91 },
|
||||||
|
{ 0x55693ba3249a8511, "2825769263311679", 104 },
|
||||||
|
{ 0x55793ba3249a8511, "5651538526623358", 104 },
|
||||||
|
{ 0x574fe0403124a00e, "38329392744333992", 113 },
|
||||||
|
{ 0x575fe0403124a00e, "76658785488667984", 113 },
|
||||||
|
{ 0x57763ae2caed4528, "2138446062528161", 114 },
|
||||||
|
{ 0x57863ae2caed4528, "4276892125056322", 114 },
|
||||||
|
{ 0x57d561def4a9ee32, "1316415380484425", 116 },
|
||||||
|
{ 0x57e561def4a9ee32, "263283076096885", 116 },
|
||||||
|
{ 0x57f561def4a9ee32, "52656615219377", 116 },
|
||||||
|
{ 0x580561def4a9ee31, "10531323043875399", 117 },
|
||||||
|
{ 0x581561def4a9ee31, "21062646087750798", 117 },
|
||||||
|
{ 0x582561def4a9ee31, "42125292175501597", 117 },
|
||||||
|
{ 0x584561def4a9ee31, "16850116870200639", 118 },
|
||||||
|
{ 0x585561def4a9ee31, "33700233740401277", 118 },
|
||||||
|
{ 0x5935ede8cce30845, "56627018760181905", 122 },
|
||||||
|
{ 0x59d0dd8f2788d699, "44596066840334405", 125 },
|
||||||
|
{ 0x5b45ed1f039cebfe, "48635409059147446", 132 },
|
||||||
|
{ 0x5b55ed1f039cebfe, "9727081811829489", 132 },
|
||||||
|
{ 0x5b55ed1f039cebff, "972708181182949", 132 },
|
||||||
|
{ 0x5beaf5b5378aa2e5, "61235700073843246", 135 },
|
||||||
|
{ 0x5bfaf5b5378aa2e5, "12247140014768649", 136 },
|
||||||
|
{ 0x5c0af5b5378aa2e5, "24494280029537298", 136 },
|
||||||
|
{ 0x5c1af5b5378aa2e5, "48988560059074597", 136 },
|
||||||
|
{ 0x5c4ef3052ef0a361, "4499029632233837", 137 },
|
||||||
|
{ 0x5c6cf45d333da323, "16836228873919609", 138 },
|
||||||
|
{ 0x5e1780695036a679, "18341526859645389", 146 },
|
||||||
|
{ 0x5e2780695036a679, "36683053719290777", 146 },
|
||||||
|
{ 0x5e54ec8fd70420c7, "2612787385440923", 147 },
|
||||||
|
{ 0x5e64ec8fd70420c7, "5225574770881846", 147 },
|
||||||
|
{ 0x5e6b5e2f86026f05, "6834859331393543", 147 },
|
||||||
|
{ 0x5f9aeac2d1ea2695, "35243988108650928", 153 },
|
||||||
|
{ 0x5faaeac2d1ea2695, "70487976217301855", 153 },
|
||||||
|
{ 0x6009813653f62db7, "42745323906998127", 155 },
|
||||||
|
{ 0x611260322d04d50b, "40366692112133834", 160 },
|
||||||
|
{ 0x624be064a3fb2725, "32106017483029628", 166 },
|
||||||
|
{ 0x625be064a3fb2725, "64212034966059256", 166 },
|
||||||
|
{ 0x64112a13daa46fe4, "10613173493886741", 175 },
|
||||||
|
{ 0x64212a13daa46fe4, "21226346987773482", 175 },
|
||||||
|
{ 0x64312a13daa46fe4, "42452693975546964", 175 },
|
||||||
|
{ 0x671dcfee6690ffc6, "51886190678901447", 189 },
|
||||||
|
{ 0x672dcfee6690ffc6, "10377238135780289", 190 },
|
||||||
|
{ 0x673dcfee6690ffc6, "20754476271560579", 190 },
|
||||||
|
{ 0x674dcfee6690ffc6, "41508952543121158", 190 },
|
||||||
|
{ 0x675dcfee6690ffc6, "83017905086242315", 190 },
|
||||||
|
{ 0x677a77581053543b, "29480080280199528", 191 },
|
||||||
|
{ 0x678a77581053543b, "58960160560399056", 191 },
|
||||||
|
{ 0x6820ee7811241ad3, "38624526316654214", 194 },
|
||||||
|
{ 0x682d3683fa3d1ee0, "66641177824100826", 194 },
|
||||||
|
{ 0x699873e3758bc6b3, "4679330956996797", 201 },
|
||||||
|
{ 0x699cb490951e8515, "5493127645170153", 201 },
|
||||||
|
{ 0x6a6cc08102f0da5b, "45072812455233127", 205 },
|
||||||
|
{ 0x6b3ef9beaa7aa583, "39779219869333628", 209 },
|
||||||
|
{ 0x6b3ef9beaa7aa584, "3977921986933363", 209 },
|
||||||
|
{ 0x6b4ef9beaa7aa583, "79558439738667255", 209 },
|
||||||
|
{ 0x6b4ef9beaa7aa584, "7955843973866726", 209 },
|
||||||
|
{ 0x6b7896beb0c66eb9, "50523702331566894", 210 },
|
||||||
|
{ 0x6b7b86d8c3df7cd1, "56560320317673966", 210 },
|
||||||
|
{ 0x6bdf20938e7414bb, "40933393326155808", 212 },
|
||||||
|
{ 0x6be6c9e14b7c22c4, "59935550661561155", 212 },
|
||||||
|
{ 0x6bef20938e7414bb, "81866786652311615", 212 },
|
||||||
|
{ 0x6bf6c9e14b7c22c3, "1198711013231223", 213 },
|
||||||
|
{ 0x6bf6c9e14b7c22c4, "11987110132312231", 213 },
|
||||||
|
{ 0x6c06c9e14b7c22c3, "2397422026462446", 213 },
|
||||||
|
{ 0x6c06c9e14b7c22c4, "23974220264624462", 213 },
|
||||||
|
{ 0x6c16c9e14b7c22c3, "4794844052924892", 213 },
|
||||||
|
{ 0x6c16c9e14b7c22c4, "47948440529248924", 213 },
|
||||||
|
{ 0x6ce75d226331d03a, "40270821632825953", 217 },
|
||||||
|
{ 0x6cf75d226331d03a, "8054164326565191", 217 },
|
||||||
|
{ 0x6d075d226331d03a, "16108328653130381", 218 },
|
||||||
|
{ 0x6d175d226331d03a, "32216657306260762", 218 },
|
||||||
|
{ 0x6d275d226331d03a, "64433314612521525", 218 },
|
||||||
|
{ 0x6d4b9445072f4374, "30423431424080128", 219 },
|
||||||
|
{ 0x6d5a3bdac4f00f33, "57878622568856074", 219 },
|
||||||
|
{ 0x6d5b9445072f4374, "60846862848160256", 219 },
|
||||||
|
{ 0x6e4a2fbffdb7580c, "18931483477278361", 224 },
|
||||||
|
{ 0x6e5a2fbffdb7580c, "37862966954556723", 224 },
|
||||||
|
{ 0x6e927edd0dbb8c08, "4278822588984689", 225 },
|
||||||
|
{ 0x6e927edd0dbb8c09, "42788225889846894", 225 },
|
||||||
|
{ 0x6ee1c382c3819a0a, "1315044757954692", 227 },
|
||||||
|
{ 0x6ef1c382c3819a0a, "2630089515909384", 227 },
|
||||||
|
{ 0x70f60cf8f38b0465, "14022275014833741", 237 },
|
||||||
|
{ 0x71060cf8f38b0465, "28044550029667482", 237 },
|
||||||
|
{ 0x7114390c68b888ce, "5143975308105889", 237 },
|
||||||
|
{ 0x71160cf8f38b0465, "56089100059334965", 237 },
|
||||||
|
{ 0x714fb4840532a9e5, "64517311884236306", 238 },
|
||||||
|
{ 0x71b1d7cb7eae05d9, "46475406389115295", 240 },
|
||||||
|
{ 0x727fca36c06cf106, "3391607972972965", 244 },
|
||||||
|
{ 0x728fca36c06cf106, "678321594594593", 244 },
|
||||||
|
{ 0x72eba10d818fdafd, "3773057430100257", 246 },
|
||||||
|
{ 0x72fba10d818fdafd, "7546114860200514", 246 },
|
||||||
|
{ 0x737a37935f3b71c9, "1833078106007497", 249 },
|
||||||
|
{ 0x738a37935f3b71c9, "3666156212014994", 249 },
|
||||||
|
{ 0x73972852443155ae, "64766168833734675", 249 },
|
||||||
|
{ 0x739a37935f3b71c9, "7332312424029988", 249 },
|
||||||
|
{ 0x754fe46e378bf132, "1197160149212491", 258 },
|
||||||
|
{ 0x754fe46e378bf133, "11971601492124911", 258 },
|
||||||
|
{ 0x755fe46e378bf132, "2394320298424982", 258 },
|
||||||
|
{ 0x755fe46e378bf133, "23943202984249821", 258 },
|
||||||
|
{ 0x756fe46e378bf132, "4788640596849964", 258 },
|
||||||
|
{ 0x756fe46e378bf133, "47886405968499643", 258 },
|
||||||
|
{ 0x76603d7cb98edc58, "1598075144577112", 263 },
|
||||||
|
{ 0x76603d7cb98edc59, "15980751445771122", 263 },
|
||||||
|
{ 0x76703d7cb98edc58, "3196150289154224", 263 },
|
||||||
|
{ 0x76703d7cb98edc59, "31961502891542243", 263 },
|
||||||
|
{ 0x782f7c6a9ad432a1, "83169412421960475", 271 },
|
||||||
|
{ 0x78447e17e7814ce7, "21652206566352648", 272 },
|
||||||
|
{ 0x78547e17e7814ce7, "43304413132705296", 272 },
|
||||||
|
{ 0x7856d2aa2fc5f2b5, "48228872759189434", 272 },
|
||||||
|
{ 0x7964066d88c7cab8, "5546524276967009", 277 },
|
||||||
|
{ 0x799d696737fe68c7, "65171333649148234", 278 },
|
||||||
|
{ 0x7ace779fddf21621, "3539481653469909", 284 },
|
||||||
|
{ 0x7ace779fddf21622, "35394816534699092", 284 },
|
||||||
|
{ 0x7ade779fddf21621, "7078963306939818", 284 },
|
||||||
|
{ 0x7ade779fddf21622, "70789633069398184", 284 },
|
||||||
|
{ 0x7bc3b063946e10ae, "14990287287869931", 289 },
|
||||||
|
{ 0x7bd3b063946e10ae, "29980574575739863", 289 },
|
||||||
|
{ 0x7c0c283ffc61c87d, "34300126555012788", 290 },
|
||||||
|
{ 0x7c1c283ffc61c87d, "68600253110025576", 290 },
|
||||||
|
{ 0x7c31926c7a7122ba, "17124434349589332", 291 },
|
||||||
|
{ 0x7c41926c7a7122ba, "34248868699178663", 291 },
|
||||||
|
{ 0x7d0a85c6f7fba05d, "2117392354885733", 295 },
|
||||||
|
{ 0x7d1a85c6f7fba05d, "4234784709771466", 295 },
|
||||||
|
{ 0x7d52a5daf9226f04, "47639264836707725", 296 },
|
||||||
|
{ 0x7d8220e1772428d7, "37049827284413546", 297 },
|
||||||
|
{ 0x7d9220e1772428d7, "7409965456882709", 297 },
|
||||||
|
{ 0x7da220e1772428d7, "14819930913765419", 298 },
|
||||||
|
{ 0x7db220e1772428d7, "29639861827530837", 298 },
|
||||||
|
{ 0x7df22815078cb97b, "47497368114750945", 299 },
|
||||||
|
{ 0x7dfe5aceedf1c1f1, "79407577493590275", 299 },
|
||||||
|
{ 0x7e022815078cb97b, "9499473622950189", 299 },
|
||||||
|
{ 0x7e122815078cb97b, "18998947245900378", 300 },
|
||||||
|
{ 0x7e222815078cb97b, "37997894491800756", 300 },
|
||||||
|
{ 0x7e8a9b45a91f1700, "35636409637317792", 302 },
|
||||||
|
{ 0x7e9a9b45a91f1700, "71272819274635585", 302 },
|
||||||
|
{ 0x7eb6202598194bee, "23707742595255608", 303 },
|
||||||
|
{ 0x7ec490abad057752, "4407140524515149", 303 },
|
||||||
|
{ 0x7ec6202598194bee, "47415485190511216", 303 },
|
||||||
|
{ 0x7ee3c8eeb77b8d05, "16959746108988652", 304 },
|
||||||
|
{ 0x7ef3c8eeb77b8d05, "33919492217977303", 304 },
|
||||||
|
{ 0x7ef5bc471d5456c7, "37263572163337027", 304 },
|
||||||
|
{ 0x7f03c8eeb77b8d05, "6783898443595461", 304 },
|
||||||
|
{ 0x7f13c8eeb77b8d05, "13567796887190921", 305 },
|
||||||
|
{ 0x7f23c8eeb77b8d05, "27135593774381842", 305 },
|
||||||
|
{ 0x7f33c8eeb77b8d05, "54271187548763685", 305 },
|
||||||
|
{ 0x7f5594223f5654bf, "2367662756557091", 306 },
|
||||||
|
{ 0x7f6594223f5654bf, "4735325513114182", 306 },
|
||||||
|
{ 0x7f9914e03c9260ee, "44032152438472327", 307 },
|
||||||
|
{ 0x7fb82baa4ae611dc, "16973149506391291", 308 },
|
||||||
|
{ 0x7fc82baa4ae611dc, "33946299012782582", 308 },
|
||||||
|
{ 0x7fd82baa4ae611dc, "67892598025565165", 308 },
|
||||||
|
{ 0x7fefffffffffffff, "17976931348623157", 309 },
|
||||||
|
];
|
||||||
|
|
||||||
|
short low;
|
||||||
|
short high = pathologies.length - 1;
|
||||||
|
const FloatBits!double bits = { value };
|
||||||
|
|
||||||
|
while (high >= low)
|
||||||
|
{
|
||||||
|
const short middle = (low + high) / 2;
|
||||||
|
if (pathologies[middle].representation == bits.integral)
|
||||||
|
{
|
||||||
|
exponent = pathologies[middle].exponent;
|
||||||
|
copy(pathologies[middle].digits, buffer);
|
||||||
|
return buffer[0 .. pathologies[middle].digits.length];
|
||||||
|
}
|
||||||
|
else if (pathologies[middle].representation < bits.integral)
|
||||||
|
{
|
||||||
|
low = cast(short) (middle + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
high = cast(short) (middle - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@nogc nothrow pure @safe unittest
|
||||||
|
{
|
||||||
|
int exponent;
|
||||||
|
char[512] buffer;
|
||||||
|
|
||||||
|
assert(errol3(double.max, buffer, exponent) == "17976931348623157");
|
||||||
|
assert(exponent == 309);
|
||||||
|
|
||||||
|
assert(errol3(0.67892598025565165e308, buffer, exponent) == "67892598025565165");
|
||||||
|
assert(exponent == 308);
|
||||||
|
|
||||||
|
assert(errol3(0.40526371999771488e-307, buffer, exponent) == "40526371999771488");
|
||||||
|
assert(exponent == -307);
|
||||||
|
|
||||||
|
assert(errol3(0.81052743999542975e-307, buffer, exponent) == "81052743999542975");
|
||||||
|
assert(exponent == -307);
|
||||||
|
|
||||||
|
assert(errol3(0.810307, buffer, exponent) is null);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given a float value, returns the significant bits, and the position of the
|
* Given a float value, returns the significant bits, and the position of the
|
||||||
* decimal point in $(D_PARAM exponent). +/-Inf and NaN are specified by
|
* decimal point in $(D_PARAM exponent). +/-Inf and NaN are specified by
|
||||||
@ -1371,22 +1963,23 @@ private const(char)[] real2String(double value,
|
|||||||
exponent = special;
|
exponent = special;
|
||||||
return (bits.integral & ((1UL << 52) - 1)) != 0 ? "NaN" : "Inf";
|
return (bits.integral & ((1UL << 52) - 1)) != 0 ? "NaN" : "Inf";
|
||||||
}
|
}
|
||||||
|
else if (exponent == 0 && (bits.integral << 1) == 0) // Is zero?
|
||||||
if (exponent == 0 && (bits.integral << 1) == 0) // Is zero?
|
|
||||||
{
|
{
|
||||||
exponent = 1;
|
exponent = 1;
|
||||||
buffer[0] = '0';
|
buffer[0] = '0';
|
||||||
return buffer[0 .. 1];
|
return buffer[0 .. 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == double.max)
|
auto digits = errol3(value, buffer, exponent);
|
||||||
|
if (digits !is null)
|
||||||
{
|
{
|
||||||
copy("17976931348623157", buffer);
|
|
||||||
exponent = 309;
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
else if (value >= 16.0 && value <= 9.007199254740992e15)
|
||||||
if (value > 9.007199254740992e15 && value < 3.40282366920938e38)
|
{
|
||||||
|
return errolFixed(value, buffer, exponent);
|
||||||
|
}
|
||||||
|
else if (value > 9.007199254740992e15 && value < 3.40282366920938e38)
|
||||||
{
|
{
|
||||||
return errol2(value, buffer, exponent);
|
return errol2(value, buffer, exponent);
|
||||||
}
|
}
|
||||||
@ -1745,7 +2338,17 @@ private ref String printToString(string fmt, Args...)(return ref String result,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
package(tanya) String format(string fmt, Args...)(auto ref Args args)
|
/**
|
||||||
|
* Produces a string according to the specified format.
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* fmt = Format.
|
||||||
|
* Args = Types of the arguments.
|
||||||
|
* args = Arguments.
|
||||||
|
*
|
||||||
|
* Returns: Formatted string.
|
||||||
|
*/
|
||||||
|
String format(string fmt, Args...)(auto ref Args args)
|
||||||
{
|
{
|
||||||
String formatted;
|
String formatted;
|
||||||
|
|
||||||
@ -1758,7 +2361,7 @@ package(tanya) String format(string fmt, Args...)(auto ref Args args)
|
|||||||
{
|
{
|
||||||
static if (FormatSpecFilter!spec)
|
static if (FormatSpecFilter!spec)
|
||||||
{
|
{
|
||||||
printToString!"{}"(formatted, args);
|
printToString!"{}"(formatted, args[spec.position]);
|
||||||
}
|
}
|
||||||
else static if (isSomeString!(typeof(spec)))
|
else static if (isSomeString!(typeof(spec)))
|
||||||
{
|
{
|
||||||
@ -1772,6 +2375,12 @@ package(tanya) String format(string fmt, Args...)(auto ref Args args)
|
|||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// doesn't print the first argument repeatedly
|
||||||
|
@nogc nothrow pure @safe unittest
|
||||||
|
{
|
||||||
|
assert(format!"{}{}"(1, 2) == "12");
|
||||||
|
}
|
||||||
|
|
||||||
@nogc nothrow pure @safe unittest
|
@nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
assert(format!"Without arguments"() == "Without arguments");
|
assert(format!"Without arguments"() == "Without arguments");
|
||||||
@ -1845,6 +2454,7 @@ package(tanya) String format(string fmt, Args...)(auto ref Args args)
|
|||||||
assert(format!"{}"(0x1p-16382L) == "0");
|
assert(format!"{}"(0x1p-16382L) == "0");
|
||||||
assert(format!"{}"(1e+3) == "1000");
|
assert(format!"{}"(1e+3) == "1000");
|
||||||
assert(format!"{}"(38234.1234) == "38234.1");
|
assert(format!"{}"(38234.1234) == "38234.1");
|
||||||
|
assert(format!"{}"(double.max) == "1.79769e+308");
|
||||||
|
|
||||||
// typeof(null).
|
// typeof(null).
|
||||||
assert(format!"{}"(null) == "null");
|
assert(format!"{}"(null) == "null");
|
||||||
@ -2004,6 +2614,7 @@ nothrow pure @safe unittest
|
|||||||
|
|
||||||
private struct FormatSpec
|
private struct FormatSpec
|
||||||
{
|
{
|
||||||
|
const size_t position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the position of `tag` in `fmt`. If `tag` can't be found, returns the
|
// Returns the position of `tag` in `fmt`. If `tag` can't be found, returns the
|
||||||
@ -2020,7 +2631,7 @@ private size_t specPosition(string fmt, char tag)()
|
|||||||
return fmt.length;
|
return fmt.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
private template ParseFmt(string fmt, size_t pos = 0)
|
private template ParseFmt(string fmt, size_t arg = 0, size_t pos = 0)
|
||||||
{
|
{
|
||||||
static if (fmt.length == 0)
|
static if (fmt.length == 0)
|
||||||
{
|
{
|
||||||
@ -2032,7 +2643,7 @@ private template ParseFmt(string fmt, size_t pos = 0)
|
|||||||
{
|
{
|
||||||
enum size_t pos = specPosition!(fmt[2 .. $], '{') + 2;
|
enum size_t pos = specPosition!(fmt[2 .. $], '{') + 2;
|
||||||
alias ParseFmt = AliasSeq!(fmt[1 .. pos],
|
alias ParseFmt = AliasSeq!(fmt[1 .. pos],
|
||||||
ParseFmt!(fmt[pos .. $], pos));
|
ParseFmt!(fmt[pos .. $], arg, pos));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2043,8 +2654,8 @@ private template ParseFmt(string fmt, size_t pos = 0)
|
|||||||
}
|
}
|
||||||
else static if (pos == 1)
|
else static if (pos == 1)
|
||||||
{
|
{
|
||||||
alias ParseFmt = AliasSeq!(FormatSpec(),
|
alias ParseFmt = AliasSeq!(FormatSpec(arg),
|
||||||
ParseFmt!(fmt[pos + 1 .. $], pos + 1));
|
ParseFmt!(fmt[2 .. $], arg + 1, 2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2056,7 +2667,7 @@ private template ParseFmt(string fmt, size_t pos = 0)
|
|||||||
{
|
{
|
||||||
enum size_t pos = specPosition!(fmt, '{');
|
enum size_t pos = specPosition!(fmt, '{');
|
||||||
alias ParseFmt = AliasSeq!(fmt[0 .. pos],
|
alias ParseFmt = AliasSeq!(fmt[0 .. pos],
|
||||||
ParseFmt!(fmt[pos .. $], pos));
|
ParseFmt!(fmt[pos .. $], arg, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,10 @@ private struct FNV
|
|||||||
* }
|
* }
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* For scalar types FNV-1a (Fowler-Noll-Vo) hash function is used internally.
|
* For pointers and for scalar types implicitly convertible to `size_t` this
|
||||||
|
* is an identity operation (i.e. the value is cast to `size_t` and returned
|
||||||
|
* unaltered). Integer types wider than `size_t` are XOR folded down to
|
||||||
|
* `size_t`. Other scalar types use the FNV-1a (Fowler-Noll-Vo) hash function.
|
||||||
* If the type provides a `toHash`-function, only `toHash()` is called and its
|
* If the type provides a `toHash`-function, only `toHash()` is called and its
|
||||||
* result is returned.
|
* result is returned.
|
||||||
*
|
*
|
||||||
@ -110,6 +113,19 @@ size_t hash(T)(auto ref T key)
|
|||||||
{
|
{
|
||||||
return key.toHash();
|
return key.toHash();
|
||||||
}
|
}
|
||||||
|
else static if ((isIntegral!T || isSomeChar!T || isBoolean!T)
|
||||||
|
&& T.sizeof <= size_t.sizeof)
|
||||||
|
{
|
||||||
|
return cast(size_t) key;
|
||||||
|
}
|
||||||
|
else static if (isIntegral!T && T.sizeof > size_t.sizeof)
|
||||||
|
{
|
||||||
|
return cast(size_t) (key ^ (key >>> (size_t.sizeof * 8)));
|
||||||
|
}
|
||||||
|
else static if (isPointer!T || is(T : typeof(null)))
|
||||||
|
{
|
||||||
|
return (() @trusted => cast(size_t) key)();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FNV fnv;
|
FNV fnv;
|
||||||
@ -177,30 +193,29 @@ version (unittest)
|
|||||||
// Tests that work for any hash size
|
// Tests that work for any hash size
|
||||||
@nogc nothrow pure @safe unittest
|
@nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
assert(hash(null) == FNV.offsetBasis);
|
assert(hash(null) == 0);
|
||||||
assert(hash(ToHash()) == 0U);
|
assert(hash(ToHash()) == 0U);
|
||||||
|
assert(hash('a') == 'a');
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (size_t.sizeof == 4) @nogc nothrow pure @safe unittest
|
static if (size_t.sizeof == 4) @nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
assert(hash('a') == 0xe40c292cU);
|
|
||||||
assert(hash(HashRange()) == 0x6222e842U);
|
assert(hash(HashRange()) == 0x6222e842U);
|
||||||
assert(hash(ToHashRange()) == 1268118805U);
|
assert(hash(ToHashRange()) == 1268118805U);
|
||||||
}
|
}
|
||||||
static if (size_t.sizeof == 8) @nogc nothrow pure @safe unittest
|
static if (size_t.sizeof == 8) @nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
assert(hash('a') == 0xaf63dc4c8601ec8cUL);
|
|
||||||
assert(hash(HashRange()) == 0x08985907b541d342UL);
|
assert(hash(HashRange()) == 0x08985907b541d342UL);
|
||||||
assert(hash(ToHashRange()) == 12161962213042174405UL);
|
assert(hash(ToHashRange()) == 12161962213042174405UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (size_t.sizeof == 4) @nogc nothrow pure @system unittest
|
static if (size_t.sizeof == 4) @nogc nothrow pure @system unittest
|
||||||
{
|
{
|
||||||
assert(hash(cast(void*) 0x6e6f6863) == 0xac297727U);
|
assert(hash(cast(void*) 0x6e6f6863) == 0x6e6f6863);
|
||||||
}
|
}
|
||||||
static if (size_t.sizeof == 8) @nogc nothrow pure @system unittest
|
static if (size_t.sizeof == 8) @nogc nothrow pure @system unittest
|
||||||
{
|
{
|
||||||
assert(hash(cast(void*) 0x77206f676e6f6863) == 0xd1edd10b507344d0UL);
|
assert(hash(cast(void*) 0x77206f676e6f6863) == 0x77206f676e6f6863);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -116,7 +116,7 @@ if (Args.length > 0 && __traits(isTemplate, pred))
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zips one or more $(D_PSYMBOL Tuple)s with $(D_PARAM f).
|
* Zips one or more $(D_PSYMBOL Pack)s with $(D_PARAM f).
|
||||||
*
|
*
|
||||||
* Given $(D_PARAM f) and tuples t1, t2, ..., tk, where tk[i] denotes the
|
* Given $(D_PARAM f) and tuples t1, t2, ..., tk, where tk[i] denotes the
|
||||||
* $(I i)-th element of the tuple $(I k)-th tuple, $(D_PSYMBOL ZipWith)
|
* $(I i)-th element of the tuple $(I k)-th tuple, $(D_PSYMBOL ZipWith)
|
||||||
@ -129,7 +129,7 @@ if (Args.length > 0 && __traits(isTemplate, pred))
|
|||||||
* f(tk[0], tk[1], ... tk[i]),
|
* f(tk[0], tk[1], ... tk[i]),
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* $(D_PSYMBOL ZipWith) begins with the first elements from $(D_PARAM Tuples)
|
* $(D_PSYMBOL ZipWith) begins with the first elements from $(D_PARAM Packs)
|
||||||
* and applies $(D_PARAM f) to them, then it takes the second
|
* and applies $(D_PARAM f) to them, then it takes the second
|
||||||
* ones and does the same, and so on.
|
* ones and does the same, and so on.
|
||||||
*
|
*
|
||||||
@ -140,16 +140,17 @@ if (Args.length > 0 && __traits(isTemplate, pred))
|
|||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* f = Some template that can be applied to the elements of
|
* f = Some template that can be applied to the elements of
|
||||||
* $(D_PARAM Tuples).
|
* $(D_PARAM Packs).
|
||||||
* Tuples = $(D_PSYMBOL Tuple) instances.
|
* Packs = $(D_PSYMBOL Pack) instances.
|
||||||
*
|
*
|
||||||
* Returns: A sequence, whose $(I i)-th element contains the $(I i)-th element
|
* Returns: A sequence, whose $(I i)-th element contains the $(I i)-th element
|
||||||
* from each of the $(D_PARAM Tuples).
|
* from each of the $(D_PARAM Packs).
|
||||||
*/
|
*/
|
||||||
template ZipWith(alias f, Tuples...)
|
template ZipWith(alias f, Packs...)
|
||||||
if (Tuples.length > 0
|
if (Packs.length > 0
|
||||||
&& __traits(isTemplate, f)
|
&& __traits(isTemplate, f)
|
||||||
&& allSatisfy!(ApplyLeft!(isInstanceOf, Tuple), Tuples))
|
&& (allSatisfy!(ApplyLeft!(isInstanceOf, Pack), Packs)
|
||||||
|
|| allSatisfy!(ApplyLeft!(isInstanceOf, Tuple), Packs)))
|
||||||
{
|
{
|
||||||
private template GetIth(size_t i, Args...)
|
private template GetIth(size_t i, Args...)
|
||||||
{
|
{
|
||||||
@ -164,43 +165,37 @@ if (Tuples.length > 0
|
|||||||
}
|
}
|
||||||
private template Iterate(size_t i, Args...)
|
private template Iterate(size_t i, Args...)
|
||||||
{
|
{
|
||||||
alias Tuple = GetIth!(i, Args);
|
alias Pack = GetIth!(i, Args);
|
||||||
|
|
||||||
static if (Tuple.length < Tuples.length)
|
static if (Pack.length < Packs.length)
|
||||||
{
|
{
|
||||||
alias Iterate = AliasSeq!();
|
alias Iterate = AliasSeq!();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alias Iterate = AliasSeq!(f!Tuple,
|
alias Iterate = AliasSeq!(f!Pack, Iterate!(i + 1, Args));
|
||||||
Iterate!(i + 1, Args));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alias ZipWith = Iterate!(0, Tuples);
|
alias ZipWith = Iterate!(0, Packs);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@nogc nothrow pure @safe unittest
|
@nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
alias Result1 = ZipWith!(AliasSeq,
|
alias Result1 = ZipWith!(AliasSeq, Pack!(1, 2), Pack!(5, 6), Pack!(9, 10));
|
||||||
Tuple!(1, 2),
|
|
||||||
Tuple!(5, 6),
|
|
||||||
Tuple!(9, 10));
|
|
||||||
static assert(Result1 == AliasSeq!(1, 5, 9, 2, 6, 10));
|
static assert(Result1 == AliasSeq!(1, 5, 9, 2, 6, 10));
|
||||||
|
|
||||||
alias Result2 = ZipWith!(AliasSeq,
|
alias Result2 = ZipWith!(AliasSeq, Pack!(1, 2, 3), Pack!(4, 5));
|
||||||
Tuple!(1, 2, 3),
|
|
||||||
Tuple!(4, 5));
|
|
||||||
static assert(Result2 == AliasSeq!(1, 4, 2, 5));
|
static assert(Result2 == AliasSeq!(1, 4, 2, 5));
|
||||||
|
|
||||||
alias Result3 = ZipWith!(AliasSeq, Tuple!(), Tuple!(4, 5));
|
alias Result3 = ZipWith!(AliasSeq, Pack!(), Pack!(4, 5));
|
||||||
static assert(Result3.length == 0);
|
static assert(Result3.length == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds a typed sequence of template parameters.
|
* Holds a typed sequence of template parameters.
|
||||||
*
|
*
|
||||||
* Different than $(D_PSYMBOL AliasSeq), $(D_PSYMBOL Tuple) doesn't unpack
|
* Different than $(D_PSYMBOL AliasSeq), $(D_PSYMBOL Pack) doesn't unpack
|
||||||
* its template parameters automatically. Consider:
|
* its template parameters automatically. Consider:
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
@ -215,7 +210,7 @@ if (Tuples.length > 0
|
|||||||
* Using $(D_PSYMBOL AliasSeq) template `A` gets 4 parameters instead of 2,
|
* Using $(D_PSYMBOL AliasSeq) template `A` gets 4 parameters instead of 2,
|
||||||
* because $(D_PSYMBOL AliasSeq) is just an alias for its template parameters.
|
* because $(D_PSYMBOL AliasSeq) is just an alias for its template parameters.
|
||||||
*
|
*
|
||||||
* With $(D_PSYMBOL Tuple) it is possible to pass distinguishable
|
* With $(D_PSYMBOL Pack) it is possible to pass distinguishable
|
||||||
* sequences of parameters to a template. So:
|
* sequences of parameters to a template. So:
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
@ -224,14 +219,26 @@ if (Tuples.length > 0
|
|||||||
* static assert(Args.length == 2);
|
* static assert(Args.length == 2);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* alias BInstance = B!(Tuple!(int, uint), Tuple!(float, double));
|
* alias BInstance = B!(Pack!(int, uint), Pack!(float, double));
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* Args = Elements of this $(D_PSYMBOL Tuple).
|
* Args = Elements of this $(D_PSYMBOL Pack).
|
||||||
*
|
*
|
||||||
* See_Also: $(D_PSYMBOL AliasSeq).
|
* See_Also: $(D_PSYMBOL AliasSeq).
|
||||||
*/
|
*/
|
||||||
|
struct Pack(Args...)
|
||||||
|
{
|
||||||
|
/// Elements in this tuple as $(D_PSYMBOL AliasSeq).
|
||||||
|
alias Seq = Args;
|
||||||
|
|
||||||
|
/// The length of the tuple.
|
||||||
|
enum size_t length = Args.length;
|
||||||
|
|
||||||
|
alias Seq this;
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Use Pack instead")
|
||||||
struct Tuple(Args...)
|
struct Tuple(Args...)
|
||||||
{
|
{
|
||||||
/// Elements in this tuple as $(D_PSYMBOL AliasSeq).
|
/// Elements in this tuple as $(D_PSYMBOL AliasSeq).
|
||||||
@ -246,9 +253,9 @@ struct Tuple(Args...)
|
|||||||
///
|
///
|
||||||
@nogc nothrow pure @safe unittest
|
@nogc nothrow pure @safe unittest
|
||||||
{
|
{
|
||||||
alias A = Tuple!short;
|
alias A = Pack!short;
|
||||||
alias B = Tuple!(3, 8, 9);
|
alias B = Pack!(3, 8, 9);
|
||||||
alias C = Tuple!(A, B);
|
alias C = Pack!(A, B);
|
||||||
|
|
||||||
static assert(C.length == 2);
|
static assert(C.length == 2);
|
||||||
|
|
||||||
@ -257,7 +264,7 @@ struct Tuple(Args...)
|
|||||||
static assert(B.length == 3);
|
static assert(B.length == 3);
|
||||||
static assert(B.Seq == AliasSeq!(3, 8, 9));
|
static assert(B.Seq == AliasSeq!(3, 8, 9));
|
||||||
|
|
||||||
alias D = Tuple!();
|
alias D = Pack!();
|
||||||
static assert(D.length == 0);
|
static assert(D.length == 0);
|
||||||
static assert(is(D.Seq == AliasSeq!()));
|
static assert(is(D.Seq == AliasSeq!()));
|
||||||
}
|
}
|
||||||
@ -270,7 +277,7 @@ struct Tuple(Args...)
|
|||||||
* for determining if two items are equal.
|
* for determining if two items are equal.
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* Args = Elements of this $(D_PSYMBOL Tuple).
|
* Args = Elements of this $(D_PSYMBOL Set).
|
||||||
*/
|
*/
|
||||||
struct Set(Args...)
|
struct Set(Args...)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ module tanya.net.inet;
|
|||||||
|
|
||||||
import tanya.meta.trait;
|
import tanya.meta.trait;
|
||||||
import tanya.meta.transform;
|
import tanya.meta.transform;
|
||||||
import tanya.range.primitive;
|
import tanya.range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an unsigned integer as an $(D_KEYWORD ubyte) range.
|
* Represents an unsigned integer as an $(D_KEYWORD ubyte) range.
|
||||||
|
@ -498,7 +498,7 @@ struct Linger
|
|||||||
*
|
*
|
||||||
* See_Also: $(D_PSYMBOL time).
|
* See_Also: $(D_PSYMBOL time).
|
||||||
*/
|
*/
|
||||||
@property enabled(const bool value) pure nothrow @safe @nogc
|
@property void enabled(const bool value) pure nothrow @safe @nogc
|
||||||
{
|
{
|
||||||
this.l_onoff = value;
|
this.l_onoff = value;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ module tanya.typecons;
|
|||||||
|
|
||||||
import tanya.algorithm.mutation;
|
import tanya.algorithm.mutation;
|
||||||
import tanya.format;
|
import tanya.format;
|
||||||
import tanya.meta.metafunction : AliasSeq, AliasTuple = Tuple, Map;
|
import tanya.meta.metafunction;
|
||||||
import tanya.meta.trait;
|
import tanya.meta.trait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,13 +49,13 @@ template Tuple(Specs...)
|
|||||||
static if (is(typeof(Specs[1]) == string))
|
static if (is(typeof(Specs[1]) == string))
|
||||||
{
|
{
|
||||||
alias parseSpecs
|
alias parseSpecs
|
||||||
= AliasSeq!(AliasTuple!(Specs[0], Specs[1]),
|
= AliasSeq!(Pack!(Specs[0], Specs[1]),
|
||||||
parseSpecs!(fieldCount + 1, Specs[2 .. $]));
|
parseSpecs!(fieldCount + 1, Specs[2 .. $]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alias parseSpecs
|
alias parseSpecs
|
||||||
= AliasSeq!(AliasTuple!(Specs[0]),
|
= AliasSeq!(Pack!(Specs[0]),
|
||||||
parseSpecs!(fieldCount + 1, Specs[1 .. $]));
|
parseSpecs!(fieldCount + 1, Specs[1 .. $]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user