Documentation error for Field?

9 views
Skip to first unread message

Ben Hutchison

unread,
Jun 11, 2013, 11:05:38 PM6/11/13
to spire...@googlegroups.com
The readme docs says of Field:

reciprocal: multiplicative inverse
div (/): division
ceil: round up
floor: round down
round: round to nearest

I don't think the rounding methods are on Field now, right? They seem
to be in IsReal?

Also, somewhat separately, I was wondering if there's a typeclass that
brings in everything common to Float/Double/BigDecimal, seemingly
Fractional + IsReal + Trig ?

Also, there's another minor typo in the doc, where you say the current
version is 0.3, right before giving the SBT recipe for 0.4

-Ben

Tom Switzer

unread,
Jun 11, 2013, 11:13:20 PM6/11/13
to Ben Hutchison, Spire User List
Great catch. Yeah, ceil/floor/round were moved to IsReal. In master, Fractional now extends IsReal, but not Trig. What would be a good name for something like Fractional + Trig?

Ben Hutchison

unread,
Jun 11, 2013, 11:46:11 PM6/11/13
to Tom Switzer, Spire User List
From an API consumer, rather than mathematical, perspective,
Fractional + Trig seems to be what you need to rewrite existing code
framed in terms of Doubles into a generic form, and still have the
core operations provided by Scala/Java available.

So IMHO it should be short, an abbreviation/alias for a bundling of
stuff that's commonly used together. Purists can use the more fine
grained constituent type-classes. Perhaps..

Fract
FNum
Flot
FractionalT


-Ben

Tom Switzer

unread,
Jun 11, 2013, 11:56:47 PM6/11/13
to Ben Hutchison, Spire User List
Haskell has a `Floating` type class that is very similar (basically just Fractional + Trig in Spire). How about that?

Tom Switzer

unread,
Jun 12, 2013, 12:00:45 AM6/12/13
to Ben Hutchison, Spire User List
Oddly enough, this isn't too far off another type class Erik is adding, BitString, which includes bit-shifting methods and the like that you get with Int, Long, BigInt, etc.

Ben Hutchison

unread,
Jun 12, 2013, 12:07:20 AM6/12/13
to Tom Switzer, Spire User List

Floating sounds good, the haskell similarity is a plus.

Ben

Reply all
Reply to author
Forward
0 new messages