- Thread starter Ludiq
- Start date

GML:

```
var number = 3.141592
if (frac(number) > 0)
{
show_debug_message("Is fractional");
}
```

Function:

GML:

```
function is_fractional(number)
{
return frac(number) > 0;
}
```

What is the end goal of the process?

Are you trying to find what number to subtract in order to get 520?

Then that's just fract(3121/6)*6;

Are you trying to get the round number 520?

Then just do floor(3212/6).

[Edit] oops forgot the /6

Last edited:

I need to find how many digits I need to go down from 3121 till it gets from 520,1666666666667 to 520 in this case its just 1 digit down from 3121.What is the end goal of the process?

Are you trying to find what number to subtract in order to get 520?

Then that's just fract(3121)*6;

Are you trying to get the round number 520?

Then just do floor(3212/6).

Well that would be fract(3121/6)*6.I need to find how many digits I need to go down from 3121 till it gets from 520,1666666666667 to 520 in this case its just 1 digit down from 3121.

Assuming that by 520 you mean the nex lowest whole number.

Otherwise do ((3121/6)-520) * 6.

Last edited:

Code:

```
function nearest_multiple(number, divisor)
{
return number - number div divisor * divisor;
}
```

Code:

```
function nearest_multiple(number)
{
var a = number - number div 5 * 5;
var b = number - number div 6 * 6;
return min(a,b);
}
```

number div divisor * divisor will round down to the nearest multiple. Thus number - number div divisor * divisor will tell you how much of a difference that is.

Broiki = get_integer_async("Products created?", "");

val = floor(Broiki/6);

val2 = frac(Broiki/6)*6;

And here is the draw event:

draw_text(x,y,"Broiki na chovek " + string(val));

draw_text(x+20,y+20, "Broiki za razpredelqne " + string(val2));

please see thew manual entry for With any such things, your first resort should be the manual.

Broiki = get_integer_async("Products created?", "");

val = floor(Broiki/6);

val2 = frac(Broiki/6)*6;

And here is the draw event:

draw_text(x,y,"Broiki na chovek " + string(val));

draw_text(x+20,y+20, "Broiki za razpredelqne " + string(val2));

but best you make a separate topic for a separate issue.

I have already seen the manual entry for it but I dont understand it thats why im writing here.please see thew manual entry for With any such things, your first resort should be the manual.

but best you make a separate topic for a separate issue.

No, I dont know how to use it which option to choose and what to put in there.

GML:

```
var check = round(num);
if check == num {whole = true;}
```