Skip to main content

Timeline for Output the sign

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Dec 23, 2016 at 14:40 comment added user45941 Floats are acceptable here, since 1.0 == 1 and -1.0 == -1. Nice job using the rarely-used definition of the sign function as the derivative of the absolute value function (with f(0) = 0 explicitly defined)!
Dec 22, 2016 at 3:18 comment added Dennis Right, that returns a float. Nothing wrong with that, I guess.
Dec 22, 2016 at 3:16 history edited Cormac CC BY-SA 3.0
deleted 5 characters in body
Dec 22, 2016 at 3:15 comment added Cormac Thank you! I just realised I dont even need to casting at all. I thought that if n == 0 it would evaluate to false so I would have to convert it to an int but it turns out it stays as 0.
Dec 22, 2016 at 3:08 history edited ETHproductions CC BY-SA 3.0
minor formatting edits
Dec 22, 2016 at 3:01 comment added Dennis Welcome to Programming Puzzles & Code Golf! If you replace / with //, you don't need to cast to int.
Dec 22, 2016 at 2:23 review First posts
Dec 22, 2016 at 3:08
Dec 22, 2016 at 2:20 history answered Cormac CC BY-SA 3.0