-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add classes to uni/lib that implement fixed point arithmetic.
If operator overloading is configured the classes will support it. Otherwise, the alternative methods (add, sub etc.) can be used in place of the infix operators. Test code is in tests/unicon. There are two sets of tests, one with overloading and one without (one is a superset of the other). Unidoc documentation is embedded in the source code.
- Loading branch information
Showing
9 changed files
with
1,249 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
################################################################################# | ||
# | ||
# This file is released under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE | ||
# (LGPL) version 2. The licence may be found in the root directory of the Unicon | ||
# source directory in the file COPYING. | ||
# | ||
# Fixed Point Arithmetic class tests (without operator overloading) | ||
# -------------------------------------------------------------------------------- | ||
|
||
procedure main(args) | ||
if not(&features == "large integers") then | ||
stop("large integers not supported") | ||
|
||
runTests(args) | ||
end | ||
|
||
# Turn off operator overloading | ||
$undef _OVLD | ||
$include "FxPtTests.icn" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
################################################################################# | ||
# | ||
# This file is released under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE | ||
# (LGPL) version 2. The licence may be found in the root directory of the Unicon | ||
# source directory in the file COPYING. | ||
# | ||
# Fixed Point Arithmetic class tests (with operator overloading) | ||
# -------------------------------------------------------------------------------- | ||
|
||
procedure main(args) | ||
if not(&features == "large integers") then | ||
stop("large integers not supported") | ||
|
||
if not (&features == "operator overloading") then | ||
stop("operator overloading not supported") | ||
|
||
runTests(args) | ||
end | ||
|
||
$include "FxPtTests.icn" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
include ../Makedefs | ||
|
||
TARGETS=$(patsubst %.icn,%,$(wildcard *.icn)) | ||
|
||
SKIP= tester FxPtTests\ | ||
audio dbi list_test nlm q rec test testnlm clin_err hello mintest ovld q2 sel to | ||
|
||
Test: DoTest | ||
|
||
include ../Makefile.test | ||
|
||
FxPtTest: FxPtTest.icn tester.u | ||
|
||
FxPtTest_OVLD: FxPtTest_OVLD.icn tester.u | ||
|
||
tester.u: tester.icn | ||
$(UC) -s -u -c $^ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-------------------------------------------------- | ||
Fixed Point Tests Start | ||
Fixed Point Tests Passed = 454 Failed = 0 | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-------------------------------------------------- | ||
Fixed Point Tests Start | ||
Fixed Point Tests Passed = 586 Failed = 0 | ||
-------------------------------------------------- |
Oops, something went wrong.