Fork me on GitHub
#clojurescript
<
2018-05-14
>
levitanong06:05:05

@bravilogy please post the error here. it might still be helpful for those of us who have seen it before.

Bravi08:05:56

@levitanong figured it out in the end - I just needed to do a quick lein clean đ

đ 4
Bravi08:05:59

but thanks

maleghast15:05:21

Just checking, but I am assuming that things like

(int (Math/round ...))
don't work in ClojureScript, 'cos the underlying Maths functions are JS not Java..?

manutter5115:05:42

bearing in mind that there are no integers in JS

manutter5115:05:59

itâs all floats down here

maleghast15:05:16

I thought JS had an understanding of Integers, i.e. parseInt()

Roman Liutikov15:05:23

nah, only 64-bit floats

manutter5115:05:59

It âpretendsâ theyâre ints, but all youâre really getting are floats with zeros to the right of the decimal point.

joelsanchez15:05:15

sensible choices

danielneal15:05:22

đ đ­

manutter5115:05:23

=> (def js-two (js/parseInt "2"))
#'cljs.user/js-two
=> js-two
2
=> (def js-three (js/parseInt "3"))
#'cljs.user/js-three
=> js-three
3
=> (/ js-three js-two)
1.5
=>

manutter5115:05:03

Compare to Clojure (jvm-based) â

(def clj-2 (int (Integer. "2")))
=> #'user/clj-2
clj-2
=> 2
(def clj-3 (int (Integer. "3")))
=> #'user/clj-3
clj-3
=> 3
(/ clj-3 clj-2)
=> 3/2

andy.fingerhut16:05:55

So I guess the JavaScript bit-wise logical operators like and, or, xor, shift, etc. coerce 64-bit floats to integers?

andy.fingerhut16:05:32

Or actually, I don't even know if JavaScript has such operators, but ClojureScript has functions for them like Clojure does, and they appear as if they work on the 2's complement integer representations.

troglotit16:05:26

Just like emscripten

andy.fingerhut16:05:22

Does JavaScript have arbitrary precision integers built in, or added on via the Google Closure library?

troglotit16:05:24

No - to the first question. About Closure - I donât know

Roman Liutikov16:05:17

V8 and Chrome recently added support for BigInt btw, you can try it now in Chrome dev/beta/canary typeof 1n // "bigint"