index.html
83.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>An XSD datatype for IEEE floating-point decimal</title>
<style type="text/css">
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
ol.enumar { list-style-type: decimal; }
ol.enumla { list-style-type: lower-alpha; }
ol.enumlr { list-style-type: lower-roman; }
ol.enumua { list-style-type: upper-alpha; }
ol.enumur { list-style-type: upper-roman; }
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
div.odiff-nsq-add { background-color: #DFDFDF; }
div.odiff-nsq-del { display: none; background-color: #FFDFDF }
div.idiff-nsq-del { display: none; text-decoration: line-through }
div.odiff-nsq-chg { background-color: #DFDFDF }
div.diff-nsq-off { }
span.odiff-nsq-add { background-color: #DFDFDF; }
span.diff-nsq-add { background-color: #DFDFDF; }
span.odiff-nsq-del { display: none; background-color: #FFDFDF }
span.idiff-nsq-del { display: none; text-decoration: line-through }
span.diff-nsq-del { display: none; background-color: #FFDFDF ; text-decoration: line-through }
span.odiff-nsq-chg { background-color: #DFDFDF }
span.diff-nsq-chg { background-color: #DFFFDF }
span.diff-nsq-off { }
td.odiff-nsq-add { background-color: #DFDFDF; }
td.odiff-nsq-del { display: none; background-color: #FFDFDF }
td.odiff-nsq-chg { background-color: #DFDFDF }
td.diff-nsq-off { }
table { width: 100%; }
img { color: white; border: none }
span.rfc2119 { font-variant: small-caps }
span.nav { float: right}
span.arrow { font-style: normal; font-weight: bold }
span.enumval { font-style: italic; font-weight: bold }
code { font-family: monospace; font-size: 100%}
span.propdef { font-weight: bold; font-family: monospace }
span.termdef {color: #850021}
div.termdef {color: #850021}
a.termref:visited, a.termref:link {font-family: sans-serif;
font-style: normal;
color: black;
text-decoration: none }
a.eltref:visited, a.eltref:link { font-family: sans-serif;
color: black;
text-decoration: none }
a.propref:visited, a.xpropref:visited, a.propref:link, a.xpropref:link { color: black; text-decoration: none;
font-family: sans-serif }
div.component {border: 2px solid black; margin-top: 1ex}
span.propdef { font-weight: bold; font-family: monospace }
div.ownDesc {margin-top: -2ex; margin-bottom: -2ex}
a.compref {font-family: sans-serif;
font-style: normal;
color: black;
text-decoration: none}
dl.props, dl.psvi {margin-bottom: .5em; margin-top: 0em}
div.toc1 {margin-left: 5ex}
div.toc2 {margin-left: 2ex}
div.tocLine{margin: 0em; text-indent: -6ex}
h3.withToc {margin-bottom: 0em}
div.constraintnote { margin-top: 1em }
div.constraint {
margin-left: 1em; }
div.constraintlist {
margin-left: 1em; margin-bottom: 0em
}
div.clnumber {
text-indent: -1em;
margin-top: 0em; margin-bottom: 0em }
div.schemaComp { border: 4px double gray;
margin: 0em 1em; padding: 0em }
div.scHead { border: 4px double gray;
border-bottom: 0px;
text-align: center;
margin-left: 1em; padding: .5em }
div.compHeader { margin: 4px;
font-weight: bold }
span.schemaComp { color: #A52A2A }
div.compBody {
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
padding: 4px ; margin: 0em}
div.psviDef { border: 4px double gray;
margin: 1em 1em; padding: 0em }
div.psviHeader { margin: 4px;
font-weight: bold }
span.psviDef { color: #A52A2A }
div.psviBody { border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
padding: 4px ; margin: 0em}
div.reprdef { border: 4px double gray;
margin: 0em 1em; padding: 0em }
div.reprHeader { margin: 4px;
font-weight: bold }
span.reprdef { color: #A52A2A }
div.reprBody, div.reprcompmulti, div.reprdep {
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
padding: 4px ; margin: 0em}
div.reprcomp {padding: 4px ; margin: 0em}
div.reprHead { text-align: center; }
div.mapSep { font-size: 50% ; clear: both}
div.mapProp {clear: left; float: left; width: 5em;
max-width: 12em; min-width: 5em }
div.mapRepr { margin-left: 6.5em }
p.element-syntax-1 { font-family: monospace;
margin-top: 0em; margin-bottom: .5em }
p.element-syntax { font-family: monospace;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #d3d3d3;
padding: 4px ; margin: 0em}
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em;
margin-bottom: 0.6em;
padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
table.restricts { margin-top: 1em; margin-bottom: 1em; margin-left: -2em}
table.restricts th { margin-left: 0em }
table.ubc td, table.ubc th { font-size: smaller }
table.dtdemo th { text-align: center;
background-color: #d5dee3}
table.dtdemo pre { margin-left: 0em; margin-bottom: 0em}
table.dtdemo td {background-color: #bedce6}
table.scrap {margin: .5em; background-color: #f5dcb3}
table.defset {background-color: #ffeedd }
table.defset thead, table.diffed-defset thead { color: red; font-weight: bold }
img { color: white; border: none }
span.nav { float: right}
span.arrow { font-style: normal; font-weight: bold }
.shrink {font-size: 80% ; }
.defset ul { margin-top: 0 ;
margin-bottom: 0 ; }
div.defset { margin: 4px ;
border-width: 4px ;
border-style: double ;
border-color: gray ; }
div.aux { background-color: #eeeeee ;
color: #333333 ; }
div.defset-head { font-weight: bold ;
padding: 0.6em ;
border-bottom-width: 4px ;
border-bottom-style: double ;
border-color: #cfcfcf ; }
div.deftop {background-color: #d5dee3 ;
margin-top: 1.5em;
padding-bottom: 0.3em }
div.defindent { margin-left: 1em ;
margin-top: 0em ;
margin-bottom: 0em ; }
div.defargs { margin-left: 3em ; }
div.prod { margin: 1em ;
margin-left: 5em ; }
.lhs { margin-left: -4em ; }
table table, .defset table { margin: 0 ;
border: 0 ;
padding: 0 ; }
.note { margin-left: 2em ;
margin-top: 1em ;
margin-bottom: 1em ; }
div.issue { background-color: #d5bbbb}
.giLabel, .pdName { margin-bottom: 0 ; font-weight: bold }
.giDef, .pdDef { margin-left: 2.5em ; margin-top: 0}
div.pvlist { border: 4px double gray;
margin-bottom: .5em; margin-left: 1em; padding: .5em;
padding-right: 1em; padding-bottom: 1em }
div.pvVal div.pvlist {
border: 4px double gray;
margin-top: 1.2em;
margin-bottom: .5em;
/* margin-left: -5em; */
margin-left: -1.3em;
padding: .5em;
padding-right: 1em;
padding-bottom: 1em;
}
div.clnumber div.pvlist { border: 4px double gray;
margin-bottom: .5em; margin-left: 1em; padding-top: .5em;
text-indent: 0;
padding-right: 1em; padding-bottom: 1em }
div.mapRepr div.pvlist { border: 4px double gray; margin-top: .5em;
margin-bottom: .5em; padding: .5em;
padding-right: 1em; padding-bottom: 1em }
div.pvSep { font-size: 50% ; clear: both}
div.pvProp {clear: left; float: left; width: 7em;
max-width: 12em; min-width: 7em }
div.pvVal { margin-left: 8em }
div.pvpair {
clear: both;
padding: 0.3em;
padding-right: 0;
}
div.sfsScrap { border: 4px double gray;
margin: 0em 1em; padding: 0em }
div.sfsHead { margin: 4px;
font-weight: bold }
div.sfsBody {
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
padding: 4px ; margin: 0em}
div.ednote {
display: block;
margin: 1.33em 0;
}
a.scrapref {
font-family: serif, sans-serif;
}
/* Added 2008-01-30. Value may be tweaked, but whatever it is,
* make it the same for these three different ways of saying
* 'paragraph'.
*/
p, div.p, div.block { margin: 1em 0; }
p.image-caption {
margin-left: 2em;
margin-right: 2em;
margin-bottom: 3em;
font-style: italic;
}
var {
/* color: green; */
color: navy; /* or perhaps try MediumBlue */
font-style: italic;
font-weight: bold;
}
table.blocknames,
table.blocknames td,
table.blocknames th {
border-style: solid;
border-width: thin;
empty-cells: show;
}
table.blocknames td,
table.blocknames th {
padding: 0.2em;
}
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WG-NOTE.css"/></head>
<body>
<div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"/></a></p>
<h1><a name="title" id="title"/>An XSD datatype for IEEE floating-point decimal</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"/>W3C Working Group Note 9 June 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2011/NOTE-xsd-precisionDecimal-20110609/">http://www.w3.org/TR/2011/NOTE-xsd-precisionDecimal-20110609/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/xsd-precisionDecimal/">http://www.w3.org/TR/xsd-precisionDecimal/</a></dd>
<dt>Editors:</dt>
<dd>David Peterson, invited expert (SGML<em>Works!</em>) <a href="mailto:davep@iit.edu"><davep@iit.edu></a></dd>
<dd>C. M. Sperberg-McQueen, Black Mesa Technologies LLC <a href="mailto:cmsmcq@blackmesatech.com"><cmsmcq@blackmesatech.com></a></dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div><hr/><div>
<h2><a name="abstract" id="abstract"/>Abstract</h2><p>
This document defines a datatype designed for
compatibility with IEEE 754 floating-point decimal
data, which can be supported by XSD 1.1 processors
as an <a href="http://www.w3.org/TR/xmlschema11-2/#key-impl-def">implementation-defined</a> datatype.
</p></div><div class="sotd">
<h2><a name="status" id="status"/>Status of This Document</h2>
<p><em>This section describes the status of this document at
the time of its publication. Other documents may supersede
this document. A list of current W3C publications and the
latest revision of this technical report can be found in the
<a href="http://www.w3.org/TR/">W3C technical reports
index</a> at http://www.w3.org/TR/.</em></p>
<p>This document is a W3C
<a href="http://www.w3.org/2005/10/Process-20051014/tr.html#maturity-levels">Working Group Note</a> as described in the
<a href="http://www.w3.org/2005/10/Process-20051014/cover.html">World Wide Web Consortium Process Document</a>.
It contains a definition of a precisionDecimal datatype
designed for compatibility with IEEE 754
floating-point decimal numbers.
</p>
<p>In its current state, this document contains all the material
specific to the <a href="#precisionDecimal">precisionDecimal</a> datatype
that has appeared in working
drafts of <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>, including some
revisions made since the most recent public working draft.
It is substantially complete as a specification of the datatype,
though some further changes (listed in <a href="#to-do">To-do list (non-normative) (§D)</a>)
may be made in a future revision of this document.</p>
<p>
Comments on this document should be sent to the W3C XML Schema
comments mailing list, <a
href="mailto:www-xml-schema-comments@w3.org"
>www-xml-schema-comments@w3.org</a> (<a
href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/"
>archive</a>). Each email message should contain only one
comment.
</p>
<p>Publication as a Working Group Note does not imply
endorsement by the W3C Membership. This is a draft document and may be
updated, replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in
progress.</p>
<p>
This document has been produced by the
<a href="http://www.w3.org/XML/Schema">W3C XML Schema Working Group</a>
as part of the W3C <a href="http://www.w3.org/XML/Activity">XML
Activity</a>. The authors of this document are
the members of the XML Schema Working Group.
</p>
<p>This document was produced by a group operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/19482/status">public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also
includes instructions for disclosing a patent. An individual
who has actual knowledge of a patent which the individual
believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in
accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
</div><div class="toc">
<h2><a name="contents" id="contents"/>Table of Contents</h2><div class="toc">1 <a href="#intro">Introduction</a><br/>
2 <a href="#terminology">Definitions</a><br/>
3 <a href="#precisionDecimal">The precisionDecimal datatype</a><br/>
3.1 <a href="#sec-vs-pD">Value Space</a>
<br/>
3.2 <a href="#pD-lexical-mapping">Lexical Mapping</a>
<br/>
3.3 <a href="#sec-f-pD">Facets</a>
<br/>
4 <a href="#facets">Facets for constraining precisionDecimal values</a><br/>
4.1 <a href="#rf-totalDigits">totalDigits</a>
<div style="margin-left: 4em; margin-top: 0; margin-bottom: 0;">
<a href="#totalDigits-validation-rules">totalDigits Validation Rules</a></div>
4.2 <a href="#rf-maxScale">maxScale</a>
<div style="margin-left: 4em; margin-top: 0; margin-bottom: 0;">
<a href="#dc-maxScale">The maxScale Schema Component</a> · <a href="#xr-maxScale">XML Representation of maxScale Schema Components</a> · <a href="#maxScale-validation-rules">maxScale Validation Rules</a> · <a href="#maxScale-coss">Constraints on maxScale Schema Components</a></div>
4.3 <a href="#rf-minScale">minScale</a>
<div style="margin-left: 4em; margin-top: 0; margin-bottom: 0;">
<a href="#dc-minScale">The minScale Schema Component</a> · <a href="#xr-minScale">XML Representation of minScale Schema Components</a> · <a href="#minScale-validation-rules">minScale Validation Rules</a> · <a href="#minScale-coss">Constraints on minScale Schema Components</a></div>
5 <a href="#implementation-notes">Implementation issues</a><br/>
5.1 <a href="#implementation-limits">Implementation limits</a>
<br/>
5.2 <a href="#implementing-operators">Interfacing with XPath</a>
<br/>
6 <a href="#mappings">Mapping functions</a><br/>
</div>
<h3><a name="appendices" id="appendices"/>Appendices</h3><p class="toc">A <a href="#normative-refs">Normative references</a><br/>
B <a href="#non-normative-refs">Non-normative references</a><br/>
C <a href="#acknowledgments">Acknowledgements (non-normative)</a><br/>
D <a href="#to-do">To-do list (non-normative)</a><br/>
</p></div><hr/><div class="body"><div class="div1">
<h2><a name="intro" id="intro"/>1 Introduction</h2><p>This document defines an XSD datatype intended to support the
floating-point decimal defined by IEEE 754.
</p><p>
IEEE 754 defines both floating-point binary and floating-point decimal
formats. The binary formats have been widely adopted since their
initial introduction; if the floating-point decimal formats are also
widely adopted for applications, it will be convenient to be able to
represent values of that type in XML documents or in other contexts
where XSD datatypes are used.
</p></div><div class="div1">
<h2><a name="terminology" id="terminology"/>2 Definitions</h2><p>The following terms are used in this specification with
the meanings indicated.</p><p>Except as specified below, in this specification terms
defined in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a> have the meanings given
there.</p><div class="glist"><div class="gitem"><div class="giLabel">
<span class="termdef"><a name="dt-constraining-facet" id="dt-constraining-facet" title="">[Definition:] </a>
<b>constraining facet</b>
</span>
</div><div class="giDef"><div class="p">A schema component whose value may be set or changed
during <a href="http://www.w3.org/TR/xmlschema11-2/#dt-derived">derivation</a>
(subject to facet-specific constraints) to control various
aspects of a derived datatype.
</div></div></div><div class="gitem"><div class="giLabel">
<span class="termdef"><a name="dt-fundamental-facet" id="dt-fundamental-facet" title="">[Definition:] </a>
<b>fundamental facet</b>
</span>
</div><div class="giDef"><div class="p">
A schema component that provides a limited piece of
information about some aspect of a datatype.
</div></div></div><div class="gitem"><div class="giLabel">
<span class="termdef"><a name="dt-specialvalue" id="dt-specialvalue" title="">[Definition:] </a><b>special value</b>
</span>
</div><div class="giDef"><div class="p">One of the possible values of the
<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> property of
<a href="#precisionDecimal">precisionDecimal</a> values, whose only relevent property,
for purposes of this document and of
<a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>, lie in its
being distinct from the other possible values;
specifically, <b><i>positiveInfinity</i></b>,
<b><i>negativeInfinity</i></b>, and
<b><i>notANumber</i></b>.</div><div class="p">Informally, any <a href="#precisionDecimal">precisionDecimal</a> value whose
<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> property is
such a special value.</div><div class="note"><div class="p"><b>Note:</b> The names of these special values are shared with the
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-specialvalue">special
values</a> of the float and double datatypes.</div></div></div></div></div></div><div class="div1">
<h2><a name="precisionDecimal" id="precisionDecimal"/>3 The precisionDecimal datatype</h2><p><span class="termdef"><a name="dt-precisionDecimal" id="dt-precisionDecimal" title="">[Definition:] </a>The
<b>precisionDecimal</b> datatype represents decimal numbers which retain precision; it also
includes values for positive and negative infinity and for
"not a number", and it differentiates between
"positive zero" and "negative
zero".</span> This datatype is introduced to
provide a variant of decimal from
which may be derived datatypes closely corresponding to
the floating-point decimal datatypes described by <a href="#ieee754-2008">[IEEE 754-2008]</a>. </p><div class="note"><div class="p"><b>Note:</b> The <a href="#precisionDecimal">precisionDecimal</a> datatype also permits derivation of a datatype
closely corresponding to Java BigDecimal, although
implementation is permitted to be confined to a much smaller
value space.</div></div><div class="note"><div class="p"><b>Note:</b> Users wishing to implement useful operations for this
datatype (beyond the equality and order specified herein) are
urged to consult <a href="#ieee754-2008">[IEEE 754-2008]</a>.</div></div><p> The
datatype <a href="#precisionDecimal">precisionDecimal</a> draws its name from a
common usage of the term 'precision' to mean the
degree of accuracy with which a quantity is recorded. In this
usage, writing a number as '<code>2</code>' or as
'<code>2.00</code>' is taken as recording the value with less or
more precision.</p><div class="note"><div class="p"><b>Note:</b> See the <a href="http://www.w3.org/TR/xmlschema11-2/#partial-implementation">conformance note</a>
in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>, which applies to this
datatype.</div></div><div class="div2">
<h3><span class="nav"> <a href="#pD-lexical-mapping" class="nav"><img alt="next sub-section" src="next.jpg"/></a></span><a name="sec-vs-pD" id="sec-vs-pD"/>3.1 Value Space</h3><div class="defset">
<div class="defset-head">Properties of
<a href="#precisionDecimal">precisionDecimal</a> Values</div>
<div class="deftop">
<b><a name="vp-pd-numVal" id="vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a></b></div>
<div class="defindent">a decimal number, <b><i>positiveInfinity</i></b>,
<b><i>negativeInfinity</i></b> or <b><i>notANumber</i></b></div>
<div class="deftop">
<b><a name="vp-pd-precision" id="vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a></b></div>
<div class="defindent">an integer or <b><i>absent</i></b>;
<b><i>absent</i></b> if and only if <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is a
special value.</div>
<div class="deftop">
<b><a name="vp-pd-sign" id="vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a></b></div>
<div class="defindent"><b><i>positive</i></b>, <b><i>negative</i></b>, or
<b><i>absent</i></b>; <span class="rfc2119">must</span> be <b><i>positive</i></b> if <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is positive or <b><i>positiveInfinity</i></b>,
<span class="rfc2119">must</span> be <b><i>negative</i></b> if <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is
negative or <b><i>negativeInfinity</i></b>, <span class="rfc2119">must</span> be <b><i>absent</i></b>
if and only if <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is
<b><i>notANumber</i></b></div>
</div>
<div class="note"><div class="p"><b>Note:</b> The <a href="#vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a> property is redundant except
when <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is zero; in other cases, the
<a href="#vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a> value is fully determined by the
<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> value.</div></div><div class="note"><div class="p"><b>Note:</b> As explained below, '<code>NaN</code>' is the lexical
representation of the <a href="#precisionDecimal">precisionDecimal</a> value whose <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> property has the special value
<b><i>notANumber</i></b>. Accordingly, in English text we
use 'NaN' to refer to that value.
Similarly we use 'INF' and
'−INF' to refer to the two values
whose <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> properties have the
special values <b><i>positiveInfinity</i></b> and
<b><i>negativeInfinity</i></b>. These three <a href="#precisionDecimal">precisionDecimal</a> values
are also informally called "not-a-number",
"positive infinity", and "negative
infinity". The latter two together are called
"the infinities".</div></div><div class="note"><div class="p"><b>Note:</b> The datatype defined here is intended to allow the
derivation of less general datatypes corresponding to the
decimal formats defined by <a href="#ieee754-2008">[IEEE 754-2008]</a>. Those formats can be viewed as
representing values other than the infinities and NaN as
triples (<var>s</var>, <var>q</var>, <var>m</var>), where
<var>s</var> is the <em>sign</em> bit,
<var>q</var> is the <em>exponent</em> (an integer), and
<var>m</var> is the <em>significand</em> (also an
integer).
(The "<var>q</var>" form of IEEE's
<em>exponent</em> is used when treating the
<em>significand</em> as an integer.) The <a href="#precisionDecimal">precisionDecimal</a> <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> is (–1 ^ <var>s</var>) × (10 ^ <var>q</var>) ×
<var>m</var> and the <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> is <var>q</var>.
Conversely, for nonzero finite values the <em>sign</em>
<var>s</var> is the <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> divided by its
absolute value, the integer <em>significand</em> <var>m</var> is
|<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a>| / (10 ^ <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>), and, of course, the exponent <var>q</var> is
the <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>.</div><div class="p">
The single NaN of <a href="#precisionDecimal">precisionDecimal</a> corresponds both to the signaling
NaN and to the quiet NaN of [IEEE 754-2008], which permits
the use of a single NaN when values are being transmitted
from one system to another via <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a>.
</div><div class="p">
The individual decimal formats defined by <a href="#ieee754-2008">[IEEE 754-2008]</a> are
characterized by the range of values allowed for the
<em>exponent</em> and by the number of decimal digits
available for the <em>significand</em>, which IEEE
terms the <em>precision</em> of the format. In any
given IEEE 754 decimal format there may be multiple
representations representing the same numerical value, one
with its significand using the maximum number of
significant digits available in the format, and the others
with fewer significant digits (when that is possible). Note
that in some cases these distinct representations will
result in distinct results in operations defined by IEEE
754.
</div><div class="p">
For datatypes derived from <a href="#precisionDecimal">precisionDecimal</a>, setting the
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits"/> facet is equivalent to restricting
the number of decimal digits available for the significand,
and setting the <a href="#dt-minScale" class="termref"><span class="arrow">·</span>minScale<span class="arrow">·</span></a> and <a href="#dt-maxScale" class="termref"><span class="arrow">·</span>maxScale<span class="arrow">·</span></a> facets amounts to controlling the
possible values of the exponent <var>q</var>.
</div></div><div class="note"><div class="p"><b>Note:</b>
<a href="#precisionDecimal">precisionDecimal</a> also allows the derivation of the Java BigDecimal
class, which corresponds in essentials to a datatype
derived from <a href="#precisionDecimal">precisionDecimal</a> by limiting the allowed scale, by
eliminating the special values, and by ignoring the
difference between +0 and –0.
</div></div><div class="block">Equality and order for <a href="#precisionDecimal">precisionDecimal</a> are defined as
follows:
<ul><li><div class="p">Two numerical <a href="#precisionDecimal">precisionDecimal</a> values are ordered (or
equal) as their <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> values are
ordered (or equal). (This means that two zeroes with
different <a href="#vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a>
properties are <em>equal</em>;
negative zeroes are <em>not</em> ordered less than
positive zeroes.)</div></li><li><div class="p">INF is equal only to itself, and is greater than
−INF and all numerical <a href="#precisionDecimal">precisionDecimal</a>
values.</div></li><li><div class="p">−INF is equal only to itself, and is less than INF
and all numerical <a href="#precisionDecimal">precisionDecimal</a> values.</div></li><li><div class="p">NaN is <a href="http://www.w3.org/TR/xmlschema11-2/#dt-incomparable">incomparable</a> with all values, <em>including
itself</em>.</div></li></ul>
</div></div><div class="div2">
<h3><span class="nav"><a href="#sec-vs-pD" class="nav"><img alt="previous sub-section" src="previous.jpg"/></a> <a href="#sec-f-pD" class="nav"><img alt="next sub-section" src="next.jpg"/></a></span><a name="pD-lexical-mapping" id="pD-lexical-mapping"/>3.2 Lexical Mapping</h3><div class="block">The lexical space
of <a href="#precisionDecimal">precisionDecimal</a> is the set of all decimal
numerals with or without a decimal point, numerals in scientific
(exponential) notation, and the character strings
'<code>INF</code>', '<code>+INF</code>',
'<code>-INF</code>', and '<code>NaN</code>'.
<div class="defset">
<div class="defset-head">Lexical Space</div>
<div class="prod">
<a name="nt-precDecRep" id="nt-precDecRep"/><span class="lhs">[1]
<i>pDecimalRep</i></span> ::= <a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a> | <a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a> |
<a href="http://www.w3.org/TR/xmlschema11-2/#nt-sciNuml">scientificNotationNumeral</a> | <a href="http://www.w3.org/TR/xmlschema11-2/#nt-numSpecReps">numericalSpecialRep</a></div></div>
</div><div class="note"><div class="p"><b>Note:</b> The four non-terminals referred to on the right-hand side
of the <a href="#nt-precDecRep"><i>pDecimalRep</i></a> are defined in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>.
</div></div><div class="block">The <a href="#nt-precDecRep"><i>pDecimalRep</i></a> production is equivalent (after
whitespace is removed) to the following regular expression:
<blockquote class="shrink"><p><code>(\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?<br/>
|(\+|-)?INF|NaN</code></p></blockquote></div><p>The <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-mapping">lexical mapping</a> for <a href="#precisionDecimal">precisionDecimal</a> is <a href="#f-precDecLexmap"><i><span class="arrow">·</span>precisionDecimalLexicalMap<span class="arrow">·</span></i></a>. The <a href="http://www.w3.org/TR/xmlschema11-2/#dt-canonical-mapping">canonical mapping</a> is <a href="#f-precDecCanmap"><i><span class="arrow">·</span>precisionDecimalCanonicalMap<span class="arrow">·</span></i></a>.</p><div class="block">For example, each of the
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a>
shown below is followed by its corresponding value triple
(<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a>, <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>,
and <a href="#vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a>) and <a href="http://www.w3.org/TR/xmlschema11-2/#dt-canonical-representation">canonical representation</a>:
<ul><li><div class="p">'<code>3</code>' ( 3 , 0 ,
<b><i>positive</i></b> ) '<code>3</code>'</div></li><li><div class="p">'<code>3.00</code>' ( 3 , 2 ,
<b><i>positive</i></b> ) '<code>3.00</code>'</div></li><li><div class="p">'<code>03.00</code>' ( 3 , 2 ,
<b><i>positive</i></b> ) '<code>3.00</code>'</div></li><li><div class="p">'<code>300</code>' ( 300 , 0 ,
<b><i>positive</i></b> ) '<code>300</code>'</div></li><li><div class="p">'<code>3.00e2</code>' ( 300 , 0 ,
<b><i>positive</i></b> ) '<code>300</code>'</div></li><li><div class="p">'<code>3.0e2</code>' ( 300 , −1 ,
<b><i>positive</i></b> ) '<code>3.0E2</code>'</div></li><li><div class="p">'<code>30e1</code>' ( 300 , −1 ,
<b><i>positive</i></b> ) '<code>3.0E2</code>'</div></li><li><div class="p">'<code>.30e3</code>' ( 300 , −1 ,
<b><i>positive</i></b> ) '<code>3.0E2</code>'</div></li></ul>
Note that the last three examples not only show different
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a>
for the same value, but are of particular interest because
values with negative precision can <em>only</em> have
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a>
in scientific notation.</div><div class="note"><div class="p"><b>Note:</b> <a href="#ieee754-2008">[IEEE 754-2008]</a> expects <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a> whose exact
value is not in the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a> to be mapped to the nearest
value that is in the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a>. When <a href="#precisionDecimal">precisionDecimal</a> is
restricted, all <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a> of values dropped
from the value space are dropped from the lexical space. One
result is that when <a href="#precisionDecimal">precisionDecimal</a> is restricted using the
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits"/> or <a href="#dt-maxScale" class="termref"><span class="arrow">·</span>maxScale<span class="arrow">·</span></a> facets,
non-zero digits beyond those required to exactly represent the
intended value are not permitted by this specification.
</div><div class="p">
<a href="#ieee754-2008">[IEEE 754-2008]</a> permits all case variants of '<code>INF</code>'
and '<code>NaN</code>', as well as those of
'<code>INFINITY</code>'; in many cases it permits language
definitions to prescribe which variants are used. This
specification explicitly chooses only '<code>INF</code>'
and '<code>NaN</code>'. 754 also permits language
definitions to prescribe whether '<code>+</code>' shall be
used with positive values; this specification makes the
'<code>+</code>' optional.</div></div><div class="note"><div class="p"><b>Note:</b>
Note: The <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a> with
"unnecessary least significant digits"
representations are the only ones lost when <a href="#precisionDecimal">precisionDecimal</a> is
restricted; shorter and simpler <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-representation">lexical representations</a>
will not be eliminated by use of
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits"/> or <a href="#dt-maxScale" class="termref"><span class="arrow">·</span>maxScale<span class="arrow">·</span></a>. (In contrast, if facets for
controlling total digits and scale were available for the
floating-point binary types, the effect of restriction
would often be inconvenient. In the floating-point binary
types, a simple decimal numeral will sometimes have no
exact value and so the number will be rounded to a binary
approximation. Any restriction of the value space which
dropped that approximate value would automatically also
drop the simple decimal numeral from the lexical space.
For example, the number one-tenth is in the value space
neither of float nor of double; the string
'<code>0.1</code>' maps, in double, to
0.1000000000000000055511151231257827021181583404541015625.
If the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits"/>, <a href="#dt-minScale" class="termref"><span class="arrow">·</span>minScale<span class="arrow">·</span></a>, and <a href="#dt-maxScale" class="termref"><span class="arrow">·</span>maxScale<span class="arrow">·</span></a>
facets were available for double (they are not) and were
used to define the float type (again, they are not), the
value just mentioned would be dropped, and the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-literal">literal</a>
'<code>0.1</code>' would be dropped along with it,
instead of mapping (as in fact it does) to the value
0.100000001490116119384765625.</div><div class="p">
This interaction between datatype restriction and
rounding has as a consequence that it will typically be
more convenient for users if restricted-precision
numeric types are derived from <a href="#precisionDecimal">precisionDecimal</a> than it would be
if they were derived from
<a href="http://www.w3.org/TR/xmlschema11-2/#float">float</a>
or <a href="http://www.w3.org/TR/xmlschema11-2/#double">double</a>.
</div></div></div><div class="div2">
<h3><span class="nav"><a href="#pD-lexical-mapping" class="nav"><img alt="previous sub-section" src="previous.jpg"/></a> </span><a name="sec-f-pD" id="sec-f-pD"/>3.3 Facets</h3><p><span class=""><span class="">The
<a href="#precisionDecimal">precisionDecimal</a> datatype
and all datatypes derived from it by restriction have the
following <a href="#dt-constraining-facet" class="termref"><span class="arrow">·</span>constraining facets<span class="arrow">·</span></a></span></span> with <b><i>fixed</i></b> values; these
facets <span class="rfc2119">must not</span> be changed from the values shown:</p>
<ul>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-whiteSpace" name="precisionDecimal.whiteSpace">whiteSpace</a><span class=""><span class=""> = <b><i>collapse</i></b> (fixed)</span></span></li>
</ul><p><span class=""><span class="">Datatypes derived by
restriction from <a href="#precisionDecimal">precisionDecimal</a> <span class="rfc2119">may</span> also
specify values for the
following <a href="http://www.w3.org/TR/xmlschema11-2/#dt-constraining-facet" class="termref"><span class="arrow">·</span>constraining facets<span class="arrow">·</span></a>:</span></span></p>
<ul>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-totalDigits">totalDigits</a></li>
<li><a href="#rf-maxScale">maxScale</a></li>
<li><a href="#rf-minScale">minScale</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-pattern">pattern</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-enumeration">enumeration</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-maxInclusive">maxInclusive</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-maxExclusive">maxExclusive</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-minInclusive">minInclusive</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-minExclusive">minExclusive</a></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-assertions">assertions</a></li></ul>
<div class=""><div class=""><p>The
<a href="#precisionDecimal">precisionDecimal</a>
datatype
has the following values for its
<a href="#dt-fundamental-facet" class="termref"><span class="arrow">·</span>fundamental facets<span class="arrow">·</span></a>:
</p>
<ul>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-ordered">ordered</a> = <b><i>partial</i></b></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-bounded">bounded</a> = <b><i>false</i></b></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-cardinality">cardinality</a> = <b><i>countably infinite</i></b></li>
<li><a href="http://www.w3.org/TR/xmlschema11-2/#rf-numeric">numeric</a> = <b><i>true</i></b></li>
</ul>
</div></div></div></div><div class="div1">
<h2><a name="facets" id="facets"/>4 Facets for constraining precisionDecimal values</h2><p>
The
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-assertions">assertions</a>,
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-enumeration">enumeration</a>,
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-maxInclusive">maxInclusive</a>,
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-maxExclusive">maxExclusive</a>,
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-minExclusive">minExclusive</a>,
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-minInclusive">minInclusive</a>,
and
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-pattern">pattern</a>
facets defined by <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a> can be used in
deriving new types from <a href="#precisionDecimal">precisionDecimal</a> by restriction; their meaning and
use are as documented in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>.
</p><p>
The <a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits">totalDigits</a>
facet defined by <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a> can also be
used. Its meaning, when applied to values of type <a href="#precisionDecimal">precisionDecimal</a>, is
described in <a href="#rf-totalDigits">totalDigits (§4.1)</a>. Except as
otherwise specified in <a href="#rf-totalDigits">totalDigits (§4.1)</a>, all
the constraints on the use of the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-totalDigits">totalDigits</a>
facet described in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a> continue
to apply when the facet is used with <a href="#precisionDecimal">precisionDecimal</a> values.
</p><p>
In addition, two facets not defined by
<a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a> can be
used when restricting <a href="#precisionDecimal">precisionDecimal</a>. They are
described in <a href="#rf-maxScale">maxScale (§4.2)</a>
and <a href="#rf-minScale">minScale (§4.3)</a>.
</p><div class="div2">
<h3 class="withToc"><span class="nav"> <a href="#rf-maxScale" class="nav"><img alt="next sub-section" src="next.jpg"/></a></span><a name="rf-totalDigits" id="rf-totalDigits"/>4.1 totalDigits</h3><p>
For <a href="#precisionDecimal">precisionDecimal</a> values with <a href="#vp-pd-numVal" class="vprop"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> of <var>nV</var> and <a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of <var>aP</var>, if the
<a href="http://www.w3.org/TR/xmlschema11-2/#f-td-value">value</a> of
<a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/>
is <var>t</var>, the effect of the <a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/> facet
is to require that (<var>aP</var> + 1 + <span class="eqn">log</span><sub>10</sub>(| <var>nV</var> |)
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-div">div</a> 1) ≤ <var>t</var>, for values other than zero, NaN,
and the infinities. This means in effect that values are
expressible in scientific notation using at most
<var>t</var> digits for the coefficient.
</p><div class="div3">
<h4><a name="totalDigits-validation-rules" id="totalDigits-validation-rules"/>4.1.1 totalDigits Validation Rules</h4><div class="constraintnote"><a id="cvc-totalDigits-valid" name="cvc-totalDigits-valid"/><b>Validation Rule: totalDigits Valid</b><br/><div class="constraint"><div class="p">A <a href="#precisionDecimal">precisionDecimal</a>
value <var>v</var>
is facet-valid with respect to a <a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/> facet with
a <a href="http://www.w3.org/TR/xmlschema11-2/#f-td-value">value</a>
of <var>t</var> if and only
if one of the following is true:
</div><div class="constraintlist"><div class="clnumber">1 <span class="p"><var>v</var> is a <a href="#precisionDecimal">precisionDecimal</a> value with
<a href="#vp-pd-numVal" class="vprop"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> of
<b><i>positiveInfinity</i></b>,
<b><i>negativeInfinity</i></b>, <b><i>notANumber</i></b>,
or zero.
</span></div>
<div class="clnumber">2 <span class="p"><var>v</var> is a <a href="#precisionDecimal">precisionDecimal</a> value with
<a href="#vp-pd-numVal" class="vprop"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> of <var>nV</var> and
<a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of <var>aP</var>,
and <var>v</var> is not NaN, INF, -INF, or zero, and
(<var>aP</var> + 1 + <span class="eqn">log</span><sub>10</sub>(| <var>nV</var> |)
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-div">div</a> 1) ≤ <var>t</var>. </span></div>
</div></div></div></div></div><div class="div2">
<h3 class="withToc"><span class="nav"><a href="#rf-totalDigits" class="nav"><img alt="previous sub-section" src="previous.jpg"/></a> <a href="#rf-minScale" class="nav"><img alt="next sub-section" src="next.jpg"/></a></span><a name="rf-maxScale" id="rf-maxScale"/>4.2 maxScale</h3><div class="localToc"> 4.2.1 <a href="#dc-maxScale">The maxScale Schema Component</a><br/>
4.2.2 <a href="#xr-maxScale">XML Representation of maxScale Schema Components</a><br/>
4.2.3 <a href="#maxScale-validation-rules">maxScale Validation Rules</a><br/>
4.2.4 <a href="#maxScale-coss">Constraints on maxScale Schema Components</a><br/>
</div><p>
<span class="termdef"><a name="dt-maxScale" id="dt-maxScale" title="">[Definition:] </a>
<b>maxScale</b> places an upper limit on the
<a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>
of <a href="#precisionDecimal">precisionDecimal</a> values: if the
<a href="#f-ms-value" class="propref">{value}</a> of <b>maxScale</b> =
<var>m</var>, then only values with
<a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> ≤ <var>m</var>
are retained in
the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a>.</span>
As a consequence, every value in the value space will have
<a href="#vp-pd-numVal" class="vprop"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> equal to
<var>i</var> / 10<sup><var>n</var></sup> for some
integers <var>i</var> and <var>n</var>, with <var>n</var>
≤ <var>m</var>. The <a href="#f-ms-value" class="propref">{value}</a>
of <a href="#f-ms" class="compref">maxScale</a>
<span class="rfc2119">must</span> be an
<a href="http://www.w3.org/TR/xmlschema11-2/#integer">integer</a>.
If it is negative, the numeric values of the datatype are
restricted to multiples of 10 (or 100, or …).
</p><p>
The term 'maxScale' is chosen to reflect
the fact that it restricts the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a> to those values
that can be represented lexically in scientific notation
using an integer coefficient and a scale (or negative
exponent) no greater than <a href="#f-ms" class="compref">maxScale</a>. (It has
nothing to do with the use of the term
'scale' to denote the radix or base of a
notation.) Note that <a href="#f-ms" class="compref">maxScale</a> does not restrict
the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-space">lexical space</a> directly; a lexical representation that
adds non-significant leading or trailing zero digits, or
that uses a lower exponent with a non-integer coefficient is
still permitted.
</p><div class="exampleOuter">
<div class="exampleHeader">Example</div>
<div class="exampleWrapper">
<div class="p">
The following is the definition of a user-defined datatype
which could be used to represent a floating-point decimal
datatype which allows seven decimal digits for the
coefficient and exponents between −95 and 96. Note
that the scale is −1 times the exponent.
</div></div><div class="exampleInner">
<pre><simpleType name='decimal32'>
<restriction base='precisionDecimal'>
<totalDigits value='7'/>
<maxScale value='95'/>
<minScale value='-96'/>
</restriction>
</simpleType></pre></div></div><div class="div3">
<h4><a name="dc-maxScale" id="dc-maxScale"/>4.2.1 The maxScale Schema Component</h4><div class="schemaComp">
<div class="component">
<div class="compHeader">
<span class="schemaComp">Schema Component: </span><a name="f-ms" id="f-ms">maxScale</a></div>
<div class="compBody">
<div class="propList">
<div class="propDefn"><a name="f-ms-annotations"/><div class="pdName"><span class="propdef">{annotations}</span></div>
<div class="pdDef">
A sequence of <a href="http://www.w3.org/TR/xmlschema11-1/#a" class="compref">Annotation</a> components. </div>
</div>
<div class="propDefn"><a name="f-ms-value"/><div class="pdName"><span class="propdef">{value}</span></div>
<div class="pdDef">
An xs:integer value. Required.</div>
</div>
<div class="propDefn"><a name="f-ms-fixed"/><div class="pdName"><span class="propdef">{fixed}</span></div>
<div class="pdDef">
An xs:boolean value. Required.</div>
</div>
</div></div>
</div>
</div>
<p>
If <a href="#f-ms-fixed" class="propref">{fixed}</a> is <b><i>true</i></b>, then
types for which the current type is the
<a href="http://www.w3.org/TR/xmlschema11-2/#std-base_type_definition" class="propref">{base type definition}</a>
<span class="rfc2119">must not</span> specify a value for <a href="#f-ms" class="compref">maxScale</a> other
than <a href="#f-ms-value" class="propref">{value}</a>.
</p></div><div class="div3">
<h4><a name="xr-maxScale" id="xr-maxScale"/>4.2.2 XML Representation of maxScale Schema Components</h4><p>
The XML representation for a <a href="#f-ms" class="compref">maxScale</a> schema
component is a <a href="http://www.w3.org/TR/xmlschema11-2/#element-maxScale" class="eltref"><maxScale></a> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p><div class="reprdef"><div class="reprHeader"><span class="reprdef">XML Representation Summary</span>: <code>maxScale</code> Element Information Item</div><div class="reprBody"><p class="element-syntax-1"/><div class="reprcompmulti"><div class="reprHead"><a href="#dc-maxScale">maxScale</a> <strong>Schema Component</strong></div></div><div class="mapProp"><strong>Property</strong></div><div class="mapRepr"><strong>Representation</strong></div><div class="mapSep"> </div><div class="mapProp"><a href="#f-ms-value" class="propref">{value}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-vv">actual value</a> of the <code>value</code> <a href="http://www.w3.org/TR/xml-infoset/#infoitem.element" class="xpropref">[attribute]</a>
</div><div class="mapSep"> </div><div class="mapProp"><a href="#f-ms-fixed" class="propref">{fixed}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-vv">actual value</a> of the <code>fixed</code> <a href="http://www.w3.org/TR/xml-infoset/#infoitem.element" class="xpropref">[attribute]</a>,
if present, otherwise <b><i>false</i></b>
</div><div class="mapSep"> </div><div class="mapProp"><a href="#f-ms-annotations" class="propref">{annotations}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-am-one">annotation mapping</a> of the
<a href="http://www.w3.org/TR/xmlschema11-2/#element-maxScale" class="eltref"><maxScale></a>
element, as defined in
section <a href="http://www.w3.org/TR/xmlschema11-1/#declare-annotation">XML Representation of Annotation Schema Components</a>
of <a href="#structures-1.1">[XSD 1.1 Part 1: Structures]</a>.
</div></div></div></div><div class="div3">
<h4><a name="maxScale-validation-rules" id="maxScale-validation-rules"/>4.2.3 maxScale Validation Rules</h4><div class="constraintnote"><a id="cvc-maxScale-valid" name="cvc-maxScale-valid"/><b>Validation Rule: maxScale Valid</b><br/><div class="constraint"><div class="p">
A <a href="#precisionDecimal">precisionDecimal</a> value <var>v</var> is facet-valid with
respect to <a href="#f-ms" class="compref">maxScale</a> if and only if one of the
following is true:
</div><div class="constraintlist"><div class="clnumber">1 <span class="p"><var>v</var> has <a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>
less than or equal to the
<a href="#f-ms-value" class="propref">{value}</a> of <a href="#f-ms" class="compref">maxScale</a>.</span></div>
<div class="clnumber">2 <span class="p">The <a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of <var>v</var>
is <b><i>absent</i></b>.</span></div>
</div></div></div></div><div class="div3">
<h4><a name="maxScale-coss" id="maxScale-coss"/>4.2.4 Constraints on maxScale Schema Components</h4><div class="constraintnote"><a id="maxScale-valid-restriction" name="maxScale-valid-restriction"/><b>Schema Component Constraint: maxScale valid restriction</b><br/><div class="constraint"><div class="p">
It is an <a href="http://www.w3.org/TR/xmlschema11-2/#dt-error">error</a> if <a href="#f-ms" class="compref">maxScale</a> is among the
members of <a href="http://www.w3.org/TR/xmlschema11-2/#std-facets">{facets}</a> of <a href="http://www.w3.org/TR/xmlschema11-2/#std-base_type_definition" class="propref">{base type definition}</a> and <a href="#f-ms-value" class="propref">{value}</a> is greater than the <a href="#f-ms-value" class="propref">{value}</a> of that <a href="#f-ms" class="compref">maxScale</a>.
</div></div></div></div></div><div class="div2">
<h3 class="withToc"><span class="nav"><a href="#rf-maxScale" class="nav"><img alt="previous sub-section" src="previous.jpg"/></a> </span><a name="rf-minScale" id="rf-minScale"/>4.3 minScale</h3><div class="localToc"> 4.3.1 <a href="#dc-minScale">The minScale Schema Component</a><br/>
4.3.2 <a href="#xr-minScale">XML Representation of minScale Schema Components</a><br/>
4.3.3 <a href="#minScale-validation-rules">minScale Validation Rules</a><br/>
4.3.4 <a href="#minScale-coss">Constraints on minScale Schema Components</a><br/>
</div><p>
<span class="termdef"><a name="dt-minScale" id="dt-minScale" title="">[Definition:] </a>
<b>minScale</b> places a lower limit on
the
<a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>
of <a href="#precisionDecimal">precisionDecimal</a> values.
If the <a href="#f-mns-value" class="propref">{value}</a> of <b>minScale</b>
is <var>m</var>, then the value space is restricted to values with
<a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> ≥ <var>m</var>.</span>
As a consequence, every value in the value space will have
<a href="#vp-pd-numVal" class="vprop"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> equal to
<var>i</var> / 10<sup><var>n</var></sup> for some integers
<var>i</var> and <var>n</var>,
with <var>n</var> ≥ <var>m</var>.
</p><p>
The term <b>minScale</b> is chosen to reflect the fact that it
restricts the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a> to those values that can
be represented lexically in exponential form using an integer
coefficient and a scale (negative exponent)
at least as large as <em>minScale</em>. Note that
it does not restrict the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-lexical-space">lexical space</a> directly; a
lexical representation that adds additional leading zero digits,
or that uses a larger exponent (and a correspondingly smaller coefficient)
is still permitted.
</p><div class="exampleOuter">
<div class="exampleHeader">Example</div>
<div class="exampleWrapper">
<div class="p">
The following is the definition of a user-defined
datatype which could be used to represent amounts in a decimal
currency; it corresponds to a SQL column definition of
<code>DECIMAL(8,2)</code>. The effect is to allow values
between -999,999.99 and 999,999.99, with a fixed interval
of 0.01 between values.
</div></div><div class="exampleInner">
<pre><simpleType name='price'>
<restriction base='precisionDecimal'>
<totalDigits value='8'/>
<minScale value='2'/>
<maxScale value='2'/>
</restriction>
</simpleType></pre></div></div><div class="div3">
<h4><a name="dc-minScale" id="dc-minScale"/>4.3.1 The minScale Schema Component</h4><div class="schemaComp">
<div class="component">
<div class="compHeader">
<span class="schemaComp">Schema Component: </span><a name="f-mns" id="f-mns">minScale</a></div>
<div class="compBody">
<div class="propList">
<div class="propDefn"><a name="f-mns-annotations"/><div class="pdName"><span class="propdef">{annotations}</span></div>
<div class="pdDef">
A sequence of <a href="http://www.w3.org/TR/xmlschema11-1/#a" class="compref">Annotation</a> components. </div>
</div>
<div class="propDefn"><a name="f-mns-value"/><div class="pdName"><span class="propdef">{value}</span></div>
<div class="pdDef">
An xs:integer value. Required.</div>
</div>
<div class="propDefn"><a name="f-mns-fixed"/><div class="pdName"><span class="propdef">{fixed}</span></div>
<div class="pdDef">
An xs:boolean value. Required.</div>
</div>
</div></div>
</div>
</div>
<p>
If <a href="#f-mns-fixed" class="propref">{fixed}</a> is <b><i>true</i></b>, then types for which
the current type is the <a href="http://www.w3.org/TR/xmlschema11-2/#std-base_type_definition" class="propref">{base type definition}</a>
<span class="rfc2119">must not</span> specify a
value for <a href="#f-mns" class="compref">minScale</a> other than
<a href="#f-mns-value" class="propref">{value}</a>.
</p></div><div class="div3">
<h4><a name="xr-minScale" id="xr-minScale"/>4.3.2 XML Representation of minScale Schema Components</h4><p>
The XML representation for a <a href="#f-mns" class="compref">minScale</a> schema
component is a <a href="http://www.w3.org/TR/xmlschema11-2/#element-minScale" class="eltref"><minScale></a> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p><div class="reprdef"><div class="reprHeader"><span class="reprdef">XML Representation Summary</span>: <code>minScale</code> Element Information Item</div><div class="reprBody"><p class="element-syntax-1"/><div class="reprcompmulti"><div class="reprHead"><a href="#dc-minScale">minScale</a> <strong>Schema Component</strong></div></div><div class="mapProp"><strong>Property</strong></div><div class="mapRepr"><strong>Representation</strong></div><div class="mapSep"> </div><div class="mapProp"><a href="#f-mns-value" class="propref">{value}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-vv">actual value</a> of the <code>value</code> <a href="http://www.w3.org/TR/xml-infoset/#infoitem.element" class="xpropref">[attribute]</a>
</div><div class="mapSep"> </div><div class="mapProp"><a href="#f-mns-fixed" class="propref">{fixed}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-vv">actual value</a> of the <code>fixed</code> <a href="http://www.w3.org/TR/xml-infoset/#infoitem.element" class="xpropref">[attribute]</a>, if present, otherwise <b><i>false</i></b>
</div><div class="mapSep"> </div><div class="mapProp"><a href="#f-mns-annotations" class="propref">{annotations}</a></div><div class="mapRepr">
The <a href="http://www.w3.org/TR/xmlschema11-1/#key-am-one">annotation mapping</a> of the
<a href="http://www.w3.org/TR/xmlschema11-2/#element-minScale" class="eltref"><minScale></a>
element, as defined in
section <a href="http://www.w3.org/TR/xmlschema11-1/#declare-annotation">XML Representation of Annotation Schema Components</a>
of <a href="#structures-1.1">[XSD 1.1 Part 1: Structures]</a>.
</div></div></div></div><div class="div3">
<h4><a name="minScale-validation-rules" id="minScale-validation-rules"/>4.3.3 minScale Validation Rules</h4><div class="constraintnote"><a id="cvc-minScale-valid" name="cvc-minScale-valid"/><b>Validation Rule: minScale Valid</b><br/><div class="constraint"><div class="p">
A <a href="#precisionDecimal">precisionDecimal</a> value <var>v</var> is facet-valid with
respect to <a href="#f-mns" class="compref">minScale</a>
if and only if one of the following is true:
</div><div class="constraintlist"><div class="clnumber">1 <span class="p">
<var>v</var> has <a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a>
greater than or equal to
the <a href="#f-mns-value" class="propref">{value}</a>
of <a href="#f-mns" class="compref">minScale</a>.
</span></div>
<div class="clnumber">2 <span class="p">The <a href="#vp-pd-precision" class="vprop"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of <var>v</var>
is <b><i>absent</i></b>.</span></div>
</div></div></div></div><div class="div3">
<h4><a name="minScale-coss" id="minScale-coss"/>4.3.4 Constraints on minScale Schema Components</h4><div class="constraintnote"><a id="minScale-totalDigits" name="minScale-totalDigits"/><b>Schema Component Constraint: minScale less than or equal to maxScale</b><br/><div class="constraint"><div class="p">
It is an <a href="http://www.w3.org/TR/xmlschema11-2/#dt-error">error</a> for <a href="#f-mns" class="compref">minScale</a> to
be greater than <a href="#f-ms" class="compref">maxScale</a>.
</div></div></div><p>Note that it is <em>not</em> an error for <a href="#f-mns" class="compref">minScale</a> to be greater than <a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/>.</p><div class="constraintnote"><a id="minScale-valid-restriction" name="minScale-valid-restriction"/><b>Schema Component Constraint: minScale valid restriction</b><br/><div class="constraint"><div class="p">
It is an <a href="http://www.w3.org/TR/xmlschema11-2/#dt-error">error</a> if <a href="#f-mns" class="compref">minScale</a>
is among the members of <a href="http://www.w3.org/TR/xmlschema11-2/#std-facets">{facets}</a> of
<a href="http://www.w3.org/TR/xmlschema11-2/#std-base_type_definition" class="propref">{base type definition}</a> and
<a href="#f-mns-value" class="propref">{value}</a> is less than the <a href="#f-mns-value" class="propref">{value}</a> of that <a href="#f-mns" class="compref">minScale</a>.
</div></div></div></div></div></div><div class="div1">
<h2><a name="implementation-notes" id="implementation-notes"/>5 Implementation issues</h2><div class="div2">
<h3><span class="nav"> <a href="#implementing-operators" class="nav"><img alt="next sub-section" src="next.jpg"/></a></span><a name="implementation-limits" id="implementation-limits"/>5.1 Implementation limits</h3><p>All <a href="http://www.w3.org/TR/xmlschema11-2/#dt-minimally-conforming">minimally conforming</a> processors <span class="rfc2119">must</span>
support all <a href="#precisionDecimal">precisionDecimal</a> values in the <a href="http://www.w3.org/TR/xmlschema11-2/#dt-value-space">value space</a> of
the otherwise unconstrained <a href="http://www.w3.org/TR/xmlschema11-2/#dt-derived">derived</a> datatype for which
<a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/> is set to sixteen, <a href="#f-ms" class="compref">maxScale</a> to 369,
and <a href="#f-mns" class="compref">minScale</a> to −398.</p><div class="note"><div class="p"><b>Note:</b> The conformance limits given in the text correspond to
those of the decimal64 type defined in <a href="#ieee754-2008">[IEEE 754-2008]</a>, which can be stored in a 64-bit
field. The XML Schema Working Group recommends that
implementors support limits corresponding to those of the
decimal128 type. This entails supporting the values in the
value space of the otherwise unconstrained datatype for which
<a href="http://www.w3.org/TR/xmlschema11-2/#f-td"/> is set to 34, <a href="#f-ms" class="compref">maxScale</a> to
6111, and <a href="#f-mns" class="compref">minScale</a> to
−6176.</div></div></div><div class="div2">
<h3><span class="nav"><a href="#implementation-limits" class="nav"><img alt="previous sub-section" src="previous.jpg"/></a> </span><a name="implementing-operators" id="implementing-operators"/>5.2 Interfacing with XPath</h3><p><a href="#bib-xpath2">[XPath 2.0]</a> does not currently require
support for the precisionDecimal datatype, but conforming
XPath processors are allowed to support additional primitive
data types, including precisionDecimal.
</p><p>
For interoperability, it is recommended that XPath processors
intending to support precisionDecimal as an additional
primitive data type follow the recommendations in <a href="#bib-chamberlin-2006">[Chamberlin 2006]</a>. If the XPath processor used to
evaluate XPath expressions supports precisionDecimal, then any
precisionDecimal values in the <a href="http://www.w3.org/TR/xmlschema11-1/#key-psvi">post-schema-validation infoset</a> <span class="rfc2119">should</span> be labeled as
<code>xs:precisionDecimal</code> in the data model instance
and handled accordingly in XPath.
</p><p>
If the XPath processor does not support precisionDecimal,
then any precisionDecimal values in the <a href="http://www.w3.org/TR/xmlschema11-1/#key-psvi">post-schema-validation infoset</a> <span class="rfc2119">should</span> be
mapped into <a href="http://www.w3.org/TR/xmlschema11-2/#decimal">decimal</a>, unless the
<a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a>
is not a decimal number (for example, it is
<b><i>positiveInfinity</i></b>, <b><i>negativeInfinity</i></b>, or
<b><i>notANumber</i></b>), in which case they <span class="rfc2119">should</span> be mapped
to <a href="http://www.w3.org/TR/xmlschema11-2/#float">float</a>.
Whether this is done by altering the type information in the
partial <a href="http://www.w3.org/TR/xmlschema11-1/#key-psvi">post-schema-validation infoset</a>, or by altering the usual rules for mapping
from a <a href="http://www.w3.org/TR/xmlschema11-1/#key-psvi">post-schema-validation infoset</a> to an <a href="#bib-xdm">[XDM]</a> data model instance,
or by treating precisionDecimal as an unknown type which is
coerced as appropriate into decimal or float by the XPath
processor, is <a href="http://www.w3.org/TR/xmlschema11-2/#key-impl-def">implementation-defined</a> and out of scope for this
specification.
</p><p>
As a consequence of the above variability, it is possible
that XPath expressions that perform various kinds of type
introspections will produce different results when different
XPath processors are used. If the schema author wishes to
ensure interoperable results, such introspections will need to
be avoided.
</p></div></div><div class="div1">
<h2><a name="mappings" id="mappings"/>6 Mapping functions</h2><p>
The functions defined below make frequent reference to
functions defined in <a href="#datatypes-1.1">[XSD 1.1 Part 2: Datatypes]</a>.
</p><div class="defset">
<div class="not_aux">
<div class="defset-head">Auxiliary Functions for Reading Instances of <a href="#nt-precDecRep"><i>pDecimalRep</i></a></div>
<div class="deftop" style="margin-top: 0em;"><b><a name="vp-decPrecision" id="vp-decPrecision"><i><span class="arrow">·</span>decimalPtPrecision<span class="arrow">·</span></i></a></b> (<var>LEX</var>) → integer
<div class="defindent">Maps a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a> onto an integer;
used in calculating the <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of a
<a href="#precisionDecimal">precisionDecimal</a> value.</div>
</div>
<b>Arguments:</b><div class="defindent"><table><tbody>
<tr><td><var>LEX</var></td><td>: </td><td>matches
<a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a>
</td></tr>
</tbody></table></div>
<b>Result:</b><div class="defindent">an integer</div>
<b>Algorithm:</b>
<div class="defindent"><var>LEX</var> necessarily contains a decimal
point ('<code>.</code>') and may optionally contain a
following <a href="http://www.w3.org/TR/xmlschema11-2/#nt-fracFrag">fracFrag</a>
<var>F</var> consisting of some number <var>n</var> of
<a href="http://www.w3.org/TR/xmlschema11-2/#nt-digit">digit</a>s.
</div>
<div class="defindent">Return
<ul><li><div class="p"><var>n</var> when <var>F</var> is present, and</div></li><li><div class="p">0 otherwise.</div></li></ul>
</div>
<div class="deftop"><b><a name="vp-sciPrecision" id="vp-sciPrecision"><i><span class="arrow">·</span>scientificPrecision<span class="arrow">·</span></i></a></b> (<var>LEX</var>) → integer
<div class="defindent">Maps a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-sciNuml">scientificNotationNumeral</a> onto an integer;
used in calculating the <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of a
<a href="#precisionDecimal">precisionDecimal</a> value.</div>
</div>
<b>Arguments:</b><div class="defindent"><table><tbody>
<tr><td><var>LEX</var></td><td>: </td><td>matches
<a href="http://www.w3.org/TR/xmlschema11-2/#nt-sciNuml">scientificNotationNumeral</a></td></tr>
</tbody></table></div>
<b>Result:</b><div class="defindent">an integer</div>
<b>Algorithm:</b>
<div class="defindent"><var>LEX</var> necessarily contains a
<a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a> or <a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a> <var>C</var>
preceding an exponent indicator ('<code>E</code>' or
'<code>e</code>', and a following <a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a>
<var>E</var>.</div>
<div class="defindent">Return<ul><li><div class="p">−1 × <a href="http://www.w3.org/TR/xmlschema11-2/#f-noDecVal">noDecimalMap</a>(<var>E</var>) when <var>C</var> is
a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a>, and</div></li><li><div class="p"><a href="#vp-decPrecision"><i><span class="arrow">·</span>decimalPtPrecision<span class="arrow">·</span></i></a>(<var>C</var>) −
<a href="http://www.w3.org/TR/xmlschema11-2/#f-noDecVal">noDecimalMap</a>(<var>E</var>) otherwise.</div></li></ul>
</div>
</div></div><div class="defset">
<div class="not_aux">
<div class="defset-head">Lexical Mapping</div>
<div class="deftop" style="margin-top: 0em;"><b><a name="f-precDecLexmap" id="f-precDecLexmap"><i><span class="arrow">·</span>precisionDecimalLexicalMap<span class="arrow">·</span></i></a></b> (<var>LEX</var>) → <a href="#precisionDecimal">precisionDecimal</a>
<div class="defindent">Maps a <a href="#nt-precDecRep"><i>pDecimalRep</i></a> onto a complete
<a href="#precisionDecimal">precisionDecimal</a> value.</div>
</div>
<b>Arguments:</b><div class="defindent"><table><tbody>
<tr><td><var>LEX</var></td><td>: </td><td>matches <a href="#nt-precDecRep"><i>pDecimalRep</i></a></td></tr>
</tbody></table></div>
<b>Result:</b><div class="defindent">a <a href="#precisionDecimal">precisionDecimal</a> value</div>
<b>Algorithm:</b>
<div class="defindent"><table><tbody><tr><td valign="top">Let </td><td><var>pD</var> be a complete <a href="#precisionDecimal">precisionDecimal</a>
value.</td></tr></tbody></table></div>
<div class="defindent">
<ol class="enumar"><li><div class="p">Set <var>pD</var>'s <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> to
<ul><li><div class="p"><a href="http://www.w3.org/TR/xmlschema11-2/#f-noDecVal">noDecimalMap</a>(<var>LEX</var>) when
<var>LEX</var> is an instance of <a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a>,</div></li><li><div class="p"><a href="http://www.w3.org/TR/xmlschema11-2/#f-decVal">decimalPtMap</a>(<var>LEX</var>) when
<var>LEX</var> is an instance of <a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a>,</div></li><li><div class="p"><a href="http://www.w3.org/TR/xmlschema11-2/#f-sciVal">scientificMap</a>(<var>LEX</var>) when
<var>LEX</var> is an instance of <a href="http://www.w3.org/TR/xmlschema11-2/#nt-sciNuml">scientificNotationNumeral</a> and</div></li><li><div class="p"><a href="http://www.w3.org/TR/xmlschema11-2/#f-specRepVal">specialRepValue</a>(<var>LEX</var>) otherwise.</div></li></ul>
</div></li><li><div class="p">Set
<var>pD</var>'s <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> to<ul><li><div class="p">0 when <var>LEX</var> is a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-noDecNuml">noDecimalPtNumeral</a>,</div></li><li><div class="p"><a href="#vp-decPrecision"><i><span class="arrow">·</span>decimalPtPrecision<span class="arrow">·</span></i></a>(<var>LEX</var>) when <var>LEX</var>
is a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-decNuml">decimalPtNumeral</a>,</div></li><li><div class="p"><a href="#vp-sciPrecision"><i><span class="arrow">·</span>scientificPrecision<span class="arrow">·</span></i></a>(<var>LEX</var>) when <var>LEX</var>
is a <a href="http://www.w3.org/TR/xmlschema11-2/#nt-sciNuml">scientificNotationNumeral</a>, and</div></li><li><div class="p"><b><i>absent</i></b> otherwise</div></li></ul>
</div></li><li><div class="p">Set <var>pD</var>'s <a href="#vp-pd-sign"><i><span class="arrow">·</span>sign<span class="arrow">·</span></i></a> to<ul><li><div class="p"><b><i>absent</i></b> when <var>LEX</var> is '<code>NaN</code>'</div></li><li><div class="p"><b><i>negative</i></b> when
the first character of <var>LEX</var> is '<code>-</code>', and</div></li><li><div class="p"><b><i>positive</i></b> otherwise.</div></li></ul></div></li><li><div class="p">Return <var>pD</var>.</div></li></ol>
</div>
</div></div><div class="defset">
<div class="not_aux">
<div class="defset-head">Canonical Mapping</div>
<div class="deftop" style="margin-top: 0em;"><b><a name="f-precDecCanmap" id="f-precDecCanmap"><i><span class="arrow">·</span>precisionDecimalCanonicalMap<span class="arrow">·</span></i></a></b> (<var>pD</var>) → <a href="#nt-precDecRep"><i>pDecimalRep</i></a>
<div class="defindent">Maps a <a href="#precisionDecimal">precisionDecimal</a> to its
<a href="http://www.w3.org/TR/xmlschema11-2/#dt-canonical-representation">canonical representation</a>, a <a href="#nt-precDecRep"><i>pDecimalRep</i></a>.</div>
</div>
<b>Arguments:</b><div class="defindent"><table><tbody>
<tr><td><var>pD</var></td><td>: </td><td>a <a href="#precisionDecimal">precisionDecimal</a> value</td></tr>
</tbody></table></div>
<b>Result:</b><div class="defindent">a <a href="http://www.w3.org/TR/xmlschema11-2/#dt-literal">literal</a> matching <a href="#nt-precDecRep"><i>pDecimalRep</i></a></div>
<b>Algorithm:</b>
<div class="defindent">
<ol class="enumar"><li><div class="p">Let <var>nV</var> be the <a href="#vp-pd-numVal"><i><span class="arrow">·</span>numericalValue<span class="arrow">·</span></i></a> of <var>pD</var>.</div><div class="p">Let <var>aP</var> be the <a href="#vp-pd-precision"><i><span class="arrow">·</span>scale<span class="arrow">·</span></i></a> of <var>pD</var>.</div></li><li><div class="p">If <var>pD</var> is one of NaN, INF, or -INF, then return
<a href="http://www.w3.org/TR/xmlschema11-2/#f-specValCanMap">specialRepCanonicalMap</a>(<var>nV</var>).
</div></li><li><div class="p">Otherwise, if <var>nV</var> is an integer and <var>aP</var> is zero and
1E-6 ≤ <var>nV</var> ≤ 1E6, then return
<a href="http://www.w3.org/TR/xmlschema11-2/#f-noDecCanMap">noDecimalPtCanonicalMap</a>(<var>nV</var>).
</div></li><li><div class="p">Otherwise, if <var>aP</var> is greater than zero and
1E-6 ≤ <var>nV</var> ≤ 1E6, then let <var>s</var> be
<a href="http://www.w3.org/TR/xmlschema11-2/#f-decCanFragMap">decimalPtCanonicalMap</a>(<var>nV</var>).
Let <var>f</var> be the number of fractional digits in <var>s</var>;
<var>f</var> will invariably be less than or equal to <var>aP</var>.
Return the concatenation of <var>s</var> with
<var>aP</var> − <var>f</var>
occurrences of the digit '<code>0</code>'.</div></li><li><div class="p">Otherwise, it will be the case that
<var>nV</var> is less than 1E−6 or greater than 1E6,
or that <var>aP</var> is less than zero.
Let <ul><li><div class="p"><var>s</var> be
<a href="http://www.w3.org/TR/xmlschema11-2/#f-sciCanFragMap">scientificCanonicalMap</a>(<var>nV</var>).
</div></li><li><div class="p"><var>m</var> be the part of <var>s</var> which precedes the "E".</div></li><li><div class="p"><var>n</var> be the part of <var>s</var> which follows the "E".</div></li><li><div class="p"><var>p</var> be the integer denoted by <var>n</var>.</div></li><li><div class="p"><var>f</var> be the number of fractional digits in <var>m</var>;
note that <var>f</var> will invariably be less than or equal to
<var>aP</var> + <var>p</var>.
</div></li><li><div class="p"><var>t</var> be a string consisting of
<var>aP</var> + <var>p</var> − <var>f</var>
occurrences of the digit '<code>0</code>',
preceded by a decimal point if and only if
<var>m</var> contains no decimal point and
<var>aP</var> + <var>p</var> − <var>f</var> is
greater than zero.</div></li></ul>
Return the concatenation
<var>m</var> & <var>t</var> & '<code>E</code>' & <var>n</var>.
</div></li></ol>
</div>
</div></div></div></div><div class="back"><div class="div1">
<h2><a name="normative-refs" id="normative-refs"/>A Normative references</h2><dl><dt class="label"><a name="ieee754-2008" id="ieee754-2008"/>IEEE 754-2008</dt><dd>
IEEE. <em>IEEE Standard for Floating-Point Arithmetic</em>. 29
August 2008. <a href="http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=4610933">http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=4610933</a>
</dd><dt class="label"><a name="datatypes-1.1" id="datatypes-1.1"/>XSD 1.1 Part 2: Datatypes</dt><dd>
World Wide Web Consortium.
<em>W3C XML Schema Definition Language (XSD) 1.1 Part 2:
Structures</em>,
ed. David Peterson et al.
W3C Working Draft 3 December 2009.
Available at:
<a href="http://www.w3.org/TR/xmlschema11-2/">http://www.w3.org/TR/xmlschema11-2/</a>
</dd></dl></div><div class="div1">
<h2><a name="non-normative-refs" id="non-normative-refs"/>B Non-normative references</h2><dl><dt class="label"><a name="bib-chamberlin-2006" id="bib-chamberlin-2006"/>Chamberlin 2006</dt><dd>
Chamberlin, Don.
<em>Impact of precisionDecimal on XPath and XQuery</em>
Email to the W3C XML Query and W3C XSL Working
Groups, 16 May 2006. Available online at
<a href="http://www.w3.org/XML/2007/dc.pd.xml">http://www.w3.org/XML/2007/dc.pd.xml</a> and <a href="http://www.w3.org/XML/2007/dc.pd.html">http://www.w3.org/XML/2007/dc.pd.html</a>
</dd><dt class="label"><a name="bib-xdm" id="bib-xdm"/>XDM</dt><dd>
World Wide Web Consortium.
<em>XQuery 1.0 and XPath 2.0 Data Model (XDM)</em>,
ed. Mary Fernández et al.
W3C Recommendation 23 January 2007.
Available at:
<a href="http://www.w3.org/TR/xpath-datamodel/">http://www.w3.org/TR/xpath-datamodel/</a>.
</dd><dt class="label"><a name="bib-xpath2" id="bib-xpath2"/>XPath 2.0</dt><dd>
World Wide Web Consortium.
<em>XML Path Language 2.0</em>,
ed. Anders Berglund et al.
23 January 2007.
Available at:
<a href="http://www.w3.org/TR/2007/REC-xpath20-20070123/">http://www.w3.org/TR/2007/REC-xpath20-20070123/</a>
</dd><dt class="label"><a name="structures-1.1" id="structures-1.1"/>XSD 1.1 Part 1: Structures</dt><dd>
World Wide Web Consortium.
<em>W3C XML Schema Definition Language (XSD) 1.1 Part 1:
Structures</em>, ed. Shudi (Sandy) Gao 高殊镝,
C. M. Sperberg-McQueen,
and Henry S. Thompson.
W3C Working Draft 3 December 2009.
Available at:
<a href="http://www.w3.org/TR/xmlschema11-1/">http://www.w3.org/TR/xmlschema11-1/</a>
</dd></dl></div><div class="div1">
<h2><a name="acknowledgments" id="acknowledgments"/>C Acknowledgements (non-normative)</h2><p>This document was prepared by the W3C
XML Schema Working Group. The
members at the time of publication were:</p><ul><li>Gioele Barabucci, University of Bologna</li><li>Paul V. Biron, Invited expert</li><li>David Ezell, National Association of Convenience Stores (NACS) (<i>chair</i>) </li><li>Shudi (Sandy) Gao 高殊镝, IBM</li><li>Mary Holstege, Mark Logic</li><li>Sam Idicula, Oracle</li><li>Michael Kay, Invited expert</li><li>Nan Ma, China Electronics Standardization Institute</li><li>Paolo Marinelli, University of Bologna</li><li>Jim Melton, Oracle</li><li>Noah Mendelsohn, Invited expert</li><li>Dave Peterson, Invited expert</li><li>Liam Quin, W3C</li><li>C. M. Sperberg-McQueen, Black Mesa Technologies (for W3C) (<i>staff contact</i>) </li><li>Henry S. Thompson, University of Edinburgh</li><li>Scott Tsao, The Boeing Company</li><li>Fabio Vitali, University of Bologna</li><li>Stefano Zacchiroli, University of Bologna</li><li>Kongyi Zhou, Oracle</li></ul></div><div class="div1">
<h2><a name="to-do" id="to-do"/>D To-do list (non-normative)</h2><p>Some changes are expected to be made in future work on this document:</p><ul><li><div class="p">Draft fuller introduction.</div></li><li><div class="p">Add section on conformance to this spec.</div></li><li><div class="p">Add section claiming conformance to XSD 1.1 and pointing to the
required information.</div></li></ul></div></div></body>
</html>