Fork me on GitHub
#off-topic
<
2023-05-26
>
ehernacki06:05:55

Public utility for beginners and life in general 🙂 https://www.youtube.com/watch?v=Rufif247scI

👍 8
4
jamie richardson08:05:44

Hey guys and girls, I was recommended on Reddit to post the following here: "I read in the community rules there would be a monthly Who's Hiring post, but there wasn't. So I'm here to say I'm hiring! US-Based Clojure developers: Must have used Clojure professionally and this role is backend based. Base Salary is: 200-250k + 100k annual bonus Feel free to reach out to me on Linkedin or via email if this could be interesting: <mailto:[email protected]|[email protected]> https://www.linkedin.com/in/jamie-philip-88842a19a/"

p-himik09:05:02

You should post it in #C05006WDW instead.

souenzzo21:05:30

TIL: (bigdec (fn-that-returns-double)) can throw!

(instance? Double ##Inf)
=> true
(bigdec ##Inf)
Execution error (NumberFormatException) at java.math.BigDecimal/<init> (BigDecimal.java:594).
Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
It is actually a JDK issue.

hiredman21:05:50

user=> (BigDecimal. ##Inf)
Execution error (NumberFormatException) at java.math.BigDecimal/<init> (BigDecimal.java:974).
Infinite or NaN
user=> (BigDecimal/valueOf ##Inf)
Execution error (NumberFormatException) at java.math.BigDecimal/<init> (BigDecimal.java:594).
Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
user=>

Alex Miller (Clojure team)21:05:39

how is that an issue with the JDK? bigdecimal has arbitrary precision but it is not able to represent infinity (like Double can), so there is no way to make this work

souenzzo21:05:12

this error feels unintentional: it can't parse the double representation. Also happens with NaN I'd expect some explicit error.

hiredman21:05:29

The BigDecimal constructor gives you the more explicit error

hiredman21:05:57

the java doc for valueof which is what bigdec calls says no inf or nans https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#valueOf(double)

Alex Miller (Clojure team)21:05:24

NumberFormatException is an explicit error?

souenzzo21:05:12

I think that BigDecimal#valueOf should throw the same exception as BigDecimal#ctor

hiredman21:05:25

the text of the exception in the valueof case is a litte weird, in the consturctor case it says it was passed an Infinite or NaN

👍 4