# Checking numer type

**URL:** <https://forum.xojo.com/t/checking-numer-type/33763>\
**Category:** General\
**Created:** [October 5, 2016, 10:20am UTC](https://forum.xojo.com/t/checking-numer-type/33763 "2016-10-05T10:20:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Horacio\_Vilches](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/ad7895/32.png) [@Horacio\_Vilches](https://forum.xojo.com/u/Horacio_Vilches)\
**Post date:** [October 5, 2016, 10:20am UTC](https://forum.xojo.com/t/checking-numer-type/33763/1 "2016-10-05T10:20:21Z")

</div>

Hello  
Is there any quick way to verify if a passed number is integer or not ? I’d love something like Isinteger() but it doesnt exist, so I was wondering if you know any workarounds, thanks

rgds

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [October 5, 2016, 10:33am UTC](https://forum.xojo.com/t/checking-numer-type/33763/2 "2016-10-05T10:33:57Z")

</div>

Assuming you have a Variant and you want to know if it is an Integer or Double:

`If var.Type = Variant.TypeDouble Then
  ...`

---

<div class="post-metadata">

**Author:** ![Sascha\_S](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_s/32/22328_2.png) [@Sascha\_S](https://forum.xojo.com/u/Sascha_S)\
**Post date:** [October 5, 2016, 10:36am UTC](https://forum.xojo.com/t/checking-numer-type/33763/3 "2016-10-05T10:36:07Z")

</div>

[quote=289947:@Eli Ott]Assuming you have a Variant and you want to know if it is an Integer or Double:

`If var.Type = Variant.TypeDouble Then
  ...`[/quote]

Nice, Eli! Am i right when i say that if it’s not a Variant, Horacio could assign the Value to a Variant and then perform the above Test?

---

<div class="post-metadata">

**Author:** ![Horacio\_Vilches](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/ad7895/32.png) [@Horacio\_Vilches](https://forum.xojo.com/u/Horacio_Vilches)\
**Post date:** [October 5, 2016, 12:54pm UTC](https://forum.xojo.com/t/checking-numer-type/33763/4 "2016-10-05T12:54:16Z")

</div>

Thanks I found an alternative way:  
If a number X is sumultanoisly both ceil and floor then it must be integer.

I hope there are not exceptions. So far it works

Thanks anyways

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [October 5, 2016, 2:02pm UTC](https://forum.xojo.com/t/checking-numer-type/33763/5 "2016-10-05T14:02:30Z")

</div>

> [@289948:@Sascha S](#):
>
> Nice, Eli! Am i right when i say that if it’s not a Variant, Horacio could assign the Value to a Variant and then perform the above Test?

Yes (note that this is different AFAIK as with Auto).

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [October 5, 2016, 3:03pm UTC](https://forum.xojo.com/t/checking-numer-type/33763/6 "2016-10-05T15:03:13Z")

</div>

[quote=289963:@Horacio Vilches]Thanks I found an alternative way:  
If a number X is sumultanoisly both ceil and floor then it must be integer.

I hope there are not exceptions. So far it works

Thanks anyways[/quote]

That will tell you if it contains an Integer VALUE, but NOT if the variable TYPE is integer

and you don’t need to check BOTH…

```auto
If X=floor(x) then its an integer value
if X=ceil(x) then its an integer value
```

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:29pm UTC](https://forum.xojo.com/t/checking-numer-type/33763/7 "2020-10-29T18:29:38Z")

</div>


