some more floating point constants

This commit is contained in:
FeralChild64 committed 2020-02-05 19:37:45 +01:00
1 parent 377b217aec
commit 9b94f30f98
10 files changed
+70 -14

No files matched your search

+17 -14
View File
@@ -243,20 +243,23 @@ Floating point mathematical routines - not official, but well known and broadly
In addition to the routines, the following floating-number constants are available at their original locations:
| Address | Name | Status | Remarks |
| :-------: | :-------------------- | :------: | :------------------------------------------------: |
| `$AEA8` | `const_PI` | DONE | π |
| `$B1A5` | `const_NEG_32768` | DONE | -32768 |
| `$B9BC` | `const_ONE` | DONE | 1.0 |
| `$B9D6` | `const_INV_SQR_2` | DONE | 1 / sqr(2) |
| `$B9DB` | `const_SQR_2` | DONE | sqr(2) |
| `$B9E0` | `const_NEG_HALF` | DONE | -0.5 |
| `$B9E5` | `const_LOG_2` | DONE | log_e(2) |
| `$BAF9` | `const_TEN` | DONE | 10.0 |
| `$BF11` | `const_HALF` | DONE | 0.5 |
| `$BFBF` | `const_INV_LOG_2` | DONE | 1 / log_e(2) |
| `$BFE8` | `const_ONE` duplicate | DONE | 1.0 |
| Address | Name | Status | Remarks |
| :-------: | :-------------------------- | :------: | :-------------------------------------------: |
| `$AEA8` | `const_PI` | DONE | π |
| `$B1A5` | `const_NEG_32768` | DONE | -32768 |
| `$B9BC` | `const_ONE` | DONE | 1.0 |
| `$B9D6` | `const_INV_SQR_2` | DONE | 1.0 / sqr(2.0) |
| `$B9DB` | `const_SQR_2` | DONE | sqr(2.0) |
| `$B9E0` | `const_NEG_HALF` | DONE | -0.5 |
| `$B9E5` | `const_LOG_2` | DONE | log_e(2.0) |
| `$BAF9` | `const_TEN` | DONE | 10.0 |
| `$BF11` | `const_HALF` | DONE | 0.5 |
| `$BFBF` | `const_INV_LOG_2` | DONE | 1.0 / log_e(2.0) |
| `$BFE8` | `const_ONE` duplicate | DONE | 1.0 |
| `$E2E0` | `const_HALF_PI` | DONE | PI / 2.0 |
| `$E2E5` | `const_DOUBLE_PI` | DONE | PI * 2.0 |
| `$E2EA` | `const_QUARTER` | DONE | 0.25 |
| `$E309` | `const_DOUBLE_PI` duplicate | DONE | PI * 2.0 |
### Other unofficial BASIC routines/locations
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - a constant, for documentation see:
// - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True
//
const_HALF_PI:
put_const_HALF_PI()
+1
View File
@@ -0,0 +1 @@
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - a constant, for documentation see:
// - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True
//
const_DOUBLE_PI:
put_const_DOUBLE_PI()
+1
View File
@@ -0,0 +1 @@
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - a constant, for documentation see:
// - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True
//
const_QUARTER:
put_const_QUARTER()
+1
View File
@@ -0,0 +1 @@
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
@@ -0,0 +1,10 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - a constant, for documentation see:
// - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True
//
put_const_DOUBLE_PI() // duplicated constant - no label
+1
View File
@@ -0,0 +1 @@
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
+3
View File
@@ -43,13 +43,16 @@ std::vector<ConstEntry> GLOBAL_constants =
// - https://www.c64-wiki.com/wiki/BASIC-ROM
// Computes Mapping the Commodore 64, pages 103, 105, 113, 114, 116
ConstEntry( "QUARTER", 0.25 ),
ConstEntry( "HALF", 0.5 ),
ConstEntry( "NEG_HALF", -0.5 ),
ConstEntry( "ONE", 1.0 ),
ConstEntry( "TEN", 10.0 ),
ConstEntry( "NEG_32768", -32768.0 ),
ConstEntry( "HALF_PI", M_PI / 2.0 ),
ConstEntry( "PI", M_PI ),
ConstEntry( "DOUBLE_PI", M_PI * 2.0 ),
ConstEntry( "SQR_2", std::sqrt(2.0) ),
ConstEntry( "INV_SQR_2", 1.0 / std::sqrt(2.0) ),
ConstEntry( "LOG_2", std::log(2.0) ),