Timeline for The hue of a color
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 19, 2015 at 20:57 | comment | added | ProgramFOX | @SLuck49 Well spotted, thanks! :) | |
Aug 19, 2015 at 20:57 | history | edited | ProgramFOX | CC BY-SA 3.0 |
deleted 147 characters in body
|
Aug 19, 2015 at 20:53 | comment | added | SLuck49 |
Also also (just noticed) you can drop the using all together by fully qualifying System.Array for another 6 bytes.
|
|
Aug 19, 2015 at 20:32 | comment | added | ProgramFOX |
@SLuck49 Thanks! Yes, I actually need the cast, it gives inaccurate results otherwise, but that *1D multiplication is a nice trick!
|
|
Aug 19, 2015 at 20:31 | history | edited | ProgramFOX | CC BY-SA 3.0 |
added 41 characters in body
|
Aug 19, 2015 at 20:25 | comment | added | SLuck49 |
Also do you really need the cast to double ? If you do you can use this instead (x-a[0])*1D to save another 5 bytes.
|
|
Aug 19, 2015 at 20:23 | comment | added | SLuck49 |
You can factor 120 out of the c and d assignments and into the return like this c=x==g?1:(x==b?2:(y==b?3:0)),d=y==g?1:(y==b?2:(x==b?3:0)) and then return(int)((c-d)*120*(1+(x-y)/(double)(x-a[0]))/2+d*120); to save 4 bytes.
|
|
Aug 19, 2015 at 15:08 | history | edited | ProgramFOX | CC BY-SA 3.0 |
added 55 characters in body
|
Aug 19, 2015 at 14:47 | comment | added | Sok |
As you only use z once in the output calculation, and you don't use it in the preceding calculations, you do away with the variable and change the output to return(int)((c-d)*(1+(x-y)/(double)(x-a[0]))/2+d); , saving you 4 bytes.
|
|
Aug 19, 2015 at 12:36 | history | edited | ProgramFOX | CC BY-SA 3.0 |
fix code
|
Aug 19, 2015 at 9:56 | history | answered | ProgramFOX | CC BY-SA 3.0 |