Difference between revisions of "What is a Hexadecimal Floating Point Literal?"
(Created page with "Category:Tests == Question == What is a Hexadecimal Floating Point Literal? == Answer == A string literal of the form <span class="high">0x1.8p1</span> in SimWB is a Hexad...") |
|||
Line 1: | Line 1: | ||
+ | [[Category:FAQ]] | ||
[[Category:Tests]] | [[Category:Tests]] | ||
== Question == | == Question == |
Latest revision as of 20:46, 2 March 2015
Question
What is a Hexadecimal Floating Point Literal?
Answer
A string literal of the form 0x1.8p1 in SimWB is a HexadecimalFloatingPointLiteral of a double. This notation is used in the Test->InitialCondition files so that the "exact" binary representation of the floating point number can be transmitted over the network in ASCII format.
Hexadecimalfloatingpointliterals are of the form 0x1.8p1 which is used to represent the value 3.
The following extract from [1] which describes the lexical structure of the the HexadecimalFloatingPointLiteral.
HexadecimalFloatingPointLiteral:
HexSignificand BinaryExponent FloatTypeSuffixopt
HexSignificand:
HexNumeral HexNumeral . 0x HexDigitsopt . HexDigits 0X HexDigitsopt . HexDigits
BinaryExponent:
BinaryExponentIndicator SignedInteger
BinaryExponentIndicator:one of
p P
Use the C function strtod to convert a HexadecimalFloatingPointLiteral to a floating point number. Please see the strtod man page for additional information.