Opened 3 years ago

Closed 3 years ago

#10297 closed feature request (wontfix)

Floating instance for Data.Fixed

Reported by: dmcclean Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 7.10.1
Keywords: Cc: hvr, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I'd like to contribute a Floating instance for Data.Fixed. I'm concerned that it may be undesirable for a reason that is not occurring to me; I'd be pleased to learn of any objections.

In concept it's this, although I will investigate if there is an implementation with better performance:

lift :: (HasResolution a) => (Double -> Double) -> Fixed a -> Fixed a
lift f = realToFrac . f . realToFrac

instance (HasResolution a) => Floating (Fixed a) where
  pi = realToFrac pi
  sin = lift sin
  -- etc, similar lift2 function for (**), logBase

Change History (3)

comment:1 Changed 3 years ago by ekmett

This should really go through the libraries@ mailing list as a proposal first. That'll let more eyeballs see it.

comment:2 Changed 3 years ago by dmcclean

Will do after work. I was unaware of the appropriate procedure.

comment:3 Changed 3 years ago by dmcclean

Resolution: wontfix
Status: newclosed

There are actually a few problems with this idea. Sorry for not discovering them before creating this ticket. :)

Note: See TracTickets for help on using tickets.