aboutsummaryrefslogtreecommitdiff
path: root/Semestr 3/anm/cordic/trig.jl
diff options
context:
space:
mode:
authorFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
committerFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
commitc5fcf7179a83ef65c86c6a4a390029149e518649 (patch)
treed29ffc5b86a0d257453cedcf87d91a13d8bf3b0d /Semestr 3/anm/cordic/trig.jl
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 3/anm/cordic/trig.jl')
-rw-r--r--Semestr 3/anm/cordic/trig.jl43
1 files changed, 0 insertions, 43 deletions
diff --git a/Semestr 3/anm/cordic/trig.jl b/Semestr 3/anm/cordic/trig.jl
deleted file mode 100644
index bf1dc2c..0000000
--- a/Semestr 3/anm/cordic/trig.jl
+++ /dev/null
@@ -1,43 +0,0 @@
-include("cordic.jl")
-include("taylor.jl")
-using Printf
-
-# preprocessing
-cordic.main()
-
-function rel_error(x, y)
- return abs((x - y) / y)
-end
-
-function test_real_sin(arg, trig_func)
- @printf("Testing relative error for function %s and argument %f.\n", String(Symbol(trig_func)), arg)
- res = trig_func(arg, 0)
- real_res = sin(arg)
- @printf("Result: %.50f\n", res[1])
- @printf("LibRes: %.50F\n", real_res)
- @printf("Relative error: %e\n", rel_error(res[1], real_res))
-end
-
-function test_complex_sin(arg_real, arg_imag, trig_func)
- @printf("Testing relative error for function %s and argument %f + %f i.\n", String(Symbol(trig_func)), arg_real, arg_imag)
- res = trig_func(arg_real, arg_imag)
- real_res = sin(arg_real + arg_imag * im)
- @printf("Result: %.50f + %.50f i\n", res[1], res[2])
- @printf("LibRes: %.50f + %.50f i\n", real(real_res), imag(real_res))
- @printf("Relative error: %e, %e\n", rel_error(res[1], real(real_res)), rel_error(res[2], imag(real_res)))
-end
-
-test_real_sin(0.5, taylor.csin)
-test_real_sin(0.5, cordic.approx_sin)
-
-
-test_real_sin(0.001, taylor.csin)
-test_real_sin(0.001, cordic.approx_sin)
-
-
-test_real_sin(0.1, taylor.csin)
-test_real_sin(0.1, cordic.approx_sin)
-
-
-# test_complex_sin(0.5 + 2pi, 0.5, taylor.csin)
-# test_complex_sin(100, 0.5, taylor.csin) \ No newline at end of file