Julia: Broken booleans as numbers?

Created on 17 May 2017  ·  3Comments  ·  Source: JuliaLang/julia

A recent change broke

julia> ndigits(true)
1

I'm not too fussed about this, and can understand why it didn't go through a deprecation cycle. But I was under the impression that the shift from Bool <: Integer to Bool as a separate concept has yet to happen. If so, I think it's better to continue to support integer operations on Bool.

bug

Most helpful comment

I think it should be fixed. It's weird for ndigits(false) to give 1 but ndigits(true) to throw an error.

All 3 comments

Hmm, on further investigation it was https://github.com/JuliaLang/julia/pull/16841 which only changed ndigits. I had thought that there was a more comprehensive change, but the breakage of only ndigits seems like too minor an issue to care about.

Sorry I was not aware I broke that one, but I agree it's too minor to fix if the plan is to switch away from Bool <: Integer.

I think it should be fixed. It's weird for ndigits(false) to give 1 but ndigits(true) to throw an error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thofma picture thofma  ·  3Comments

manor picture manor  ·  3Comments

Keno picture Keno  ·  3Comments

sbromberger picture sbromberger  ·  3Comments

felixrehren picture felixrehren  ·  3Comments