<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged cast</title>
<link>https://ask.clojure.org/index.php/tag/cast</link>
<description></description>
<item>
<title>*unchecked-math* true does not work for (long) fn</title>
<link>https://ask.clojure.org/index.php/8983/unchecked-math-true-does-not-work-for-long-fn</link>
<description>&lt;p&gt;It seems that unchecked-math does not turn (long) into (unchecked-long), but it does for (int). I believe this is a bug, or if not, I'm not sure why, since as a user, I'd expect the unchecked-math flag to turn all fns that have an equivalent unchecked- variant into that one.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(set! *unchecked-math* true)
(decompile (int (nth [1 2 3] 1)))
;; RT.uncheckedIntCast(RT.nth(const__5, RT.uncheckedIntCast(1L)));
(decompile (long (nth [1 2 3] 1)))
;; Numbers.num(RT.longCast(RT.nth(const__5, RT.uncheckedIntCast(1L))));

(set! *unchecked-math* false)
(decompile (int (nth [1 2 3] 1)))
;; RT.intCast(RT.nth(const__5, RT.intCast(1L)));
(decompile (long (nth [1 2 3] 1)))
;; Numbers.num(RT.longCast(RT.nth(const__5, RT.intCast(1L))));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Logged: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2551&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2551&lt;/a&gt;&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8983/unchecked-math-true-does-not-work-for-long-fn</guid>
<pubDate>Thu, 02 Jan 2020 22:40:35 +0000</pubDate>
</item>
</channel>
</rss>