The default if it’s a Floating type is Double. Leaving the type polymorphic breaks sharing, though, and that’s a common cause of perf issues with Num/Integral/Floating a => a computations.

Best to post code when asking questions like this.

On May 4, 2016, at 6:08 PM, Tim Perry <tim.v2.0@gmail.com> wrote:

I imagine that in this program when Double isn't specified the compiler doesn't assign a "hardware optimized" number type. Consequently it isn't using the specialized functions that are used for 64-bit floating point numbers. When the program specifies it is receiving the "Double" values, then it does use the "hardware optimized" data types.

On Wed, May 4, 2016 at 3:12 PM, Ben Rogalski <bwrogalski@gmail.com> wrote:
I have found that using the type Double in a type signature causes my program to run much faster than if I use a type variable with a Num constraint.

Is this common, and if so, why is explicitly using Double faster?

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners