7 added 2 characters in body
source | link

Haskell, 62 61 39 38 37 bytes

f s=last[x|x<-0:s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in ss x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

Haskell, 62 61 39 38 37 bytes

f s=last[x|x<-0:s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

Haskell, 62 61 39 38 37 bytes

f s=last[x|x<-0:s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

6 added 9 characters in body
source | link

Haskell, 62 61 39 3838 37 bytes

f s=last$0:[x|x<s=last[x|x<-0:s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

Haskell, 62 61 39 38 bytes

f s=last$0:[x|x<-s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

Haskell, 62 61 39 38 37 bytes

f s=last[x|x<-0:s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

5 added 90 characters in body
source | link

Haskell, 62 61 39 38 bytes

f s=last$0:[x|x<-s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answeranswer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

Haskell, 62 61 39 38 bytes

f s=last$0:[x|x<-s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer, namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

Haskell, 62 61 39 38 bytes

f s=last$0:[x|x<-s,and[x*x<=x*y|y<-s]]

using some comparison magic borrowed from @Zgarb's answer* , namely, x*x<=x*y.

x*x<=x*y is true only when x and y have the same sign and y's absolute value is bigger. note that when x is 0 it is always true.

we determine that x is the result iff it is contained in s, and that for all y in s x has the same sign as y and is smaller in absolute value. if no value in s satisfies this definition, then 0 is the result.

f then works by searching s for an element to satisfy this, and uses 0 as a default.

*though he didn't use it for the reasons I'm using it, and he actually got rid of it by now

4 added 7 characters in body
source | link
3 added 539 characters in body
source | link
2 added 9 characters in body
source | link
1
source | link