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

0 votes
in Clojure by

Clojure offers optimized arithmetic functions for long, int and doubles but none for floats.
Plus converting from integers (ints or longs) to floating point numbers (float or double) doesn't use the specialized bytecode.
This patch adds float-add/subtract/multiply/divide and more efficient coversion from integers to floating points numbers.

5 Answers

0 votes
by

Comment made by: alexmiller

I think it's unlikely the arithmetic float ops will be accepted.
However, the intrinsics changes could be useful - could you split those into a new ticket?

0 votes
by

Comment made by: cgrand

I attached a new patch with only intrinsics and more comprehensive primitive coercion. Is it the split you expected?

0 votes
by

Comment made by: alexmiller

No, but totally my fault for saying the wrong words. :)

I think the changes in Compiler to get access to I2D, L2D, I2F, and L2F are potentially useful (most particularly L2D) - these would make sense in a new ticket.

The other changes in Intrinsics and Numbers to support float math are unlikely to be accepted.

0 votes
by

Comment made by: cgrand

Godd thing I had already split coercions in a sparate commit then ;-)

See http://dev.clojure.org/jira/browse/CLJ-1340

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1266 (reported by cgrand)
...