MATH FUNCTIONS 
Author Message
 MATH FUNCTIONS

Trunc would return the integer part of the number.   Turns a real number
into an integer. So 3 and 27
Frac returns the fractional part of a number.  So .1416 and .1888
Int returns the whole number part and the result is a real number.  So 3.0
and 27.0

--
Patti Handwerk

Quote:

>Hi,

>I wish to know how work the functions

>Trunc(x)
>Int(x)
>Frac(x)

>...so I can adapt a Pascal program in C/C++
>What each function is suppose to return if
>X=3.1416 and
>X=-27.1888 for example.

>Thank you very much!

>JGR



Wed, 18 Jun 1902 08:00:00 GMT  
 MATH FUNCTIONS
Hi,

I wish to know how work the functions

Trunc(x)
Int(x)
Frac(x)

...so I can adapt a Pascal program in C/C++
What each function is suppose to return if
X=3.1416 and
X=-27.1888 for example.

Thank you very much!

JGR



Wed, 18 Jun 1902 08:00:00 GMT  
 MATH FUNCTIONS

Quote:

> Hi,

> I wish to know how work the functions

> Trunc(x)

truncates the number, ie you get the part prior to the "."
without rounding

-> 3, -27

Quote:
> Int(x)

rounds to the closest integer

-> 3, -27

Quote:
> Frac(x)

returns the fraction, ie the part after the "."

-> 0.1416, -0.1888 (this is my guess, I didn't test whether
it includes the minus)

Quote:
> ....so I can adapt a Pascal program in C/C++
> What each function is suppose to return if
> X=3.1416 and
> X=-27.1888 for example.

 -Mike


Wed, 18 Jun 1902 08:00:00 GMT  
 MATH FUNCTIONS



Quote:

> > Hi,

> > I wish to know how work the functions

> > Trunc(x)

> truncates the number, ie you get the part prior to the "."
> without rounding

> -> 3, -27

> > Int(x)

> rounds to the closest integer

                -INF!
Int(-3.1) = -4.0
Int(3.1) = 3.0
Int (-3.7) = -4.0
Int (-3.1) = 3.0
but isn't an integer at last. if you want to have an integer, you need
trunc(int(x))!

If you want to round to the closest integer, just use round!

- Show quoted text -

Quote:

> -> 3, -27

> > Frac(x)

> returns the fraction, ie the part after the "."

> -> 0.1416, -0.1888 (this is my guess, I didn't test whether
> it includes the minus)

> > ....so I can adapt a Pascal program in C/C++
> > What each function is suppose to return if
> > X=3.1416 and
> > X=-27.1888 for example.

>  -Mike



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. seeking help with math function

2. Math functions in Assembly language.

3. trig1.zip TP 6.0 trigonometry and math functions TPU, S.O'Malley

4. Non-reentrant math functions

5. Need help : log(x),x^y and oher math-functions

6. ReportSmith - Math Functions

7. Turbo Pascal for Windows and Round function and randomize function

8. why define a function w/in another function?

9. functions as function

10. functions as function

11. BP7: Function of type function

12. Pass Functions into Function

 

 
Powered by phpBB® Forum Software