Complex document compiles with 2.3.x but not with master

José Abílio Matos jamatos at lyx.org
Sat Sep 19 12:10:34 UTC 2020


On Saturday, September 19, 2020 7:43:36 AM WEST Jürgen Spitzmüller wrote:
> Am Freitag, den 18.09.2020, 18:43 +0100 schrieb José Abílio Matos:
> > Actually I am confused why the code is needed at all.
> > 
> > What are the cases where we need to add a leftmost zero to a number?
> 
> To translate LaTeX shorthand floats .7 to 0.7. In its own length
> widgets, LyX only understands the latter IIRC.

[Below I will argue that this code is unneeded so no need]

That makes sense but then it should be
if oldval[0] == ".":

note that the index is _0_ and not _1_

FWIW my original interest in this was because I thought that there was a bug 
lurking in there (an off by one index).

> > I could understand if it was the first char in the string, and so
> > position 0 and not 1.
> > 
> > On the other hand python understand that if a float number starts
> > with a dot then it is the same as if the 0 was there:
> > 
> > In [1]:
> > .4*2
> > 
> > 
> > 
> > Out[1]: 0.8
> 
> I see. But we deal with strings here.

True but then later in the code oldval is converted as

oldval = str(float(oldval) * 100)

and float knows how to deal with the strings that start with a dot.

So IMHO the above test is basically a no-op and it can be removed.

OTHO since the net result is null we are discussing that lyx2lyx takes an 
extra microsecond doing the conversion and so this thread is taking more time 
than that. :-D

> Jürgen


-- 
José Abílio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200919/32ed4f33/attachment.html>


More information about the lyx-devel mailing list