Ian Bicking - 2006-08-21 02:19:37
Being curious, I thought I’d try to avoid floats and make an integer pow function…
-module(intpow). -export([pow/2]). pow(X, 0) -> 1; pow(X, Y) -> X * pow(X, Y-1).
pow(X, 0) -> 1; pow(X, Y) -> X * pow(X, Y-1).
anders pearson - Mon 21 Aug 2006 10:29:08
Neat. It hadn’t even occurred to me that it might just be simpler to implement it myself. For something fairly basic, my instinct is still to look in the standard library first.
formatting is with Textile syntax. Comments are not displayed until they are approved by a moderator. Moderators will not approve unless the comment contributes value to the discussion.
Ian Bicking - 2006-08-21 02:19:37
Being curious, I thought I’d try to avoid floats and make an integer pow function…
anders pearson - Mon 21 Aug 2006 10:29:08
Neat. It hadn’t even occurred to me that it might just be simpler to implement it myself. For something fairly basic, my instinct is still to look in the standard library first.