Hong-Phuc Bui
2025-10-17 0079221776106e3ca91076938e80d37e38eacc29
textbased-programms/taylor-serie-trigonometry.js
@@ -5,8 +5,8 @@
import {terminal} from "./dfhi.js";
window.main = function(...argv) {
   //const x = Number.parseFloat(argv[0]);
window.main = (...argv) => {
   //const x = Number(argv[0]);
   //const x_rad = x * Math.PI / 180;
   const alpha = [0, 30, 45, 60, 90];
   alpha.map(x => x*Math.PI/180).forEach( a => {
@@ -17,13 +17,13 @@
};
function makeTest(testName, value, impl, ref) {
const makeTest = (testName, value, impl, ref) => {
   const result = impl(value);
   const expected = ref(value);
   terminal.print(`${testName} result: ${result} expected : ${expected}\n`);
}
function sin(x) {
const sin = (x) => {
   let sum = x;
   let term = -(x**3 / 6);
   const xsqr = x*x;
@@ -36,7 +36,7 @@
   return sum;
}
function cos(x) {
const cos = (x) => {
   let sum = 1;
   const xsqr = x*x;
   let g = 2;