InterviewSolution
| 1. |
Why My Document Is Valid On Some Platform While Invalid On Others? |
|
Answer» The parser relies on the system call, strtod(), to parse a string REPRESENTATION of a double/float data. In the case of no invalid characters FOUND, the strtod() returns a double/float value if it is representable on that platform, or raises ERANGE to indicate either underflow or underflow occurs. And the parser assigns zero to the SAID data if underflow is found. The threshold, where the strtod() DECIDES if an underflow occurs, varies on platforms. On Windows, it is roughly the order of e-308, on Linux, e-325, and on AIX, HP-UX and SOLARIS, e-324. So in an instance document, a data of value 1.0e-310 from a type with minExclusive 0, is considered invalid on windows (since it is converted to 0 and therefore violates the minExclusive constraint), but valid on other Unix platforms (since it remains the original value). The parser relies on the system call, strtod(), to parse a string representation of a double/float data. In the case of no invalid characters found, the strtod() returns a double/float value if it is representable on that platform, or raises ERANGE to indicate either underflow or underflow occurs. And the parser assigns zero to the said data if underflow is found. The threshold, where the strtod() decides if an underflow occurs, varies on platforms. On Windows, it is roughly the order of e-308, on Linux, e-325, and on AIX, HP-UX and Solaris, e-324. So in an instance document, a data of value 1.0e-310 from a type with minExclusive 0, is considered invalid on windows (since it is converted to 0 and therefore violates the minExclusive constraint), but valid on other Unix platforms (since it remains the original value). |
|