Wpisy w kategorii : C


my own sin and cos implementation in C / C++

Here is my own implementation of sin and cos functions in C language. It's may be usedful if you want to compile very small exe file, without using standard libc.
  1. float cos(float x){
  2. if( x < 0.0f )
  3. x = -x;
  4. while( M_PI < x )
  5. x -= M_2_PI;
  6. return 1.0f - (x*x/2.0f)*( 1.0f - (x*x/12.0f) * ( 1.0f - (x*x/30.0f) * (1.0f - x*x/56.0f )));
  7. }
  9. float sin(float x){return cos(x-M_PI_2);}

how to compile 64KB exe in visual 2012 without CRT

CRT (C Run Time) is library installed with visual studio that is usually required by exe files created by visual studio.
If you just copy exe file to other computer it may not work. You need to install on other computer CRT.
So if you want to create 64KB intro for demoscene that don't need any aditional dll's then you need to go around it.

jak uzyc 4klang 3.0.1

1. Po otrzymaniu plikow 4kalng.h i 4klang.inc od muzyka, skopiuj je do 4klang_sources/3.0.1/
2. Uruchom komende nasmw.exe -fwin32 -o "4klang.obj" 4klang.asm
3. Skopiuj plik 4klang.obj do folderu z projektem Visual C++.
4. Idz do ustawien projektu / Linker / Input / Additional Dependencies, i dodaj tam 4klang.obj.
5. Skopiuj przykladowy plik *.cpp z przykladow 4klang do twojego kodu C++.