Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is the difference between Int and Fix functions?

Both returns the integer portion of a number.

user-image
Question ajoutée par Muhammad Shahid Farooq , Software Engineer, System Integrator , ForeVision Business Solutions
Date de publication: 2016/02/01
Pravin Kadam
par Pravin Kadam , IT Executive , Sun Pharmaceutical Ind. Ltd.

Both Int as well as Fix functions will return the integer part of a decimal number.

But if the decimal number is negative then,

  • Int function will return a number that is1 less than the integer part.
  • Fix function will return the integer part of the negative number as it is

For e.g. Int(9.) =9 and Fix(9.) =9

but Int(-9.) = - and Fix(-9.) = -9

The 'Int' function returns the first negative integer less than or equal to number, whereas 'Fix' function  returns the first negative integer greater than or equal to number.

Faisal Rehman
par Faisal Rehman , Managing Consultant , Systems

The difference between int and fix functions is that if Number is negative, int returns the first negative integer less than or equal to Number, where as fix returns the first negative integer greater than or equal to Number

Saleh Almakki
par Saleh Almakki , Operator , Saudi Aramco

Brifely:1.3 is returned as1 by Int function and returned as2 by Fix function

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?