Ticket #2793 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

CLDouble is nothing like a long double

Reported by: jedbrown Owned by: igloo
Priority: high Milestone: 6.12.1
Component: libraries/base Version: 6.11
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This affects all versions of GHC. Why does the type exist when it is just a synonym for CDouble? Either it should actually become a `long double' as the documentation says or it should just not exist. From Foreign/C/Types.hs:

-- HACK: Currently no long double in the FFI, so we simply re-use double
-- | Haskell type representing the C @long double@ type.
FLOATING_TYPE(CLDouble,tyConCLDouble,"CLDouble",HTYPE_DOUBLE)

Change History

Changed 4 years ago by igloo

  • difficulty set to Unknown
  • component changed from Compiler to libraries/base
  • milestone set to 6.12 branch

Changed 4 years ago by igloo

  • priority changed from normal to high
  • milestone changed from 6.12 branch to 6.12.1

Sounds reasonable, and like it should be easy to fix.

Changed 4 years ago by simonmar

  • owner set to igloo

Let's just remove it.

Changed 4 years ago by jedbrown

I personally don't have a problem with that, but some people care a lot about quad precision, mostly for very ill-conditioned problems or in order to get away with a numerically unstable method.

Changed 4 years ago by igloo

Well, currently it doesn't provide quad precision anyway, so nothing is lost by removing it.

However, there are a couple of issues with removing it:

  • The FFI addendum says that we should provide it
  • The code is a CPP tangle with the GHC, hugs and nhc implementations of it. I don't know if anything really implements it.

There's also more work involved in implementing it than I'd previously realised. I'll revisit it after removing decodeDoubleInteger.

Changed 4 years ago by simonmar

Wouldn't we have to implement long double as a new primitive type in GHC, provide support in all the code generators, including support for passing long double to C functions in all the native backends? It's a lot of work.

Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

I've removed GHC's CLDouble pretense, and opened #3353 "Add CLDouble support" to add proper support.

Note: See TracTickets for help on using tickets.