1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-05-28 08:41:33 +00:00

Slight adjustment to FPSTR_FLEX formatting

This commit is contained in:
David Schmenk 2023-02-25 10:29:30 -08:00
parent 177c621364
commit f4ce23a3cf
4 changed files with 9 additions and 8 deletions

Binary file not shown.

View File

@ -233,15 +233,15 @@ export def ext2str(ext, str, intdigits, fracdigits, format)
//
// Underflow
//
dp = -fracdigits
dp = -fracdigits - 1
fin
fin
if format & FPSTR_FLEX and (dp <= -fracdigits or dp >= (format & FPSTR_FIXED ?? intdigits :: numdigits))
if format & FPSTR_FLEX and (dp < -fracdigits or dp > (format & FPSTR_FIXED ?? intdigits :: numdigits))
//
// Print as exponent if over/underflow fixed digits
//
if numdigits < 8; numdigits = 8; fin
return ext2str(ext, str, 1, numdigits - 8, FPSTR_EXP | (format & FPSTR_STRIP))
if numdigits < 7; numdigits = 7; fin
return ext2str(ext, str, 1, numdigits - 7, FPSTR_EXP | (format & FPSTR_STRIP))
fin
//
// Convert as floating point

View File

@ -4,7 +4,7 @@ include "inc/fpstr.plh"
var xT[t_extended]
char sT[32] // extra space
byte str = "123456789.123456789E+80"
byte str = "123456789.123456789"
byte i
// mul div
@ -19,7 +19,7 @@ def test(iM, iD)#0
puti(iM); putc('/'); puti(iD)
if iD<10; putc(' '); fin
puts("=>")
ext2str(@xT,@sT,6,9,FPSTR_FLEX|FPSTR_FIXED) // fixed
ext2str(@xT,@sT,9,9,FPSTR_FLEX|FPSTR_FIXED) // fixed
puts(@sT); putc('[')
puti( sT); putc(']')
putln

View File

@ -1299,7 +1299,8 @@ end
def parse_module#0
init_idglobal
init_idlocal
puts("Data+Code buffer size = "); puti(codebufsz); putln
puts("Data+Code buffer size = "); puti(codebufsz); putln; putln
puts(@relfile);
if nextln
//
// Compile module
@ -1310,7 +1311,7 @@ def parse_module#0
emit_codeseg
puti(codeptr - codebuff); puts(@bytesln)
while parse_defs; nextln; loop
puts("INIT:")
puts("INIT:");
entrypoint = codeptr
prevstmnt = 0
init_idlocal