Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by
closed ago by

The doc for signum has a small error. It says:

If d is ##Inf or ##-Inf => d

However, the output of (java.lang.Math/signum d) is 1.0 for ##Inf and -1.0 for ##-Inf. So this line can possibly be removed.

However, if infinities should be explicitly described, then

If d is ##Inf => 1.0
If d is ##-Inf => -1.0

The doc for next-down is:

Returns the adjacent double of d in the direction of ##-Inf.
If d is ##NaN => ##NaN
If d is ##Inf => ##-Inf
If d is zero => Double/MIN_VALUE

This should read:

Returns the adjacent double of d in the direction of ##-Inf.
If d is ##NaN => ##NaN
If d is ##Inf => Double/MAX_VALUE
If d is zero => -Double/MIN_VALUE

The doc for round is:

Returns the closest long to a. If equally close to two values, return the one
closer to ##Inf.
If a is ##NaN => 0
If a is ##-Inf => ##-Inf
If a is ##Inf => ##Inf

This should read:

Returns the closest long to a. If equally close to two values, return the one
closer to ##Inf.
If a is ##NaN => 0
If a is ##-Inf => Long/MAX_VALUE
If a is ##Inf => Long/MIN_VALUE
closed with the note: Fixed in 1.11.0-alpha4

1 Answer

+1 vote
by

Logged as https://clojure.atlassian.net/browse/CLJ-2675

I did not include the round one because the before doesn't actually match what's there which I think is correct:

http://clojure.github.io/clojure/branch-master/clojure.java.math-api.html#clojure.java.math/round

by
Yes, the comment on `round` is correct, thanks. I should have checked the actual docs. I was just relying on the doc string from the file that I copied several weeks ago.
...