Go Down

Topic: Use just the whole number (Read 105 times) previous topic - next topic

antleo

This is likely a really easy problem, but I cant seem to figure out how to accomplish it. I am going to have a pulse input the pulses will be counted and a frequency calculated. Once the Frequency is calculated and set into its variable, i would like to do a math operation that uses only the whole number(not the rounded number) the math to calculate the Frequency could also use just the whole number. basically i want to declare a variable that ignores everything after the decimal point.


Any and all help is appreciated.

Delta_G

basically i want to declare a variable that ignores everything after the decimal point.
Have you tried looking in the reference at the available data types and what kinds of things they hold?  Basically there is only one type that doesn't do what you want.  All the others fit the bill for you on the whole number no rounding thing.  Why don't you take a look at the reference?
If at first you don't succeed, up - home - sudo - enter.

KeithRB

This is exactly what the int type does. It can only be whole numbers. You probably want a long int though. You can make it unsigned if it won't go negative.

antleo

I have looked at the types, a few specified an accuracy, but others did not, which is why i am asking.  Thank you for the help. I knew it was a dumb question with a stupid easy answer.

Delta_G

#4
Sep 14, 2017, 02:36 am Last Edit: Sep 14, 2017, 02:36 am by Delta_G
but others did not,
Can you please point us to the page in the reference for a data type that you speak of so we can get it fixed?  As far as I can see they all tell what types of numbers they'll hold and how large or small they can go. 
If at first you don't succeed, up - home - sudo - enter.

Go Up