mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-23 08:32:39 +00:00
Added logarithm skeleton
This commit is contained in:
parent
57cdb8dab4
commit
5b7ba4e2d8
24
src/test/kc/logarithm.kc
Normal file
24
src/test/kc/logarithm.kc
Normal file
@ -0,0 +1,24 @@
|
||||
// Natural logarithm calculation by approximating polynomial
|
||||
// https://stackoverflow.com/questions/9799041/efficient-implementation-of-natural-logarithm-ln-and-exponentiation
|
||||
// 1.7417939 + (2.8212026 + (-1.4699568 + (0.44717955 - 0.056570851 * x) * x) * x) * x
|
||||
// Works well for numbers in the range 1.0 - 2.0
|
||||
// 0.056570851 463.4284114 463
|
||||
// 0.44717955 3663.294874 3663
|
||||
// -1.4699568 -12041.88611 -12042
|
||||
// 2.8212026 23111.2917 23111
|
||||
// -1.7417939 -14268.77563 -14269
|
||||
|
||||
import "multiply"
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Calculate natural logarithm for a number between 1.0 and 2.0 using an approximating polynomial
|
||||
// Uses a number format where the range of signed int [-32768;32768[ represents [-4;4[
|
||||
void ln_sub(signed int x) {
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user