# Test integerness

```ruby
func is_int (n, tolerance=0) {
    !!(abs(n.real.round + n.imag - n) <= tolerance)
}

%w(25.000000 24.999999 25.000100 -2.1e120 -5e-2 Inf NaN 5.0+0.0i 5-5i).each {|s|
    var n = Number(s)
    printf("%-10s  %-8s  %-5s\n", s,
        is_int(n),
        is_int(n, tolerance: 0.00001))
}
```

## Output:

```
25.000000   true      true 
24.999999   false     true 
25.000100   false     false
-2.1e120    true      true 
-5e-2       false     false
Inf         false     false
NaN         false     false
5.0+0.0i    true      true 
5-5i        false     false
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/programming_tasks/t/test_integerness.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
