Clojure

Better primitive support for floats

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code

Description

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.

  1. floats.diff
    26/Sep/13 9:04 AM
    5 kB
    Christophe Grand
  2. floats-intrinsics.diff
    05/Feb/14 4:20 PM
    3 kB
    Christophe Grand

Activity

Hide
Alex Miller added a comment -

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?

Show
Alex Miller added a comment - 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?
Hide
Christophe Grand added a comment - - edited

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

Show
Christophe Grand added a comment - - edited I attached a new patch with only intrinsics and more comprehensive primitive coercion. Is it the split you expected?
Hide
Alex Miller added a comment -

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.

Show
Alex Miller added a comment - 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.
Hide
Christophe Grand added a comment -

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

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

Show
Christophe Grand added a comment - Godd thing I had already split coercions in a sparate commit then See http://dev.clojure.org/jira/browse/CLJ-1340

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated: