On Wed, May 29, 2024 at 01:45:50AM +0200, Grégory Vanuxem wrote: > Le mar. 28 mai 2024 à 22:34, Waldek Hebisch <de...@fricas.org> a écrit : > > > > On Tue, May 28, 2024 at 07:10:35PM +0200, Grégory Vanuxem wrote: > > > > In fact, Void return value instead of a Record, I forgot a branch. > > > Secondly, it was not handled at compile time. > > > > > > withoust seeing code that triggers this it it hard to say who > > is guilty and what exactly happended. > > It was a typo in a Gaussian integer domain using another Integer > domain than the FriCAS one, a domain without parameters like > GaussianInteger() == Complex(Integer) for example. > > The commented code is the good one, a missing equal sign: > > unitNormal x == > zero? x => [1, x, 1] > one? x => [1, 1, 1] > re := real(x); im := imag(x) > re > 0 => > --im >= 0 => [1, x, 1] > im > 0 => [1, x, 1] > im < 0 => [-imaginary(), complex(-im, re), imaginary()] > im <= 0 => [-1, -x, -1] > [imaginary(), complex(im, -re), -imaginary()]
Spad compiler does not check if your exits are complete, in general Spad compiler does not understand your condition so it can not infer that something is missing. Theoretically Spad compiler could be modified to always require uncondital result, but that would be inconvenient. Probably better would be to add a call to 'error' so that missing return is detected. I guess it is question of coding style, it is hard for me to imagene writing code like the above. I would rather write the critical part as: im > 0 => [1, x, 1] [-imaginary(), complex(-im, re), imaginary()] (assuming that this is good choice) or im > 0 => [1, x, 1] im < 0 => [-imaginary(), complex(-im, re), imaginary()] error "should not happen" To say the truth, I probably would use different normalization, so code would be quite different. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ZlaYOVCgRWyupvxB%40fricas.org.