Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/10/2010, 16:47
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 14 años, 9 meses
Puntos: 310
Respuesta: Resto De División

Prueba con esta función:
Código Javascript:
Ver original
  1. function modulo(x,n){
  2.  var str;
  3.  if(parseFloat(x)!=parseInt(x)){
  4.   str=x.toString().split('.')[1].length;
  5.   x*=Math.pow(10,str);
  6.   n*=Math.pow(10,str);
  7.  }
  8.  if(parseFloat(n)!=parseInt(n)){
  9.   str=n.toString().split('.')[1].length
  10.   x*=Math.pow(10,str);
  11.   n*=Math.pow(10,str);  
  12.  }
  13.  return (x%n)/Math.pow(10,str);
  14. }
  15. alert(modulo(39.8,3.98));
Saludos (:
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red