Commit Graph

40 Commits

Author SHA1 Message Date
H. Peter Anvin
63ebf1650c For consistency, allow 0p.. prefix for packed BCD
Allow 0p... to be used as a prefix, for analogy with base conversion.
2008-07-03 20:16:07 -07:00
H. Peter Anvin
45f22924ea float: support packed-BCD constants in 'dt' statements
Support packed-BCD constants in 'dt' statements (and elsewhere 80-bit
floating point is handled), using MASM syntax (terminal 'p').
2008-07-03 20:12:37 -07:00
H. Peter Anvin
5aa689f80d float: fix buffer overrun
Fix a buffer overrun; generally causing hexadecimal constants to be
incorrectly rejected.
2008-07-03 20:11:30 -07:00
H. Peter Anvin
5a99f4f2f0 float.c: BR 1879670: fix output byte order
The fix for the memory overwrite output the bytes in the wrong order.
Fix.
2008-01-25 08:11:23 -08:00
H. Peter Anvin
f7bd02a07f float.c: fix memory overwrite with 8-, 16- or 80-bit constants
We incorrectly clobbered 4 extra bytes when serializing 8-, 16- or
80-bit constants.  Be less smart, but actually correct.
2008-01-21 16:19:52 -08:00
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
H. Peter Anvin
c9588ea1bc Make the definition for float_const() match the prototype
The definition for float_const() had int32_t, the prototype had only
int.  We only care about the sign, so int makes more sense.
2007-11-17 14:35:19 -08:00
H. Peter Anvin
d1fb15c154 Address data is int64_t; simplify writing an address object
Address data is always int64_t even if the size itself is smaller;
this was broken on bigendian hosts (still need testing!)

Create simple "write sized object" macros.
2007-11-13 09:37:59 -08:00
H. Peter Anvin
136dcdbd42 float.c: all warnings and errors are pass 1 only
None of the floating-point errors or warnings are anything but pass 1
only; use the ERR_PASS1 flag to capture that.
2007-11-12 18:26:31 -08:00
H. Peter Anvin
4a63c20755 float.c: handle round-up-to-denorm correctly. 2007-10-30 01:13:09 -07:00
H. Peter Anvin
2ce0274303 Use a 32-bit floating-point limb size; support 8-bit float
Use a 32-bit limb size ("like a digit, but bigger") for floating-point
conversion.  This cuts the number of multiplications per constant by a
factor of four.

This means supporting fractional-limb-sized numbers, so while we're at
it, add support for 8-bit floating point numbers (apparently used in
graphics and in audio compression applications.)
2007-10-29 20:20:12 -07:00
H. Peter Anvin
f41aef273b Decimal floating point can also start with 0. 0e 0E
A floating point number starting with 0. 0e or 0E is still decimal.
Make it easier by falling back to the standard decimal conversion
routine for anything not recognized as a radix prefix.
2007-10-22 19:37:36 -07:00
H. Peter Anvin
c65a2f634b Support binary and octal floating-point
For consistency, support binary and octal floating-point, and accept
a "0d" or "0t" prefix for decimal floating-point.  However, we do not
accept a binary exponent (p) for a decimal mantissa, or vice versa.
2007-10-22 17:34:10 -07:00
H. Peter Anvin
bea0bbb62c More consistent handling of radix letters
Allow any radix letter from the set [bydtoqhx] to be used either
"Intel-style" (0...x) or "C-style" (0x...).  In Intel style, the
leading 0 remains optional as long as the first digit is in the range
0-9.

As a consequence, allow the prefix "0h" for hexadecimal floating
point.
2007-10-22 16:53:48 -07:00
H. Peter Anvin
3b2ad1bc37 float.c: correct exponent capping
Actually enforce the exponent capping, as opposed to only enforcing it
to within a factor of 10.  Furthermore, continue to scan the string in
order to check for invalid characters.

Finally, 16384 is too tight of a bound for a binary exponent: it's a
tight bound, but the shift added due to the digit string can move the
cap into the active region (±16383).  Thus, change it to 20000 to be
on the safe side.
2007-10-21 15:33:01 -07:00
H. Peter Anvin
449e04b330 Allow $-prefixed hexadecimal FP as an alternative to 0x
Since we allow the prefix $ instead of 0x for integer constants, do
the same for floating point.  No suffix support at this time; we may
want to consider if that would be appropriate.
2007-10-19 18:33:57 -07:00
H. Peter Anvin
7065309739 Formatting: kill off "stealth whitespace"
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness.  Do a source-wide pass to get rid of it.
2007-10-19 14:42:29 -07:00
H. Peter Anvin
3514ad0e6c float.c: mark read_exponent() static
read_exponent() is not used outside float.c; mark static
2007-10-19 14:17:51 -07:00
H. Peter Anvin
2ef4aac272 Allow underscores in numbers; better detection of FP
- Allow underscores as group separators in numbers, for example:
  0x1234_5678 is now a legal number.  The underscore is just ignored,
  it adds no meaning.
- Recognize dotless floating-point numbers, such as "1e30".  This
  entails distinguishing hexadecimal numbers in the scanner, since
  e.g. 0x1e30 is a perfectly legitimate hex constant.
2007-10-19 13:10:46 -07:00
H. Peter Anvin
f6c9e65d4f Implement floating-point option control directive
New directive [FLOAT] with associated standard macros; allows the
setting to be saved and restored.
2007-10-16 14:40:27 -07:00
H. Peter Anvin
fab3a6c9de Floating-point warning fixes; fix round-to-overflow
Actually generate the appropriate floating-point warnings, and only
one per assembly, pretty please.

Correct the round-to-overflow condition; as written all numbers with a
positive exponent were considered overflows!
2007-10-16 11:48:07 -07:00
H. Peter Anvin
125c878e96 Handle rounding of denorms correctly; make fp overflow a warning
- Handle rounding of denorms correctly
- Make fp overflow a warning, not an error (produces Inf)
- Make fp warnings controllable
2007-10-16 11:32:58 -07:00
H. Peter Anvin
4da5b8c2dd Refactor floating-point formatting code; fix 80-bit denorms
Refactor the floating-point formatting code so that the 80-bit format
can be supported with common code.  This fixes 80-bit denorms as a
side effect; the shift value in 80-bit denorms was completely wrong.
2007-10-16 10:32:57 -07:00
H. Peter Anvin
214f549c5c New floating-point conversion routines
Substitute in nasm64developer's "acfloat4" routine.  This
floating-point conversion routine is not perfect (it gets a fair
number of LSB errors), but the old NASM code was just plain broken.
nasm64developer's code at least gets within ±1 LSB.
2007-10-15 19:46:32 -07:00
H. Peter Anvin
6867acc18e Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler.  Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
2007-10-10 14:58:45 -07:00
H. Peter Anvin
cdb227fa71 float.c: correct the exponent
We would accidentally produce an exponent which was exactly +1 from
the correct one.
2007-10-04 22:51:08 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
82f9f63378 float.c: clear off uninitialized warning
Remove uninitialized warning (harmless, but annoying.)
2007-09-24 20:53:48 -07:00
H. Peter Anvin
f48bc6fb48 Support generating NaNs and infinities
Support generating NaNs and infinities as part of floating-point
constants.
2007-09-18 21:55:56 -07:00
H. Peter Anvin
26976a187f Fix error-reporting in hexadecimal floating-point numbers 2007-09-18 18:33:17 -07:00
H. Peter Anvin
fe2177fe42 Support C99-style hexadecimal floating point.
Add support for C99-style hexadecimal floating point.  The format is
0x <hexadecimal mantissa> p <binary exponent>.  0x1.0e+1 thus is the
same as 2.0.
2007-09-18 18:31:26 -07:00
H. Peter Anvin
e31747e95b Unify all standard IEEE floating-point formats; add 128-bit
Unify all the standard IEEE formats into one function, add support for
IEEE standard 128-bit floating point numbers.

The 80-bit format is still special since it explicitly represents the
integer portion.
2007-09-18 17:50:34 -07:00
H. Peter Anvin
141d7cf68d Support 16-bit IEEE floating point; used in SSE5
SSE5 supports standard IEEE 16-bit floating point, so we should
support that too.
2007-09-18 16:39:03 -07:00
Keith Kanios
a6dfa78b78 Fixed distinction between char and int8_t data types. 2007-04-13 16:47:53 +00:00
Keith Kanios
b7a89544d0 General push for x86-64 support, dubbed 0.99.00. 2007-04-12 02:40:54 +00:00
H. Peter Anvin
e2c80181b6 Apply Nindent to all .c and .h files 2005-01-15 22:15:51 +00:00
H. Peter Anvin
aa19cc2372 Add ieee_ prefix to filenames with otherwise highly ambiguous names;
esp round() which is a standard C function.
2004-12-29 00:41:28 +00:00
H. Peter Anvin
eba20a73f2 NASM 0.98p3 2002-04-30 20:53:55 +00:00
H. Peter Anvin
6768eb71d8 NASM 0.95 2002-04-30 20:52:26 +00:00
H. Peter Anvin
ea6e34db64 NASM 0.91 2002-04-30 20:51:32 +00:00