Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the difference between Int and Fix functions?

Both returns the integer portion of a number.

user-image
Question added by Muhammad Shahid Farooq , Software Engineer, System Integrator , ForeVision Business Solutions
Date Posted: 2016/02/01
Pravin Kadam
by 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
by 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
by Saleh Almakki , Operator , Saudi Aramco

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

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.