mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-28 22:07:49 +00:00
Fixed-point functions can take specific precision (#1086)
This commit is contained in:
27
test/asm/fixed-point-specific.asm
Normal file
27
test/asm/fixed-point-specific.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
MACRO compare
|
||||
print "\3: "
|
||||
if _NARG == 4
|
||||
def v1 = \3(\4q\1, \1)
|
||||
def v2 = \3(\4q\2, \2)
|
||||
elif _NARG == 5
|
||||
def v1 = \3(\4q\1, \5q\1, \1)
|
||||
def v2 = \3(\4q\2, \5q\2, \2)
|
||||
endc
|
||||
opt Q\1
|
||||
print "{.4f:v1} == "
|
||||
opt Q\2
|
||||
println "{.4f:v2}"
|
||||
ENDM
|
||||
|
||||
compare 8, 16, mul, 6.0, 7.0
|
||||
compare 12, 24, div, 115.625, 9.25
|
||||
compare 7, 14, pow, 3.5, 5.5
|
||||
|
||||
compare 4, 8, sin, 0.25
|
||||
compare 5, 9, cos, 0.75
|
||||
compare 6, 10, asin, 1.0
|
||||
compare 7, 11, acos, 0.0
|
||||
|
||||
compare 3, 6, round, 1.75
|
||||
compare 10, 20, ceil, 123.4
|
||||
compare 13, 17, floor, 567.8
|
||||
0
test/asm/fixed-point-specific.err
Normal file
0
test/asm/fixed-point-specific.err
Normal file
10
test/asm/fixed-point-specific.out
Normal file
10
test/asm/fixed-point-specific.out
Normal file
@@ -0,0 +1,10 @@
|
||||
mul: 42.0000 == 42.0000
|
||||
div: 12.5000 == 12.5000
|
||||
pow: 982.5938 == 982.5943
|
||||
sin: 1.0000 == 1.0000
|
||||
cos: 0.0000 == 0.0000
|
||||
asin: 0.2500 == 0.2500
|
||||
acos: 0.2500 == 0.2500
|
||||
round: 2.0000 == 2.0000
|
||||
ceil: 124.0000 == 124.0000
|
||||
floor: 567.0000 == 567.0000
|
||||
Reference in New Issue
Block a user