Timeline for Sums of square roots
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 9, 2021 at 11:48 | comment | added | Dominic van Essen | Let us continue this discussion in chat. | |
Jun 9, 2021 at 11:47 | comment | added | rajashekar | So the only solution would be like your prime factorization. | |
Jun 9, 2021 at 11:45 | comment | added | Dominic van Essen |
Yeah, that's what I was worrying about. Like sqrt(1e26) and sqrt(1+1e26) , for instance...
|
|
Jun 9, 2021 at 11:42 | comment | added | rajashekar |
But I guess we could actually engineer two subsets whose sum of square roots are nearer than 1E-13 . In that case my solution drops one of them and gives the wrong answer. Hmm, Can that happen?
|
|
Jun 9, 2021 at 11:32 | comment | added | rajashekar |
There is a comparison tolerance variable ⎕CT that is used when comparing floating point values. The default seems small enough 1E-13 for this problem.
|
|
Jun 9, 2021 at 11:19 | comment | added | Dominic van Essen | Ah. Then it would be useful if you can explain how your code avoids outputting some elements twice due to floating-point errors (as exemplified in the challenge). | |
Jun 9, 2021 at 9:57 | comment | added | rajashekar |
@DominicvanEssen: I can't seem to find any online service for GNU-APL .
|
|
Jun 9, 2021 at 9:42 | comment | added | Dominic van Essen | Can you post a link (for instance on 'Try It Online') so that other people can try out your code? | |
Jun 9, 2021 at 8:30 | history | answered | rajashekar | CC BY-SA 4.0 |