On 04/11/2013 06:37 AM, Brandon Allbery wrote:
> On Thu, Apr 11, 2013 at 1:38 AM, Christopher Howard
> <christopher.how...@frigidcode.com
> <mailto:christopher.how...@frigidcode.com>> wrote:
> 
>     Hi. For my own learning, I wanted to see how the exp function is
>     implemented in GHC. I have GHC 7.4.1 source code open, but I'm having
>     trouble figuring out which file the actual function definition is
>     in. I see
> 
>      expFloat    (F# x) = F# (expFloat# x)
> 
> 
> expFloat# is likely a primop; good luck.... Primops aka primitive
> operations are generally implemented in the compiler backend as assembly
> language or Cmm code. Untangling that part of ghc makes my head swim. >.>
> 
> -- 
> brandon s allbery kf8nh                               sine nomine associates
> allber...@gmail.com <mailto:allber...@gmail.com>                        
>          ballb...@sinenomine.net <mailto:ballb...@sinenomine.net>
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

I traced it down some more: I think it eventually goes into the
compiler/nativeGen section where it is translated into the platform's
native version of the function. On my platform, I think this is the expf
function from math.h. (See EXP(3)).

I find that to be interesting, because it means you could change the
output of your programs by altering your standard library. But I guess
there are a lot of things you could change by altering your standard
library!

-- 
frigidcode.com

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to