Get the whole numbers from a series of numbers


#1

Hi smart people,

Is there a way to isolate the whole numbers (no decimals) from a list of numbers without picking them one by one?

In the image below, I just want the highlighted ones to be in my new list… I don’t want to pick by index number because this list will change depends on the slider value…

Thank you so much.
*PS My brain is not working anymore - sorry if this problem is too simple…

Would appreciate any help. Thank you so much!


#2

In theory you’re trying to pick out integers in a list containing both integers and doubles :slight_smile:

(I’ll try to make a solution suggestion in a second) :slight_smile:


#3

Yes, thank you so much!

I was trying to find if there’s an “is integer” node so I can filter by boolean but there’s no such node…or is there?

Maybe there’s a mathematical logic that will allow me to do this, but again my brain is not working anymore… :smile: thank you so much for helping out


#4

A little logic is always good :slight_smile:


This can be simplified like so:

t2 = x / y;
t5 = Math.Floor(t2);
t6 = DSCore.List.FilterByBoolMask(t2, t2 == t5);
Dictionary.ValueAtKey(t6, "in");

#5

See if Object.Type can help you :slight_smile:

@Jonathan.Olesen’s method is very good, as it do not depend on the type of the variables (3.0 is not an integer, but you still want to filter it) :slight_smile:


#6

The beauty about my method is that it does not care if you have doubles or integers :wink: as the division will cause even integers to come out as floats/doubles :slight_smile:


#7

ahah!!!

This is what I’m looking for!! Thank you so much! I can now go home :smiley:

Thank you!