# Disabling DomainError (in sqrt())?

**URL:** <https://discourse.julialang.org/t/disabling-domainerror-in-sqrt/88755>\
**Category:** General Usage\
**Tags:** error, math, inbounds\
**Created:** [October 14, 2022, 9:14pm UTC](https://discourse.julialang.org/t/disabling-domainerror-in-sqrt/88755 "2022-10-14T21:14:41Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [October 17, 2022, 3:06pm UTC](https://discourse.julialang.org/t/disabling-domainerror-in-sqrt/88755/13 "2022-10-17T15:06:40Z")

</div>

> [@bremez](#):
>
> Also interesting! Is it indeed a 128 bits limitation, or a 2 operands limitation? i.e. would it be able to operate on four `Float32`s?

Yes, four `Float32`s.

> [@bremez](#):
>
> Just out of curiosity, how do the check implementations differ so that one is optimizable and one is not?

You can use `Cthulhu.@descend` to look at the typed Julia code, LLVM IR, and assembly.

> [@bremez](#):
>
> Indeed, the issue was that I am calling `sqrt` on `Int64`s. I was not aware that this is considered a “weird type” - are there any other pathologies I should be aware of? With root-taking, perhaps the correct way to go about this is to manually convert to a floating type and then call `@fastmath sqrt()`?

`Int`s are for things like indexing arrays, not numerical computation IMO.  
The integer has to be converted to a floating point number first before getting the root, anyway. It must also be converted before operating on it with other floating point numbers.  
Other possible issues are things like overflow: [The speed of light is an integer. Why should we care?](https://discourse.julialang.org/t/the-speed-of-light-is-an-integer-why-should-we-care/40108)

---

_[View the full topic](https://discourse.julialang.org/t/disabling-domainerror-in-sqrt/88755)._
