# Why doesn't \`^\` promote its arguments?

**URL:** <https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444>\
**Category:** General Usage\
**Created:** [February 14, 2022, 4:29pm UTC](https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444 "2022-02-14T16:29:00Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [February 15, 2022, 11:20am UTC](https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444/14 "2022-02-15T11:20:34Z")

</div>

> [@Federico\_Marotta](#):
>
> The same promotion occurs for other operations like `-` , `*` , and `/` , but _not_ for `^` .

No, `-` , `*` will always give integers for integer input, while `/` will always give Float64, and when b in a^b is negative (and since it is special-cased for the sign, I’m guessing it was chosen to ignore type of b when positive, unless when its BigInt). In both cases Rational is arguable more correct, but slower, so tat was decided.

See my thread (`/` is the most problematic operator, and simply promoting to type of either a or b is not enough, nor is it enough for any other operator, just most likely to be enough):

> [@Potential solution to the overflow problem; 64-bit considered harmful, 32- or 21-bit better](https://discourse.julialang.org/t/potential-solution-to-the-overflow-problem-64-bit-considered-harmful-32-or-21-bit-better/69918):
>
> We can implement FastIntegers.jl, faster than the current default Int64 and eliminate overflows from the language by leveraging Julia’s type system, and no hardware support is needed. As a package it of course doesn’t change the language itself, it would be a prototype, or actually very useful as such, but even better if integrated into the language. That could happen for Julia 2.0 but not if people are against the idea. If we consider even very simple functions: double(x) = 2x then it’s not …

See very long discussion:

> [@Discussion about integer overflow](https://discourse.julialang.org/t/discussion-about-integer-overflow/69627):
>
> Yes, it is a limitation but I would not call it big since we could use BigInt if Int64 is not enough and an overflow is something we can catch. I find more worrying this: \> julia\> 1 / 10^20000 \> Inf I’d rather have an overflow here than Inf, or at least an Infinitesimal value… Maybe something we could ask for future versions of Julia.

---

_[View the full topic](https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444)._
