fs2ups.spad: spec_to_UPS - strange code

6 views
Skip to first unread message

Hill Strong

unread,
Feb 3, 2025, 8:34:01 AMFeb 3
to fricas...@googlegroups.com
Good morning to all.

I am having a look at the spec_to_UPS routine around lines 723 to 770.

The code is

            if (ei_ci_chi or nm = 'dilog) and ord = 0 and
                 (ord := order(ups, 1::Expon)) > 0 then return

[ some other stuff]

            else if ord < 0 then return

[some more stuff]

            else if ord = 0 and nm = 'dilog then
[some final stuff which could get executed]


On the basis of the above, [some other stuff] and [some more stuff] can never be executed. Is this correct?

regards to all

Waldek Hebisch

unread,
Feb 3, 2025, 8:56:35 AMFeb 3
to fricas...@googlegroups.com
No. You ignored indentation and meaning of 'return'. Indented parts
are piles and compute value that will be returned.

--
Waldek Hebisch

Hill Strong

unread,
Feb 3, 2025, 10:46:35 AMFeb 3
to fricas...@googlegroups.com

So what you are saying is that the pile [some other stuff] is the argument to the previous {return}?


--
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...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/Z6DLDs8IkjFknENh%40fricas.org.

Ralf Hemmecke

unread,
Feb 3, 2025, 12:09:37 PMFeb 3
to fricas...@googlegroups.com
On 2/3/25 16:46, Hill Strong wrote:
> So what you are saying is that the pile [some other stuff] is the
argument
> to the previous {return}?

The structure of this particular code is like this:

1 if (ei_ci_chi or nm = 'dilog) and ord = 0 and
2 (ord := order(ups, 1::Expon)) > 0 then return
3 not(opt_rec.log_x_replace) or not(can_integrate_uts) =>
4 stateProblem(string(nm), "expansion at 0")
5 ord := order(ups)
6 lc := coefficient(ups, ord)
7 (signum := sign(lc)$SIGNEF) case "failed" =>
8 ...
9 else if ... then return

Line 2 is more indented than line 1 and therefore internally
concatenated to the end of line 1.
Line 4 is more indented than line 3, so it is concatenated to line 3.
After that lines 3,5-8 are indented to the same amount and more than
line 1, so they form a block that can basically be thought of as appending

(line 3; line 5; line 6; line 7; line 8)

to the end of line 1+2. That gives then exactly what you say:
lines 3-8 ar the argument of return.

Ralf

Hill Strong

unread,
Feb 3, 2025, 12:16:51 PMFeb 3
to fricas...@googlegroups.com
Thank you Ralf

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages