# Error when asking for sign of positive Irrational

**URL:** <https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015>\
**Category:** General Usage\
**Tags:** numbers\
**Created:** [February 24, 2022, 12:47pm UTC](https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015 "2022-02-24T12:47:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [February 24, 2022, 12:47pm UTC](https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015/1 "2022-02-24T12:47:27Z")

</div>

This is an error

```julia
julia> sign(π)
ERROR: InexactError: Bool(-1)
Stacktrace:
 [1] Bool
   @ ./float.jl:158 [inlined]
 [2] convert
   @ ./number.jl:7 [inlined]
 [3] oftype(x::Bool, y::Int64)
   @ Base ./essentials.jl:396
 [4] sign(x::Irrational{:π})
   @ Base ./number.jl:162
 [5] top-level scope
   @ REPL[1]:1

```

but this is not

```julia
julia> sign(-π)
-1.0

```

because here (in base/number.jl)

```julia
sign(x::Real) = ifelse(x < zero(x), oftype(one(x),-1), ifelse(x > zero(x), one(x), typeof(one(x))(x)))

```

Is this because `one(π) == true` and it’s trying to cast `-1` to a `Bool`?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 24, 2022, 4:17pm UTC](https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015/2 "2022-02-24T16:17:59Z")

</div>

[https://github.com/JuliaLang/julia/pull/37949](https://github.com/JuliaLang/julia/pull/37949)

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [February 24, 2022, 7:43pm UTC](https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015/3 "2022-02-24T19:43:45Z")

</div>

Thanks, hopefully this can be merged.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 24, 2022, 10:51pm UTC](https://discourse.julialang.org/t/error-when-asking-for-sign-of-positive-irrational/77015/4 "2022-02-24T22:51:23Z")

</div>

Today, we have started observing more irrational behavior:

```julia
πᵤₜᵢₙ isa Irrational
true
sign(πᵤₜᵢₙ)
♎

```
