https://go.dev/play/p/_uLHdBIRLBv
- sean On Sat, Nov 9, 2024, 00:25 'simon place' via golang-nuts < golang-nuts@googlegroups.com> wrote: > {please tell me if i am missing something here} > > 1. seems common to want to change a component of a complex number. > > 2. seems common to manipulate complex numbers in a tight loop (simulation) > > but whereas you can read a component... > > real com.:=Real(cmplx) > imaginary com.:=Imag(cmplx) > > i can't see any way to write to a component. > > i had hoped, maybe, the compiler would help, but testing shows the, > expected, 5x longer time for this solution/hack.... > > c+=complex(0,v) // add v to the imaginary part of c > > seems re-implementing complex is pretty simple, but its less > clear/documentable and this seems like an omission to me. > > BTW couldn't find any help in reflect > > BTW c code just does it fine. > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/golang-nuts/2de28954-fccb-48f2-9374-950f3ba6d573n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/2de28954-fccb-48f2-9374-950f3ba6d573n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CAGabyPoaVqL8_mdW3XFm%3DMpZYN3T5HN%2B2tfPErSrnQ7GaGXfhQ%40mail.gmail.com.