What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-29 12:20:02
javascript quick float to integer
function float2int (value) { return value | 0; } float2int(3.75); //3 - always just truncates decimals //other options Math.floor( 3.75 );//3 - goes to floor , note (-3.75 = -4) Math.ceil( 3.75 ); //4 - goes to ceiling, note (-3.75 = -3) Ma... Add solution -
Javascript 2021-09-26 11:07:03
how to round numbers in javscript
//There are meny ways of rounding... Math.floor(5.5) //Answer 5, it alwas rounds down. Math.round(5.5) //Answer 6, it simpily rounds to the closest whole number. Math.ceil(5.5) //Answer 6, it alwas rounds up. //You can do more things too... Math.floor(5.... Add solution -
Other 2021-09-25 01:53:02
flat top pam matlab code
t=1; fs=1000; n=[0:1/fs:t-1/fs]; m=cos(2*pi*fm*n); duty=20; s=0.5*square(2*pi*fc*n , duty)+0.5; period_samp=length(n)/fc; in=[1:period_samp:length(n)]; on_samp=ceil(period_samp*duty/100); pam=zeros(1,length(n)); for i=1:length(in) pam(in(i):in(i)+on_samp... Add solution -
Python 2021-09-22 19:58:03
prime number and fibonacci series in python
import math num = int(input()) def isPrime(num): if num == 2 or num == 3 or num == 5 or num == 7: prime = True elif num % 2 == 0 or num % 3 == 0 or num % 5 == 0 or num % 7 == 0: prime = False elif math.ceil(math.sqrt(num)) -... Add solution