Subject: Re: bug#75861: 31.0.50; calc units error

From: Eli Zaretskii <[email-masked]>
Date: Mon, 27 Jan 2025 14:04:49 +0200

[Please use Reply All to reply, to keep the bug tracker CC'ed.]

> From: çağlar girit <[email-masked]>
> Date: Sun, 26 Jan 2025 22:42:25 +0100
> 
> Thanks for getting back to me.  I didn't omit anything.  Maybe 
> it's a problem with my setup.  I removed the elc files and started 
> an edebug and found that the error happens when trying to build 
> the units table (math-standard-units in calc-units.el) when it 
> encounters the entry:
>     ( dB      "(ln(10)/20) Np" "decibel"))
> 
> Instrumenting math-find-base-units-rec, I found that the following 
> clause executes when parsing the string "(ln(10)/20) Np"
> 
> 	  ((eq (car expr) 'var)
> 	   (or (eq (nth 1 expr) 'pi)
> 	       (error "Unknown name %s in defining expression for 
> 	       unit %s"
> 		      (nth 1 expr) (car math-fbu-entry))))
> 
> So for some reason it considers 'ln' as a variable, like 'pi'.  If 
> I replace '(ln(10)/20)' by its numerical value in the units table, 
> there is no error anymore.  I guess '(ln(10)/20)' is not being 
> correctly evaluated as an expression while parsing the units 
> table?

If you haven't omitted anything from the steps, then I don't
understand why I don't see the problem.  And since I don't see the
problem, I cannot correlate what you say above with the problem.

Here's what I see after performing the steps you describe in Emacs 31:

I don't even understand where would the dB units come into play here.

Maybe this is macOS-specific?  can anyone else reproduce the problem?