<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 8:10 AM Murilo via Digitalmars-d-learn <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am using the function pow() from std.math but if I try pow(2, <br>
32) it returns 0, it doesn't compute beyond the maximum value of <br>
an int(2^31) and I am working with long. What should I do?<br></blockquote><div><br></div><div>if you look at doc: <a href="https://dlang.org/phobos/std_math.html#.pow.2">https://dlang.org/phobos/std_math.html#.pow.2</a></div><div><br></div><div>you will see that return type is infered from pow arguments, so if both arguments are int for example the return value would be int too </div><div><a href="https://run.dlang.io/is/FMVJhY">https://run.dlang.io/is/FMVJhY</a><br></div><div><br></div><div>so if you want to have long as output one of your args should be (u)long or you can enforce that by</div><div>pow!long(2,32);</div><div><br></div><div><a href="https://run.dlang.io/is/WlDfsE">https://run.dlang.io/is/WlDfsE</a><br></div></div></div></div></div></div>