Timeline for Haskell - Different log methods
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 22, 2018 at 10:00 | comment | added | Aleksi Torhamo | You are right that in most cases one should use the built-in functionality, but we're talking about an integer version of a floating-point function here; Using the built-in log or logBase with conversion in this case will give incorrect results! log and logBase both return floating point values, which aren't always exact - for example 3^5 == 243, but logg 243 / logg 3 == 4.999999999999999, so floor $ logg 243 / logg 3 == 4, instead of the correct 5. (And logBase 3 243 gives the same result, too) | |
| May 4, 2011 at 18:41 | vote | accept | jon_darkstar | ||
| May 4, 2011 at 18:26 | comment | added | jon_darkstar | also noticed logBase has arguments with other order, which makes sense since the base is the argument you'd more likely want to curry. i need to get in the habit of thinking like that when specifying argument order | |
| May 4, 2011 at 18:00 | vote | accept | jon_darkstar | ||
| May 4, 2011 at 18:00 | |||||
| May 4, 2011 at 18:00 | vote | accept | jon_darkstar | ||
| May 4, 2011 at 18:00 | |||||
| May 4, 2011 at 18:00 | comment | added | jon_darkstar | hah i didnt even know about logBase. but thanks for suggesting the takeWhile that is exactly the kind of thing i was looking for. i liked that solution the best due to its conciseness except for the obvious efficiency problem. | |
| May 4, 2011 at 17:47 | history | answered | sepp2k | CC BY-SA 3.0 |