ICU-13634 Merging trunk to branch

X-SVN-Rev: 41176
This commit is contained in:
Shane Carr 2018-03-30 07:17:11 +00:00
commit af4435133a
15 changed files with 721 additions and 69 deletions

View File

@ -2559,6 +2559,11 @@ metaZones:table(nofallback){
{
"Casey",
"2016-10-21 16:00",
"2016-03-10 17:00",
}
{
"Australia_Western",
"2018-03-10 17:00",
"9999-12-31 23:59",
}
}

View File

@ -156,7 +156,6 @@ windowsZones:table(nofallback){
}
"Central Pacific Standard Time"{
001{"Pacific/Guadalcanal"}
AQ{"Antarctica/Casey"}
AU{"Antarctica/Macquarie"}
FM{"Pacific/Ponape Pacific/Kosrae"}
NC{"Pacific/Noumea"}
@ -731,6 +730,7 @@ windowsZones:table(nofallback){
}
"W. Australia Standard Time"{
001{"Australia/Perth"}
AQ{"Antarctica/Casey"}
AU{"Australia/Perth"}
}
"W. Central Africa Standard Time"{

View File

@ -3,17 +3,17 @@
// License & terms of use: http://www.unicode.org/copyright.html#License
//---------------------------------------------------------
// Build tool: tz2icu
// Build date: Tue Jan 23 20:51:55 2018
// Build date: Wed Mar 28 09:18:39 2018
// tz database: ftp://ftp.iana.org/tz/
// tz version: 2018c
// ICU version: 60.1
// tz version: 2018d
// ICU version: 61.1
//---------------------------------------------------------
// >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! <<
// >> !!! >>> DO NOT EDIT <<< !!! <<
//---------------------------------------------------------
zoneinfo64:table(nofallback) {
TZVersion { "2018c" }
TZVersion { "2018d" }
Zones:array {
/* ACT */ :int { 354 } //Z#0
/* AET */ :int { 366 } //Z#1
@ -44,7 +44,7 @@ zoneinfo64:table(nofallback) {
/* Africa/Bangui */ :int { 36 } //Z#12
/* Africa/Banjul */ :int { 5 } //Z#13
/* Africa/Bissau */ :table {
trans:intvector { -1830380260, 157770000 }
trans:intvector { -1830380400, 157770000 }
typeOffsets:intvector { -3740, 0, -3600, 0, 0, 0 }
typeMap:bin { "0102" }
} //Z#14
@ -156,7 +156,7 @@ zoneinfo64:table(nofallback) {
/* Africa/Porto-Novo */ :int { 36 } //Z#53
/* Africa/Sao_Tome */ :table {
transPre32:intvector { -1, 1581055280 }
trans:intvector { -1830381795, 1514768400 }
trans:intvector { -1830384000, 1514768400 }
typeOffsets:intvector { 1616, 0, -2205, 0, 0, 0, 3600, 0 }
typeMap:bin { "010203" }
} //Z#54
@ -534,8 +534,8 @@ zoneinfo64:table(nofallback) {
} //Z#121
/* America/Grand_Turk */ :table {
transPre32:intvector { -1, 1770462768 }
trans:intvector { -1827687169, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 }
typeOffsets:intvector { -17072, 0, -18431, 0, -18000, 0, -18000, 3600, -14400, 0 }
trans:intvector { -1827687170, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 }
typeOffsets:intvector { -17072, 0, -18430, 0, -18000, 0, -18000, 3600, -14400, 0 }
typeMap:bin { "010203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203040302" }
finalRule { "US" }
finalRaw:int { -18000 }
@ -675,8 +675,8 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2008 }
} //Z#141
/* America/Jamaica */ :table {
trans:intvector { -1827687169, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 }
typeOffsets:intvector { -18431, 0, -18000, 0, -18000, 3600 }
trans:intvector { -1827687170, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 }
typeOffsets:intvector { -18430, 0, -18000, 0, -18000, 3600 }
typeMap:bin { "010201020102010201020102010201020102010201" }
links:intvector { 142, 528 }
} //Z#142
@ -836,9 +836,9 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2003 }
} //Z#168
/* America/Montevideo */ :table {
trans:intvector { -1567455316, -1459542600, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1046637000, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -952288200, -938984400, -920838600, -907534800, -896819400, -883602000, -853619400, -845848800, -334789200, -319672800, -314226000, -309996000, -149720400, -134604000, -118270800, -100044000, -86821200, -68508000, -50446800, -34119000, -18910800, -2583000, 12625200, 28953000, 72932400, 82692000, 132116400, 156911400, 212983200, 250052400, 260244000, 307594800, 325994400, 566449200, 574308000, 597812400, 605671200, 625633200, 636516000, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 }
typeOffsets:intvector { -13484, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600 }
typeMap:bin { "0102010201020102010201020102010201020102010201020105030503050305030503050304030403040305030405030503050305030503050305030503050305030503050305030503050305030503050305030503" }
trans:intvector { -1567455309, -1459627200, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1047241800, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -954707400, -938984400, -920838600, -907534800, -896819400, -853621200, -845847000, -334789200, -319671000, -314226000, -309996000, -149720400, -134604000, -50446800, -34205400, 9860400, 14176800, 72846000, 80100000, 127278000, 132111000, 147234600, 156913200, 165376800, 219812400, 226461600, 250052400, 257911200, 282711600, 289360800, 294202800, 322020000, 566449200, 573012000, 597812400, 605066400, 625633200, 635911200, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 }
typeOffsets:intvector { -13491, 0, -14400, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600, -10800, 5400 }
typeMap:bin { "01030203020302030203020302030203020302030203020305040504060406040504060406040705040604060406040604060406040604060406040604060406040604060406040604060406040604060406040604" }
} //Z#169
/* America/Montreal */ :int { 217 } //Z#170
/* America/Montserrat */ :int { 186 } //Z#171
@ -1182,9 +1182,9 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2008 }
} //Z#224
/* Antarctica/Casey */ :table {
trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600 }
trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600, 1520701200 }
typeOffsets:intvector { 0, 0, 28800, 0, 39600, 0 }
typeMap:bin { "010201020102" }
typeMap:bin { "01020102010201" }
} //Z#225
/* Antarctica/Davis */ :table {
trans:intvector { -409190400, -163062000, -28857600, 1255806000, 1268251200, 1319742000, 1329854400 }
@ -1498,7 +1498,7 @@ zoneinfo64:table(nofallback) {
/* Asia/Kuwait */ :int { 308 } //Z#290
/* Asia/Macao */ :int { 292 } //Z#291
/* Asia/Macau */ :table {
trans:intvector { -1830411260, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 }
trans:intvector { -1830412800, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 }
typeOffsets:intvector { 27260, 0, 28800, 0, 28800, 3600 }
typeMap:bin { "0102010201020102010201020102010201020102010201020102010201020102010201020102010201" }
links:intvector { 291, 292 }
@ -1709,7 +1709,7 @@ zoneinfo64:table(nofallback) {
} //Z#335
/* Atlantic/Azores */ :table {
transPre32:intvector { -1, 1581063056 }
trans:intvector { -1830377128, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
trans:intvector { -1830376800, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -6160, 0, -7200, 0, -7200, 3600, -7200, 7200, -6872, 0, -3600, 0, -3600, 3600, 0, 0 }
typeMap:bin { "04010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010506050605060506050605060506050605060506050605060506050605060506070605060506050605" }
finalRule { "EU" }
@ -1733,7 +1733,7 @@ zoneinfo64:table(nofallback) {
finalYear:int { 1997 }
} //Z#338
/* Atlantic/Cape_Verde */ :table {
trans:intvector { -1988144756, -862610400, -764118000, 186120000 }
trans:intvector { -1830376800, -862610400, -764118000, 186120000 }
typeOffsets:intvector { -5644, 0, -7200, 0, -7200, 3600, -3600, 0 }
typeMap:bin { "01020103" }
} //Z#339
@ -1749,7 +1749,7 @@ zoneinfo64:table(nofallback) {
} //Z#341
/* Atlantic/Jan_Mayen */ :int { 473 } //Z#342
/* Atlantic/Madeira */ :table {
trans:intvector { -1830379944, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
trans:intvector { -1830380400, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -4056, 0, -3600, 0, -3600, 3600, -3600, 7200, 0, 0, 0, 3600 }
typeMap:bin { "010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010405040504050405040504050405040504050405040504050405040504050405040504050405040504" }
finalRule { "EU" }
@ -2201,7 +2201,7 @@ zoneinfo64:table(nofallback) {
typeMap:bin { "010304030403040304030403040304030403020102010302010201020102010201020102010201020102010201020102010201020102010201020102010301" }
} //Z#461
/* Europe/Lisbon */ :table {
trans:intvector { -1830381795, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
trans:intvector { -1830384000, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -2205, 0, 0, 0, 0, 3600, 0, 7200, 3600, 0, 3600, 3600 }
typeMap:bin { "01020102010201020102010201020102010201020102010201020102010201020102010201020102010201020302010203020102030201020302010201020102010201020102010201020102010201020102010201020102010201020102010201040102010201020102010201020102010201020102010201020102010201020102040504050405040201" }
finalRule { "EU" }
@ -2605,7 +2605,7 @@ zoneinfo64:table(nofallback) {
} //Z#556
/* Pacific/Enderbury */ :table {
transPre32:intvector { -1, 2117555556 }
trans:intvector { 307627200, 788958000 }
trans:intvector { 307627200, 788871600 }
typeOffsets:intvector { -41060, 0, -43200, 0, -39600, 0, 46800, 0 }
typeMap:bin { "010203" }
} //Z#557
@ -2660,7 +2660,7 @@ zoneinfo64:table(nofallback) {
/* Pacific/Johnston */ :int { 565 } //Z#566
/* Pacific/Kiritimati */ :table {
transPre32:intvector { -1, 2117552256 }
trans:intvector { 307622400, 788954400 }
trans:intvector { 307622400, 788868000 }
typeOffsets:intvector { -37760, 0, -38400, 0, -36000, 0, 50400, 0 }
typeMap:bin { "010203" }
} //Z#567
@ -3142,7 +3142,7 @@ zoneinfo64:table(nofallback) {
8, -30, -1, 7200, 1, 3, 1, -1, 7200, 1, 3600
} //_#21
Palestine:intvector {
2, -31, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600
2, 22, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600
} //_#22
Para:intvector {
9, 1, -1, 0, 0, 2, 22, -1, 0, 0, 3600

View File

@ -104,7 +104,8 @@ number_integerwidth.o number_longnames.o number_modifiers.o number_notation.o \
number_padding.o number_patternmodifier.o number_patternstring.o \
number_rounding.o number_scientific.o number_stringbuilder.o \
double-conversion.o double-conversion-bignum-dtoa.o double-conversion-bignum.o \
double-conversion-cached-powers.o double-conversion-diy-fp.o double-conversion-fast-dtoa.o \
double-conversion-cached-powers.o double-conversion-diy-fp.o \
double-conversion-fast-dtoa.o double-conversion-strtod.o \
numparse_stringsegment.o numparse_unisets.o numparse_parsednumber.o \
numparse_impl.o numparse_symbols.o numparse_decimal.o numparse_scientific.o \
numparse_currency.o numparse_affixes.o numparse_compositions.o numparse_validators.o \

View File

@ -0,0 +1,574 @@
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// From the double-conversion library. Original license:
//
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include <stdarg.h>
#include <limits.h>
// ICU PATCH: Customize header file paths for ICU.
// The file fixed-dtoa.h is not needed.
#include "double-conversion-strtod.h"
#include "double-conversion-bignum.h"
#include "double-conversion-cached-powers.h"
#include "double-conversion-ieee.h"
// ICU PATCH: Wrap in ICU namespace
U_NAMESPACE_BEGIN
namespace double_conversion {
// 2^53 = 9007199254740992.
// Any integer with at most 15 decimal digits will hence fit into a double
// (which has a 53bit significand) without loss of precision.
static const int kMaxExactDoubleIntegerDecimalDigits = 15;
// 2^64 = 18446744073709551616 > 10^19
static const int kMaxUint64DecimalDigits = 19;
// Max double: 1.7976931348623157 x 10^308
// Min non-zero double: 4.9406564584124654 x 10^-324
// Any x >= 10^309 is interpreted as +infinity.
// Any x <= 10^-324 is interpreted as 0.
// Note that 2.5e-324 (despite being smaller than the min double) will be read
// as non-zero (equal to the min non-zero double).
static const int kMaxDecimalPower = 309;
static const int kMinDecimalPower = -324;
// 2^64 = 18446744073709551616
static const uint64_t kMaxUint64 = UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
static const double exact_powers_of_ten[] = {
1.0, // 10^0
10.0,
100.0,
1000.0,
10000.0,
100000.0,
1000000.0,
10000000.0,
100000000.0,
1000000000.0,
10000000000.0, // 10^10
100000000000.0,
1000000000000.0,
10000000000000.0,
100000000000000.0,
1000000000000000.0,
10000000000000000.0,
100000000000000000.0,
1000000000000000000.0,
10000000000000000000.0,
100000000000000000000.0, // 10^20
1000000000000000000000.0,
// 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22
10000000000000000000000.0
};
static const int kExactPowersOfTenSize = ARRAY_SIZE(exact_powers_of_ten);
// Maximum number of significant digits in the decimal representation.
// In fact the value is 772 (see conversions.cc), but to give us some margin
// we round up to 780.
static const int kMaxSignificantDecimalDigits = 780;
static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
for (int i = 0; i < buffer.length(); i++) {
if (buffer[i] != '0') {
return buffer.SubVector(i, buffer.length());
}
}
return Vector<const char>(buffer.start(), 0);
}
static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
for (int i = buffer.length() - 1; i >= 0; --i) {
if (buffer[i] != '0') {
return buffer.SubVector(0, i + 1);
}
}
return Vector<const char>(buffer.start(), 0);
}
static void CutToMaxSignificantDigits(Vector<const char> buffer,
int exponent,
char* significant_buffer,
int* significant_exponent) {
for (int i = 0; i < kMaxSignificantDecimalDigits - 1; ++i) {
significant_buffer[i] = buffer[i];
}
// The input buffer has been trimmed. Therefore the last digit must be
// different from '0'.
ASSERT(buffer[buffer.length() - 1] != '0');
// Set the last digit to be non-zero. This is sufficient to guarantee
// correct rounding.
significant_buffer[kMaxSignificantDecimalDigits - 1] = '1';
*significant_exponent =
exponent + (buffer.length() - kMaxSignificantDecimalDigits);
}
// Trims the buffer and cuts it to at most kMaxSignificantDecimalDigits.
// If possible the input-buffer is reused, but if the buffer needs to be
// modified (due to cutting), then the input needs to be copied into the
// buffer_copy_space.
static void TrimAndCut(Vector<const char> buffer, int exponent,
char* buffer_copy_space, int space_size,
Vector<const char>* trimmed, int* updated_exponent) {
Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
exponent += left_trimmed.length() - right_trimmed.length();
if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
(void) space_size; // Mark variable as used.
ASSERT(space_size >= kMaxSignificantDecimalDigits);
CutToMaxSignificantDigits(right_trimmed, exponent,
buffer_copy_space, updated_exponent);
*trimmed = Vector<const char>(buffer_copy_space,
kMaxSignificantDecimalDigits);
} else {
*trimmed = right_trimmed;
*updated_exponent = exponent;
}
}
// Reads digits from the buffer and converts them to a uint64.
// Reads in as many digits as fit into a uint64.
// When the string starts with "1844674407370955161" no further digit is read.
// Since 2^64 = 18446744073709551616 it would still be possible read another
// digit if it was less or equal than 6, but this would complicate the code.
static uint64_t ReadUint64(Vector<const char> buffer,
int* number_of_read_digits) {
uint64_t result = 0;
int i = 0;
while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
int digit = buffer[i++] - '0';
ASSERT(0 <= digit && digit <= 9);
result = 10 * result + digit;
}
*number_of_read_digits = i;
return result;
}
// Reads a DiyFp from the buffer.
// The returned DiyFp is not necessarily normalized.
// If remaining_decimals is zero then the returned DiyFp is accurate.
// Otherwise it has been rounded and has error of at most 1/2 ulp.
static void ReadDiyFp(Vector<const char> buffer,
DiyFp* result,
int* remaining_decimals) {
int read_digits;
uint64_t significand = ReadUint64(buffer, &read_digits);
if (buffer.length() == read_digits) {
*result = DiyFp(significand, 0);
*remaining_decimals = 0;
} else {
// Round the significand.
if (buffer[read_digits] >= '5') {
significand++;
}
// Compute the binary exponent.
int exponent = 0;
*result = DiyFp(significand, exponent);
*remaining_decimals = buffer.length() - read_digits;
}
}
static bool DoubleStrtod(Vector<const char> trimmed,
int exponent,
double* result) {
#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
// On x86 the floating-point stack can be 64 or 80 bits wide. If it is
// 80 bits wide (as is the case on Linux) then double-rounding occurs and the
// result is not accurate.
// We know that Windows32 uses 64 bits and is therefore accurate.
// Note that the ARM simulator is compiled for 32bits. It therefore exhibits
// the same problem.
return false;
#endif
if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
int read_digits;
// The trimmed input fits into a double.
// If the 10^exponent (resp. 10^-exponent) fits into a double too then we
// can compute the result-double simply by multiplying (resp. dividing) the
// two numbers.
// This is possible because IEEE guarantees that floating-point operations
// return the best possible approximation.
if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
// 10^-exponent fits into a double.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
ASSERT(read_digits == trimmed.length());
*result /= exact_powers_of_ten[-exponent];
return true;
}
if (0 <= exponent && exponent < kExactPowersOfTenSize) {
// 10^exponent fits into a double.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
ASSERT(read_digits == trimmed.length());
*result *= exact_powers_of_ten[exponent];
return true;
}
int remaining_digits =
kMaxExactDoubleIntegerDecimalDigits - trimmed.length();
if ((0 <= exponent) &&
(exponent - remaining_digits < kExactPowersOfTenSize)) {
// The trimmed string was short and we can multiply it with
// 10^remaining_digits. As a result the remaining exponent now fits
// into a double too.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
ASSERT(read_digits == trimmed.length());
*result *= exact_powers_of_ten[remaining_digits];
*result *= exact_powers_of_ten[exponent - remaining_digits];
return true;
}
}
return false;
}
// Returns 10^exponent as an exact DiyFp.
// The given exponent must be in the range [1; kDecimalExponentDistance[.
static DiyFp AdjustmentPowerOfTen(int exponent) {
ASSERT(0 < exponent);
ASSERT(exponent < PowersOfTenCache::kDecimalExponentDistance);
// Simply hardcode the remaining powers for the given decimal exponent
// distance.
ASSERT(PowersOfTenCache::kDecimalExponentDistance == 8);
switch (exponent) {
case 1: return DiyFp(UINT64_2PART_C(0xa0000000, 00000000), -60);
case 2: return DiyFp(UINT64_2PART_C(0xc8000000, 00000000), -57);
case 3: return DiyFp(UINT64_2PART_C(0xfa000000, 00000000), -54);
case 4: return DiyFp(UINT64_2PART_C(0x9c400000, 00000000), -50);
case 5: return DiyFp(UINT64_2PART_C(0xc3500000, 00000000), -47);
case 6: return DiyFp(UINT64_2PART_C(0xf4240000, 00000000), -44);
case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40);
default:
UNREACHABLE();
}
}
// If the function returns true then the result is the correct double.
// Otherwise it is either the correct double or the double that is just below
// the correct double.
static bool DiyFpStrtod(Vector<const char> buffer,
int exponent,
double* result) {
DiyFp input;
int remaining_decimals;
ReadDiyFp(buffer, &input, &remaining_decimals);
// Since we may have dropped some digits the input is not accurate.
// If remaining_decimals is different than 0 than the error is at most
// .5 ulp (unit in the last place).
// We don't want to deal with fractions and therefore keep a common
// denominator.
const int kDenominatorLog = 3;
const int kDenominator = 1 << kDenominatorLog;
// Move the remaining decimals into the exponent.
exponent += remaining_decimals;
uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
int old_e = input.e();
input.Normalize();
error <<= old_e - input.e();
ASSERT(exponent <= PowersOfTenCache::kMaxDecimalExponent);
if (exponent < PowersOfTenCache::kMinDecimalExponent) {
*result = 0.0;
return true;
}
DiyFp cached_power;
int cached_decimal_exponent;
PowersOfTenCache::GetCachedPowerForDecimalExponent(exponent,
&cached_power,
&cached_decimal_exponent);
if (cached_decimal_exponent != exponent) {
int adjustment_exponent = exponent - cached_decimal_exponent;
DiyFp adjustment_power = AdjustmentPowerOfTen(adjustment_exponent);
input.Multiply(adjustment_power);
if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
// The product of input with the adjustment power fits into a 64 bit
// integer.
ASSERT(DiyFp::kSignificandSize == 64);
} else {
// The adjustment power is exact. There is hence only an error of 0.5.
error += kDenominator / 2;
}
}
input.Multiply(cached_power);
// The error introduced by a multiplication of a*b equals
// error_a + error_b + error_a*error_b/2^64 + 0.5
// Substituting a with 'input' and b with 'cached_power' we have
// error_b = 0.5 (all cached powers have an error of less than 0.5 ulp),
// error_ab = 0 or 1 / kDenominator > error_a*error_b/ 2^64
int error_b = kDenominator / 2;
int error_ab = (error == 0 ? 0 : 1); // We round up to 1.
int fixed_error = kDenominator / 2;
error += error_b + error_ab + fixed_error;
old_e = input.e();
input.Normalize();
error <<= old_e - input.e();
// See if the double's significand changes if we add/subtract the error.
int order_of_magnitude = DiyFp::kSignificandSize + input.e();
int effective_significand_size =
Double::SignificandSizeForOrderOfMagnitude(order_of_magnitude);
int precision_digits_count =
DiyFp::kSignificandSize - effective_significand_size;
if (precision_digits_count + kDenominatorLog >= DiyFp::kSignificandSize) {
// This can only happen for very small denormals. In this case the
// half-way multiplied by the denominator exceeds the range of an uint64.
// Simply shift everything to the right.
int shift_amount = (precision_digits_count + kDenominatorLog) -
DiyFp::kSignificandSize + 1;
input.set_f(input.f() >> shift_amount);
input.set_e(input.e() + shift_amount);
// We add 1 for the lost precision of error, and kDenominator for
// the lost precision of input.f().
error = (error >> shift_amount) + 1 + kDenominator;
precision_digits_count -= shift_amount;
}
// We use uint64_ts now. This only works if the DiyFp uses uint64_ts too.
ASSERT(DiyFp::kSignificandSize == 64);
ASSERT(precision_digits_count < 64);
uint64_t one64 = 1;
uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
uint64_t precision_bits = input.f() & precision_bits_mask;
uint64_t half_way = one64 << (precision_digits_count - 1);
precision_bits *= kDenominator;
half_way *= kDenominator;
DiyFp rounded_input(input.f() >> precision_digits_count,
input.e() + precision_digits_count);
if (precision_bits >= half_way + error) {
rounded_input.set_f(rounded_input.f() + 1);
}
// If the last_bits are too close to the half-way case than we are too
// inaccurate and round down. In this case we return false so that we can
// fall back to a more precise algorithm.
*result = Double(rounded_input).value();
if (half_way - error < precision_bits && precision_bits < half_way + error) {
// Too imprecise. The caller will have to fall back to a slower version.
// However the returned number is guaranteed to be either the correct
// double, or the next-lower double.
return false;
} else {
return true;
}
}
// Returns
// - -1 if buffer*10^exponent < diy_fp.
// - 0 if buffer*10^exponent == diy_fp.
// - +1 if buffer*10^exponent > diy_fp.
// Preconditions:
// buffer.length() + exponent <= kMaxDecimalPower + 1
// buffer.length() + exponent > kMinDecimalPower
// buffer.length() <= kMaxDecimalSignificantDigits
static int CompareBufferWithDiyFp(Vector<const char> buffer,
int exponent,
DiyFp diy_fp) {
ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
ASSERT(buffer.length() + exponent > kMinDecimalPower);
ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
// Make sure that the Bignum will be able to hold all our numbers.
// Our Bignum implementation has a separate field for exponents. Shifts will
// consume at most one bigit (< 64 bits).
// ln(10) == 3.3219...
ASSERT(((kMaxDecimalPower + 1) * 333 / 100) < Bignum::kMaxSignificantBits);
Bignum buffer_bignum;
Bignum diy_fp_bignum;
buffer_bignum.AssignDecimalString(buffer);
diy_fp_bignum.AssignUInt64(diy_fp.f());
if (exponent >= 0) {
buffer_bignum.MultiplyByPowerOfTen(exponent);
} else {
diy_fp_bignum.MultiplyByPowerOfTen(-exponent);
}
if (diy_fp.e() > 0) {
diy_fp_bignum.ShiftLeft(diy_fp.e());
} else {
buffer_bignum.ShiftLeft(-diy_fp.e());
}
return Bignum::Compare(buffer_bignum, diy_fp_bignum);
}
// Returns true if the guess is the correct double.
// Returns false, when guess is either correct or the next-lower double.
static bool ComputeGuess(Vector<const char> trimmed, int exponent,
double* guess) {
if (trimmed.length() == 0) {
*guess = 0.0;
return true;
}
if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) {
*guess = Double::Infinity();
return true;
}
if (exponent + trimmed.length() <= kMinDecimalPower) {
*guess = 0.0;
return true;
}
if (DoubleStrtod(trimmed, exponent, guess) ||
DiyFpStrtod(trimmed, exponent, guess)) {
return true;
}
if (*guess == Double::Infinity()) {
return true;
}
return false;
}
double Strtod(Vector<const char> buffer, int exponent) {
char copy_buffer[kMaxSignificantDecimalDigits];
Vector<const char> trimmed;
int updated_exponent;
TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
&trimmed, &updated_exponent);
exponent = updated_exponent;
double guess;
bool is_correct = ComputeGuess(trimmed, exponent, &guess);
if (is_correct) return guess;
DiyFp upper_boundary = Double(guess).UpperBoundary();
int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
if (comparison < 0) {
return guess;
} else if (comparison > 0) {
return Double(guess).NextDouble();
} else if ((Double(guess).Significand() & 1) == 0) {
// Round towards even.
return guess;
} else {
return Double(guess).NextDouble();
}
}
float Strtof(Vector<const char> buffer, int exponent) {
char copy_buffer[kMaxSignificantDecimalDigits];
Vector<const char> trimmed;
int updated_exponent;
TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
&trimmed, &updated_exponent);
exponent = updated_exponent;
double double_guess;
bool is_correct = ComputeGuess(trimmed, exponent, &double_guess);
float float_guess = static_cast<float>(double_guess);
if (float_guess == double_guess) {
// This shortcut triggers for integer values.
return float_guess;
}
// We must catch double-rounding. Say the double has been rounded up, and is
// now a boundary of a float, and rounds up again. This is why we have to
// look at previous too.
// Example (in decimal numbers):
// input: 12349
// high-precision (4 digits): 1235
// low-precision (3 digits):
// when read from input: 123
// when rounded from high precision: 124.
// To do this we simply look at the neigbors of the correct result and see
// if they would round to the same float. If the guess is not correct we have
// to look at four values (since two different doubles could be the correct
// double).
double double_next = Double(double_guess).NextDouble();
double double_previous = Double(double_guess).PreviousDouble();
float f1 = static_cast<float>(double_previous);
float f2 = float_guess;
float f3 = static_cast<float>(double_next);
float f4;
if (is_correct) {
f4 = f3;
} else {
double double_next2 = Double(double_next).NextDouble();
f4 = static_cast<float>(double_next2);
}
(void) f2; // Mark variable as used.
ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
// If the guess doesn't lie near a single-precision boundary we can simply
// return its float-value.
if (f1 == f4) {
return float_guess;
}
ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
(f1 == f2 && f2 != f3 && f3 == f4) ||
(f1 == f2 && f2 == f3 && f3 != f4));
// guess and next are the two possible canditates (in the same way that
// double_guess was the lower candidate for a double-precision guess).
float guess = f1;
float next = f4;
DiyFp upper_boundary;
if (guess == 0.0f) {
float min_float = 1e-45f;
upper_boundary = Double(static_cast<double>(min_float) / 2).AsDiyFp();
} else {
upper_boundary = Single(guess).UpperBoundary();
}
int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
if (comparison < 0) {
return guess;
} else if (comparison > 0) {
return next;
} else if ((Single(guess).Significand() & 1) == 0) {
// Round towards even.
return guess;
} else {
return next;
}
}
} // namespace double_conversion
// ICU PATCH: Close ICU namespace
U_NAMESPACE_END
#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING

View File

@ -0,0 +1,63 @@
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// From the double-conversion library. Original license:
//
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#ifndef DOUBLE_CONVERSION_STRTOD_H_
#define DOUBLE_CONVERSION_STRTOD_H_
// ICU PATCH: Customize header file paths for ICU.
#include "double-conversion-utils.h"
// ICU PATCH: Wrap in ICU namespace
U_NAMESPACE_BEGIN
namespace double_conversion {
// The buffer must only contain digits in the range [0-9]. It must not
// contain a dot or a sign. It must not start with '0', and must not be empty.
double Strtod(Vector<const char> buffer, int exponent);
// The buffer must only contain digits in the range [0-9]. It must not
// contain a dot or a sign. It must not start with '0', and must not be empty.
float Strtof(Vector<const char> buffer, int exponent);
} // namespace double_conversion
// ICU PATCH: Close ICU namespace
U_NAMESPACE_END
#endif // DOUBLE_CONVERSION_STRTOD_H_
#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING

View File

@ -38,13 +38,14 @@
#include <math.h>
// ICU PATCH: Customize header file paths for ICU.
// The files fixed-dtoa.h and strtod.h are not needed.
// The file fixed-dtoa.h is not needed.
#include "double-conversion.h"
#include "double-conversion-bignum-dtoa.h"
#include "double-conversion-fast-dtoa.h"
#include "double-conversion-ieee.h"
#include "double-conversion-strtod.h"
#include "double-conversion-utils.h"
// ICU PATCH: Wrap in ICU namespace
@ -431,7 +432,6 @@ void DoubleToStringConverter::DoubleToAscii(double v,
}
#if 0 // not needed for ICU
// Consumes the given substring from the iterator.
// Returns false, if the substring does not match.
template <class Iterator>
@ -469,6 +469,7 @@ static const uc16 kWhitespaceTable16[] = {
static const int kWhitespaceTable16Length = ARRAY_SIZE(kWhitespaceTable16);
static bool isWhitespace(int x) {
if (x < 128) {
for (int i = 0; i < kWhitespaceTable7Length; i++) {
@ -647,7 +648,6 @@ static double RadixStringToIeee(Iterator* current,
return Double(DiyFp(number, exponent)).value();
}
template <class Iterator>
double StringToDoubleConverter::StringToIeee(
Iterator input,
@ -996,7 +996,6 @@ float StringToDoubleConverter::StringToFloat(
return static_cast<float>(StringToIeee(buffer, length, false,
processed_characters_count));
}
#endif // not needed for ICU
} // namespace double_conversion

View File

@ -391,6 +391,7 @@ class DoubleToStringConverter {
const int decimal_in_shortest_high_;
const int max_leading_padding_zeroes_in_precision_mode_;
const int max_trailing_padding_zeroes_in_precision_mode_;
#endif // not needed for ICU
DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
};
@ -554,7 +555,6 @@ class StringToDoubleConverter {
int* processed_characters_count) const;
DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
#endif // not needed for ICU
};
} // namespace double_conversion

View File

@ -239,6 +239,7 @@
<ClCompile Include="double-conversion-cached-powers.cpp" />
<ClCompile Include="double-conversion-diy-fp.cpp" />
<ClCompile Include="double-conversion-fast-dtoa.cpp" />
<ClCompile Include="double-conversion-strtod.cpp" />
<ClCompile Include="double-conversion.cpp" />
<ClCompile Include="dtfmtsym.cpp" />
<ClCompile Include="dtitvfmt.cpp" />

View File

@ -171,6 +171,9 @@
<ClCompile Include="double-conversion-fast-dtoa.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="double-conversion-strtod.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="double-conversion.cpp">
<Filter>formatting</Filter>
</ClCompile>

View File

@ -23,6 +23,7 @@ using namespace icu::number;
using namespace icu::number::impl;
using icu::double_conversion::DoubleToStringConverter;
using icu::double_conversion::StringToDoubleConverter;
namespace {
@ -528,38 +529,11 @@ double DecimalQuantity::toDouble() const {
return isNegative() ? -INFINITY : INFINITY;
}
int64_t tempLong = 0L;
int32_t lostDigits = precision - (precision < 17 ? precision : 17);
for (int shift = precision - 1; shift >= lostDigits; shift--) {
tempLong = tempLong * 10 + getDigitPos(shift);
}
double result = static_cast<double>(tempLong);
int32_t _scale = scale + lostDigits;
if (_scale >= 0) {
// 1e22 is the largest exact double.
int32_t i = _scale;
for (; i >= 22; i -= 22) {
result *= 1e22;
if (uprv_isInfinite(result)) {
// Further multiplications will not be productive.
i = 0;
break;
}
}
result *= DOUBLE_MULTIPLIERS[i];
} else {
// 1e22 is the largest exact double.
int32_t i = _scale;
for (; i <= -22; i += 22) {
result /= 1e22;
if (result == 0.0) {
// Further divisions will not be productive.
i = 0;
break;
}
}
result /= DOUBLE_MULTIPLIERS[-i];
}
// We are processing well-formed input, so we don't need any special options to StringToDoubleConverter.
StringToDoubleConverter converter(0, 0, 0, "", "");
UnicodeString numberString = toNumberString();
int32_t count;
double result = converter.StringToDouble(reinterpret_cast<const uint16_t*>(numberString.getBuffer()), numberString.length(), &count);
if (isNegative()) { result = -result; }
return result;
}
@ -1095,13 +1069,25 @@ UnicodeString DecimalQuantity::toString() const {
}
UnicodeString DecimalQuantity::toNumberString() const {
// 13 should hold both the largest and the smallest int32_t plus exponent separator and NUL
MaybeStackArray<char, 30> digits(precision + 13);
UnicodeString result;
for (int32_t i = 0; i < precision; i++) {
digits[i] = getDigitPos(precision - i - 1) + '0';
result.append(u'0' + getDigitPos(precision - i - 1));
}
snprintf(digits.getAlias() + precision, 13, "E%d", scale);
return UnicodeString(digits.getAlias(), -1, US_INV);
result.append(u'E');
int32_t _scale = scale;
if (_scale < 0) {
_scale *= -1;
result.append(u'-');
}
if (_scale == 0) {
result.append(u'0');
}
int32_t insertIndex = result.length();
while (_scale > 0) {
result.insert(insertIndex, u'0' + (_scale % 10));
_scale /= 10;
}
return result;
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View File

@ -119,6 +119,7 @@ class DecimalQuantityTest : public IntlTest {
void testConvertToAccurateDouble();
void testUseApproximateDoubleWhenAble();
void testHardDoubleConversion();
void testToDouble();
void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = 0);

View File

@ -21,6 +21,7 @@ void DecimalQuantityTest::runIndexedTest(int32_t index, UBool exec, const char *
TESTCASE_AUTO(testConvertToAccurateDouble);
TESTCASE_AUTO(testUseApproximateDoubleWhenAble);
TESTCASE_AUTO(testHardDoubleConversion);
TESTCASE_AUTO(testToDouble);
TESTCASE_AUTO_END;
}
@ -294,4 +295,20 @@ void DecimalQuantityTest::testHardDoubleConversion() {
}
}
void DecimalQuantityTest::testToDouble() {
static const struct TestCase {
const char* input; // char* for the decNumber constructor
double expected;
} cases[] = {
{ "0", 0.0 },
{ "-3.142E-271", -3.142e-271 } };
for (auto& cas : cases) {
DecimalQuantity q;
q.setToDecNumber({cas.input, -1});
double actual = q.toDouble();
assertEquals("Doubles should exactly equal", cas.expected, actual);
}
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View File

@ -636,6 +636,8 @@ public abstract class DecimalQuantity_AbstractBCD implements DecimalQuantity {
return isNegative() ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
}
// TODO: Do like in C++ and use a library function to perform this conversion?
long tempLong = 0L;
int lostDigits = precision - Math.min(precision, 17);
for (int shift = precision - 1; shift >= lostDigits; shift--) {

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d95bab418a9b465de9415e4e9f878330dbc5f7d6cddc416c492ad871f514fa82
size 92763
oid sha256:76943e3da6a2668026bbc4f0cfcf4657b70301f547cbb912729da7e9c01d69da
size 92792