Fork me on GitHub
#clojure-spec
<
2019-06-10
>
andy.fingerhut02:06:26

There is an example spec using s/double-in on the spec guide page: (s/def ::dubs (s/double-in :min -100.0 :max 100.0 :NaN? false :infinite? false)) I have tried changing the false occurrences to true, and leaving out the :NaN? and :infinite? keys, but I always see (s/valid? ::dubs ##Inf) evaluate to false, as well as (s/valid? ::dubs ##-Inf) and (s/valid? ::dubs ##NaN). Is that expected?

andy.fingerhut02:06:04

I guess it makes sense for ##-Inf to be invalid if a :min value is specified that is a double value other than ##-Inf, and similarly for :max values and ##Inf.

andy.fingerhut02:06:30

But it seems like specifying either :min or :max changes the validity of ##NaN from true to false.

andy.fingerhut02:06:54

no matter what the value associated with the :NaN? key happens to be

Alex Miller (Clojure team)02:06:40

might be the ordering of the checks

Alex Miller (Clojure team)02:06:14

if you (s/form :;dubs) you can see what it expands to

Alex Miller (Clojure team)03:06:52

maybe buggy at a glance as it's an s/and and it starts flowing the boolean rather than the double

andy.fingerhut18:06:45

I doubt that is a hot ticket item for anyone, but created a JIRA ticket as a reminder: https://clojure.atlassian.net/browse/CLJ-2516