mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-06-10 02:29:30 +00:00
45 lines
800 B
Plaintext
45 lines
800 B
Plaintext
include "inc/cmdsys.plh"
|
|
include "inc/sane.plh"
|
|
include "inc/fpstr.plh"
|
|
|
|
var xT[t_extended]
|
|
char sT[32] // extra space
|
|
byte str = "123456789.123456789"
|
|
byte i
|
|
|
|
// mul div
|
|
def test(iM, iD)#0
|
|
sane:saveZP()
|
|
sane:op2FP(FFINT|FOMUL, @xT, @iM)
|
|
sane:op2FP(FFINT|FODIV, @xT, @iD)
|
|
sane:restoreZP(0)
|
|
|
|
putc('x')
|
|
if iM<10; putc(' '); fin
|
|
puti(iM); putc('/'); puti(iD)
|
|
if iD<10; putc(' '); fin
|
|
puts("=>")
|
|
ext2str(@xT,@sT,9,9,FPSTR_FLEX|FPSTR_FIXED) // fixed
|
|
puts(@sT); putc('[')
|
|
puti( sT); putc(']')
|
|
putln
|
|
end
|
|
|
|
puts("Float Format Text\n\n")
|
|
sane:initFP()
|
|
strcpy(@sT,@str); str2ext(@sT,@xT)
|
|
puts("begin: ")
|
|
puts(@sT); putc('[')
|
|
puti( sT); putc(']')
|
|
putln
|
|
test(1,1)
|
|
for i=1 to 10
|
|
test(32000,1)
|
|
next
|
|
strcpy(@sT,@str); str2ext(@sT,@xT)
|
|
for i=1 to 10
|
|
test(1,2)
|
|
next
|
|
puts("Done\n")
|
|
done
|