Created
January 24, 2014 06:43
-
-
Save lukasa1993/8593087 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
a, m=2^b-q, c | |
1) | |
// | |
long SimDiv(long z, int b, int q) | |
{ | |
long zi, mod; | |
mod = (1 << b) - q; | |
zi = (z & ((1 << b) - 1)); | |
zi += (zi >> b) * q; | |
while (zi >= mod ) | |
zi -= mod; | |
return zi; | |
} | |
2) | |
long wkg(int a, long z, int b, int q) { | |
if(c == 0) | |
return SimDiv(z * a, b, q);// tu c=0 | |
else | |
return (a*z+c)&(~(~0<<b)); ; // tu arada es | |
} | |
3) | |
float tanabariganawilebisfunqcia(int a, int b, float gama) { | |
return a + (b - a) * gama; //gama aris sawyisi funqciis shebrunebuli mag tu y=2*x => gama=x=2*y | |
// xolo [a,b] aris shualedi | |
} | |
float uwyveti(float gama) { | |
return gama; //gama aris sawyisi funqciis shebrunebuli mag tu y=2*x => gama=x=y/2 | |
} | |
float diskretuli(float z){//დისკრეტული | |
if( z > 0 && z <= 0.4) return 5; | |
if( z > 0.4 && z <= 0.4 + 0.2) return 0 | |
else return 5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment