2018-11-20 10:37:46 -05:00
|
|
|
|
;;; calc-units.el --- unit conversion functions for Calc -*- lexical-binding:t -*-
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
2024-01-02 09:47:10 +08:00
|
|
|
|
;; Copyright (C) 1990-1993, 2001-2024 Free Software Foundation, Inc.
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
|
|
|
|
;; Author: David Gillespie <daveg@synaptics.com>
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:16:00 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2007-03-19 20:59:53 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:16:00 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2007-03-19 20:59:53 +00:00
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2007-03-19 20:59:53 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:42:20 +00:00
|
|
|
|
;;; Commentary:
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:42:20 +00:00
|
|
|
|
;;; Code:
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;; This file is autoloaded from calc-ext.el.
|
|
|
|
|
|
2004-11-30 17:27:44 +00:00
|
|
|
|
(require 'calc-ext)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(require 'calc-macs)
|
2005-01-06 18:14:08 +00:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(require 'calc-alg))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:42:20 +00:00
|
|
|
|
;;; Units operations.
|
|
|
|
|
|
2023-10-10 11:59:15 +02:00
|
|
|
|
;;; Units table last updated 9-Jan-91 by Ulrich Müller (ulm@vsnhd1.cern.ch)
|
2001-11-19 07:42:20 +00:00
|
|
|
|
;;; with some additions by Przemek Klosowski (przemek@rrdstrad.nist.gov)
|
2010-05-14 23:50:25 -05:00
|
|
|
|
;;; Updated April 2002 by Jochen Küpper
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
2007-08-15 15:42:58 +00:00
|
|
|
|
;;; Updated August 2007, using
|
2020-10-01 15:24:21 +02:00
|
|
|
|
;;; CODATA (https://physics.nist.gov/cuu/Constants/index.html)
|
|
|
|
|
;;; NIST (https://physics.nist.gov/Pubs/SP811/appenB9.html)
|
2007-08-15 15:42:58 +00:00
|
|
|
|
;;; ESUWM (Encyclopaedia of Scientific Units, Weights and
|
2010-05-14 23:50:25 -05:00
|
|
|
|
;;; Measures, by François Cardarelli)
|
2007-08-15 15:42:58 +00:00
|
|
|
|
;;; All conversions are exact unless otherwise noted.
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
2018-11-19 07:29:56 -08:00
|
|
|
|
;; Updated November 2018 for the redefinition of the SI
|
2023-11-29 16:48:11 +01:00
|
|
|
|
;; https://www.bipm.org/en/committees/cg/cgpm/26-2018/resolution-1
|
2018-11-19 07:29:56 -08:00
|
|
|
|
|
2023-11-29 10:24:06 +01:00
|
|
|
|
;; CODATA values last updated November 2023, using 2018 adjustment:
|
|
|
|
|
;; E. Tiesinga, P. J. Mohr, D. B. Newell, and B. N. Taylor,
|
|
|
|
|
;; Rev. Mod. Phys. 93, 025010 (2021)
|
|
|
|
|
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(defvar math-standard-units
|
|
|
|
|
'( ;; Length
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( m nil "*Meter" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( in "254*10^(-2) cm" "Inch" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"2.54 cm")
|
|
|
|
|
( ft "12 in" "Foot")
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( yd "3 ft" "Yard" )
|
|
|
|
|
( mi "5280 ft" "Mile" )
|
2023-10-10 11:58:03 +02:00
|
|
|
|
( au "149597870700 m" "Astronomical Unit")
|
|
|
|
|
;; "149 597 870 700 m exactly"
|
|
|
|
|
;; http://www.iau.org/static/resolutions/IAU2012_English.pdf
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( lyr "c yr" "Light Year" )
|
2023-10-10 11:58:03 +02:00
|
|
|
|
( pc "(648000/pi) au" "Parsec (**)")
|
|
|
|
|
;; "The parsec is defined as exactly (648 000/π) au"
|
|
|
|
|
;; http://www.iau.org/static/resolutions/IAU2015_English.pdf
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( nmi "1852 m" "Nautical Mile" )
|
|
|
|
|
( fath "6 ft" "Fathom" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( fur "660 ft" "Furlong")
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mu "1 um" "Micron" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( mil "(1/1000) in" "Mil" )
|
2010-11-18 19:14:36 -06:00
|
|
|
|
( point "(1/72) in" "Point (PostScript convention)" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( Ang "10^(-10) m" "Angstrom" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mfi "mi+ft+in" "Miles + feet + inches" )
|
|
|
|
|
;; TeX lengths
|
2010-11-18 19:14:36 -06:00
|
|
|
|
( texpt "(100/7227) in" "Point (TeX convention) (**)" )
|
|
|
|
|
( texpc "12 texpt" "Pica (TeX convention) (**)" )
|
|
|
|
|
( texbp "point" "Big point (TeX convention) (**)" )
|
|
|
|
|
( texdd "(1238/1157) texpt" "Didot point (TeX convention) (**)" )
|
|
|
|
|
( texcc "12 texdd" "Cicero (TeX convention) (**)" )
|
|
|
|
|
( texsp "(1/65536) texpt" "Scaled TeX point (TeX convention) (**)" )
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2002-05-14 18:49:33 +00:00
|
|
|
|
;; Area
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( hect "10000 m^2" "*Hectare" )
|
|
|
|
|
( a "100 m^2" "Are")
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( acre "(1/640) mi^2" "Acre" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( b "10^(-28) m^2" "Barn" )
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2002-05-14 18:49:33 +00:00
|
|
|
|
;; Volume
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( L "10^(-3) m^3" "*Liter" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( l "L" "Liter" )
|
|
|
|
|
( gal "4 qt" "US Gallon" )
|
|
|
|
|
( qt "2 pt" "Quart" )
|
2010-11-18 19:14:36 -06:00
|
|
|
|
( pt "2 cup" "Pint (**)" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( cup "8 ozfl" "Cup" )
|
|
|
|
|
( ozfl "2 tbsp" "Fluid Ounce" )
|
|
|
|
|
( floz "2 tbsp" "Fluid Ounce" )
|
|
|
|
|
( tbsp "3 tsp" "Tablespoon" )
|
2007-08-17 19:57:14 +00:00
|
|
|
|
;; ESUWM defines a US gallon as 231 in^3.
|
|
|
|
|
;; That gives the following exact value for tsp.
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( tsp "492892159375*10^(-11) ml" "Teaspoon" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"4.92892159375 ml")
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( vol "tsp+tbsp+ozfl+cup+pt+qt+gal" "Gallons + ... + teaspoons" nil
|
|
|
|
|
"tsp+tbsp+ozfl+cup+pt+qt+gal")
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( galC "galUK" "Canadian Gallon" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( galUK "454609*10^(-5) L" "UK Gallon" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"4.54609 L") ;; NIST
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2002-05-14 18:49:33 +00:00
|
|
|
|
;; Time
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( s nil "*Second" )
|
|
|
|
|
( sec "s" "Second" )
|
|
|
|
|
( min "60 s" "Minute" )
|
|
|
|
|
( hr "60 min" "Hour" )
|
|
|
|
|
( day "24 hr" "Day" )
|
|
|
|
|
( wk "7 day" "Week" )
|
|
|
|
|
( hms "wk+day+hr+min+s" "Hours, minutes, seconds" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( yr "36525*10^(-2) day" "Year (Julian)" nil
|
|
|
|
|
"365.25 day")
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Hz "1/s" "Hertz" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Speed
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mph "mi/hr" "*Miles per hour" )
|
|
|
|
|
( kph "km/hr" "Kilometers per hour" )
|
|
|
|
|
( knot "nmi/hr" "Knot" )
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2002-05-14 18:49:33 +00:00
|
|
|
|
;; Acceleration
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( ga "980665*10^(-5) m/s^2" "*\"g\" acceleration" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"9.80665 m / s^2") ;; CODATA
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Mass
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( g nil "*Gram" )
|
|
|
|
|
( lb "16 oz" "Pound (mass)" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( oz "28349523125*10^(-9) g" "Ounce (mass)" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"28.349523125 g") ;; ESUWM
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( ton "2000 lb" "Ton" )
|
|
|
|
|
( tpo "ton+lb+oz" "Tons + pounds + ounces (mass)" )
|
|
|
|
|
( t "1000 kg" "Metric ton" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( tonUK "10160469088*10^(-7) kg" "UK ton" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"1016.0469088 kg") ;; ESUWM
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( lbt "12 ozt" "Troy pound" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( ozt "311034768*10^(-7) g" "Troy ounce" nil
|
2008-10-06 12:40:39 +00:00
|
|
|
|
"31.10347680 g") ;; ESUWM, 1/12 exact value for lbt
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( ct "(2/10) g" "Carat" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"0.2 g") ;; ESUWM
|
2023-11-29 10:24:06 +01:00
|
|
|
|
( u "1.66053906660*10^(-27) kg" "Unified atomic mass" nil
|
|
|
|
|
"1.66053906660 10^-27 kg (*)") ;; (approx) CODATA
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Force
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( N "m kg/s^2" "*Newton" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( dyn "10^(-5) N" "Dyne" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( gf "ga g" "Gram (force)" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( lbf "ga lb" "Pound (force)" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( kip "1000 lbf" "Kilopound (force)" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( pdl "138254954376*10^(-12) N" "Poundal" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"0.138254954376 N") ;; ESUWM
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Energy
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( J "N m" "*Joule" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( erg "10^(-7) J" "Erg" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( cal "41868*10^(-4) J" "International Table Calorie" nil
|
2008-10-06 12:40:39 +00:00
|
|
|
|
"4.1868 J") ;; NIST
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( calth "4184*10^(-3) J" "Thermochemical Calorie" nil
|
2008-10-06 12:40:39 +00:00
|
|
|
|
"4.184 J") ;; NIST
|
|
|
|
|
( Cal "1000 cal" "Large Calorie")
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( Btu "105505585262*10^(-8) J" "International Table Btu" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"1055.05585262 J") ;; ESUWM
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( eV "ech V" "Electron volt" )
|
|
|
|
|
( ev "eV" "Electron volt" )
|
|
|
|
|
( therm "105506000 J" "EEC therm" )
|
|
|
|
|
( invcm "h c/cm" "Energy in inverse centimeters" )
|
|
|
|
|
( Kayser "invcm" "Kayser (inverse centimeter energy)" )
|
|
|
|
|
( men "100/invcm" "Inverse energy in meters" )
|
|
|
|
|
( Hzen "h Hz" "Energy in Hertz")
|
|
|
|
|
( Ken "k K" "Energy in Kelvins")
|
2005-04-09 18:59:36 +00:00
|
|
|
|
( Wh "W hr" "Watt hour")
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Ws "W s" "Watt second")
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Power
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( W "J/s" "*Watt" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( hp "550 ft lbf/s" "Horsepower") ;;ESUWM
|
|
|
|
|
( hpm "75 m kgf/s" "Metric Horsepower") ;;ESUWM
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Temperature
|
2023-10-10 14:20:05 +02:00
|
|
|
|
( K nil "*Kelvin" K )
|
2023-10-10 15:18:52 +02:00
|
|
|
|
;; FIXME: Add °C and °F, but it requires that we sort out input etc for
|
|
|
|
|
;; the ° sign.
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( dC "K" "Degree Celsius" C )
|
|
|
|
|
( degC "K" "Degree Celsius" C )
|
|
|
|
|
( dF "(5/9) K" "Degree Fahrenheit" F )
|
|
|
|
|
( degF "(5/9) K" "Degree Fahrenheit" F )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Pressure
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Pa "N/m^2" "*Pascal" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( bar "10^5 Pa" "Bar" )
|
|
|
|
|
( atm "101325 Pa" "Standard atmosphere" ) ;; CODATA
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( Torr "(1/760) atm" "Torr")
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mHg "1000 Torr" "Meter of mercury" )
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( inHg "254*10^(-1) mmHg" "Inch of mercury" nil
|
2008-09-30 02:40:31 +00:00
|
|
|
|
"25.4 mmHg")
|
2008-11-19 17:03:40 +00:00
|
|
|
|
( inH2O "2.490889*10^2 Pa" "Inch of water" nil
|
2008-10-06 12:40:39 +00:00
|
|
|
|
"2.490889 10^2 Pa (*)") ;;(approx) NIST
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( psi "lbf/in^2" "Pounds per square inch" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Viscosity
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( P "(1/10) Pa s" "*Poise" )
|
|
|
|
|
( St "10^(-4) m^2/s" "Stokes" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Electromagnetism
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( A nil "*Ampere" )
|
|
|
|
|
( C "A s" "Coulomb" )
|
|
|
|
|
( Fdy "ech Nav" "Faraday" )
|
|
|
|
|
( V "W/A" "Volt" )
|
|
|
|
|
( ohm "V/A" "Ohm" )
|
2010-05-14 23:50:25 -05:00
|
|
|
|
( Ω "ohm" "Ohm" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mho "A/V" "Mho" )
|
|
|
|
|
( S "A/V" "Siemens" )
|
|
|
|
|
( F "C/V" "Farad" )
|
|
|
|
|
( H "Wb/A" "Henry" )
|
|
|
|
|
( T "Wb/m^2" "Tesla" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( Gs "10^(-4) T" "Gauss" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Wb "V s" "Weber" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Luminous intensity
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( cd nil "*Candela" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( sb "10000 cd/m^2" "Stilb" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( lm "cd sr" "Lumen" )
|
|
|
|
|
( lx "lm/m^2" "Lux" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( ph "10000 lx" "Phot" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( fc "lm/ft^2" "Footcandle") ;; ESUWM
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( lam "10000 lm/m^2" "Lambert" )
|
2008-10-06 12:40:39 +00:00
|
|
|
|
( flam "(1/pi) cd/ft^2" "Footlambert") ;; ESUWM
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Radioactivity
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Bq "1/s" "*Becquerel" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( Ci "37*10^9 Bq" "Curie" ) ;; ESUWM
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( Gy "J/kg" "Gray" )
|
|
|
|
|
( Sv "Gy" "Sievert" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( R "258*10^(-6) C/kg" "Roentgen" ) ;; NIST
|
|
|
|
|
( rd "(1/100) Gy" "Rad" )
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( rem "rd" "Rem" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Amount of substance
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( mol nil "*Mole" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Plane angle
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( rad nil "*Radian" )
|
|
|
|
|
( circ "2 pi rad" "Full circle" )
|
|
|
|
|
( rev "circ" "Full revolution" )
|
|
|
|
|
( deg "circ/360" "Degree" )
|
|
|
|
|
( arcmin "deg/60" "Arc minute" )
|
|
|
|
|
( arcsec "arcmin/60" "Arc second" )
|
|
|
|
|
( grad "circ/400" "Grade" )
|
|
|
|
|
( rpm "rev/min" "Revolutions per minute" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
|
|
|
|
;; Solid angle
|
2005-10-19 20:19:04 +00:00
|
|
|
|
( sr nil "*Steradian" )
|
2002-05-14 18:49:33 +00:00
|
|
|
|
|
2023-11-29 10:24:06 +01:00
|
|
|
|
;; Constants defining the International System of Units (SI)
|
|
|
|
|
( c "299792458 m/s" "*Speed of light" )
|
|
|
|
|
( h "6.62607015*10^(-34) J s" "Planck constant" nil
|
|
|
|
|
"6.62607015 10^-34 J s")
|
|
|
|
|
( ech "1.602176634*10^(-19) C" "Elementary charge" nil
|
|
|
|
|
"1.602176634 10^-19 C")
|
|
|
|
|
( e "ech" "Elementary charge" nil
|
|
|
|
|
"1.602176634 10^-19 C")
|
|
|
|
|
( k "1.380649*10^(-23) J/K" "Boltzmann constant" nil
|
|
|
|
|
"1.380649 10^-23 J/K")
|
|
|
|
|
( Nav "6.02214076*10^(23) / mol" "Avogadro constant" nil
|
|
|
|
|
"6.02214076 10^23 / mol")
|
|
|
|
|
|
2005-10-19 20:19:04 +00:00
|
|
|
|
;; Other physical quantities
|
2018-11-19 07:29:56 -08:00
|
|
|
|
;; Unless otherwise mentioned, the values are from CODATA,
|
|
|
|
|
;; and are approximate.
|
2023-11-29 10:24:06 +01:00
|
|
|
|
( hbar "h / (2 pi)" "*Reduced Planck constant" )
|
2018-11-19 07:29:56 -08:00
|
|
|
|
;; After the 2018 SI redefinition, eps0 and mu0 are measured quantities,
|
|
|
|
|
;; and mu0 no longer has the previous exact value of 4 pi 10^(-7) H/m.
|
|
|
|
|
( eps0 "ech^2 / (2 alpha h c)" "Permittivity of vacuum" )
|
2010-05-14 23:50:25 -05:00
|
|
|
|
( ε0 "eps0" "Permittivity of vacuum" )
|
2023-10-20 14:50:45 +02:00
|
|
|
|
( mu0 "1 / (eps0 c^2)" "Permeability of vacuum")
|
|
|
|
|
( μ0 "mu0" "Permeability of vacuum")
|
2023-11-29 10:24:06 +01:00
|
|
|
|
( G "6.67430*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil
|
|
|
|
|
"6.67430 10^-11 m^3/(kg s^2) (*)")
|
|
|
|
|
( me "9.1093837015*10^(-31) kg" "Electron rest mass" nil
|
|
|
|
|
"9.1093837015 10^-31 kg (*)")
|
|
|
|
|
( mp "1.67262192369*10^(-27) kg" "Proton rest mass" nil
|
|
|
|
|
"1.67262192369 10^-27 kg (*)")
|
|
|
|
|
( mn "1.67492749804*10^(-27) kg" "Neutron rest mass" nil
|
|
|
|
|
"1.67492749804 10^-27 kg (*)")
|
|
|
|
|
( mmu "1.883531627*10^(-28) kg" "Muon rest mass" nil
|
|
|
|
|
"1.883531627 10^-28 kg (*)")
|
2010-05-14 23:50:25 -05:00
|
|
|
|
( mμ "mmu" "Muon rest mass" nil
|
2023-11-29 10:24:06 +01:00
|
|
|
|
"1.883531627 10^-28 kg (*)")
|
|
|
|
|
( Ryd "10973731.568160 /m" "Rydberg constant" nil
|
|
|
|
|
"10973731.568160 /m (*)")
|
2018-11-19 07:29:56 -08:00
|
|
|
|
( sigma "2 pi^5 k^4 / (15 h^3 c^2)" "Stefan-Boltzmann constant")
|
|
|
|
|
( σ "sigma" "Stefan-Boltzmann constant")
|
2023-11-29 10:24:06 +01:00
|
|
|
|
( alpha "7.2973525693*10^(-3)" "Fine structure constant" nil
|
|
|
|
|
"7.2973525693 10^-3 (*)")
|
|
|
|
|
( α "alpha" "Fine structure constant" nil
|
|
|
|
|
"7.2973525693 10^-3 (*)")
|
|
|
|
|
( muB "9.2740100783*10^(-24) J/T" "Bohr magneton" nil
|
|
|
|
|
"9.2740100783 10^-24 J/T (*)")
|
|
|
|
|
( muN "5.0507837461*10^(-27) J/T" "Nuclear magneton" nil
|
|
|
|
|
"5.0507837461 10^-27 J/T (*)")
|
2023-11-29 17:02:22 +01:00
|
|
|
|
( mue "-9.2847647043*10^(-24) J/T" "Electron magnetic moment" nil
|
2023-11-29 10:24:06 +01:00
|
|
|
|
"-9.2847647043 10^-24 J/T (*)")
|
|
|
|
|
( mup "1.41060679736*10^(-26) J/T" "Proton magnetic moment" nil
|
|
|
|
|
"1.41060679736 10^-26 J/T (*)")
|
|
|
|
|
( R0 "Nav k" "Molar gas constant" )
|
|
|
|
|
( V0 "R0 273.15 K / 10^5 Pa" "Standard volume of ideal gas" )
|
|
|
|
|
;; IUPAC 1982 standard temperature and pressure
|
|
|
|
|
|
2011-01-23 23:08:04 -06:00
|
|
|
|
;; Logarithmic units
|
|
|
|
|
( Np nil "*Neper")
|
2023-10-10 13:50:44 +02:00
|
|
|
|
( dB "(ln(10)/20) Np" "decibel"))
|
|
|
|
|
"List of predefined units for Calc.
|
|
|
|
|
|
|
|
|
|
Each element is (NAME DEF DESC TEMP-UNIT HUMAN-DEF), where:
|
|
|
|
|
|
|
|
|
|
NAME is the unit symbol.
|
|
|
|
|
DEF is a string defining the unit as a Calc expression; nil if base unit.
|
|
|
|
|
DESC is a string describing the unit (to a human reader).
|
|
|
|
|
A leading asterisk indicates that the unit is first in its group.
|
2023-10-10 15:18:52 +02:00
|
|
|
|
TEMP-UNIT is `K', `C' or `F' for temperature units and is used to identify
|
|
|
|
|
the unit when doing absolute temperature conversion
|
|
|
|
|
(`calc-convert-temperature'). For other units, nil.
|
2023-10-10 13:50:44 +02:00
|
|
|
|
HUMAN-DEF is a string defining the unit (to a human reader).
|
|
|
|
|
If absent or nil, DEF is used.
|
|
|
|
|
|
|
|
|
|
(*) in HUMAN-DEF means that the definition is approximate, otherwise exact.
|
|
|
|
|
(**) in DESC means that the unit name is different in TeX and LaTeX
|
|
|
|
|
display modes.")
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar math-additional-units nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Additional units table for user-defined units.
|
2008-11-19 17:03:40 +00:00
|
|
|
|
Must be formatted like `math-standard-units'.
|
2008-11-20 02:44:21 +00:00
|
|
|
|
If you change this, be sure to set `math-units-table' to nil to ensure
|
2001-11-19 07:42:20 +00:00
|
|
|
|
that the combined units table will be rebuilt.")
|
|
|
|
|
|
|
|
|
|
(defvar math-unit-prefixes
|
2022-11-24 13:47:55 +01:00
|
|
|
|
'( ( ?Q (^ 10 30) "quetta" )
|
|
|
|
|
( ?R (^ 10 27) "ronna" )
|
2022-11-30 01:01:43 +01:00
|
|
|
|
( ?Y (^ 10 24) "yotta" )
|
|
|
|
|
( ?Z (^ 10 21) "zetta" )
|
|
|
|
|
( ?E (^ 10 18) "exa" )
|
|
|
|
|
( ?P (^ 10 15) "peta" )
|
|
|
|
|
( ?T (^ 10 12) "tera" )
|
|
|
|
|
( ?G (^ 10 9) "giga" )
|
|
|
|
|
( ?M (^ 10 6) "mega" )
|
|
|
|
|
( ?k (^ 10 3) "kilo" )
|
|
|
|
|
( ?K (^ 10 3) "kilo" )
|
|
|
|
|
( ?h (^ 10 2) "hecto" )
|
|
|
|
|
( ?H (^ 10 2) "hecto" )
|
|
|
|
|
( ?D (^ 10 1) "deka" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( 0 (^ 10 0) nil )
|
2022-11-30 01:01:43 +01:00
|
|
|
|
( ?d (^ 10 -1) "deci" )
|
|
|
|
|
( ?c (^ 10 -2) "centi" )
|
|
|
|
|
( ?m (^ 10 -3) "milli" )
|
|
|
|
|
( ?u (^ 10 -6) "micro" )
|
|
|
|
|
( ?μ (^ 10 -6) "micro" )
|
|
|
|
|
( ?n (^ 10 -9) "nano" )
|
|
|
|
|
( ?p (^ 10 -12) "pico" )
|
|
|
|
|
( ?f (^ 10 -15) "femto" )
|
|
|
|
|
( ?a (^ 10 -18) "atto" )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( ?z (^ 10 -21) "zepto" )
|
2022-11-24 13:47:55 +01:00
|
|
|
|
( ?y (^ 10 -24) "yocto" )
|
|
|
|
|
( ?r (^ 10 -27) "ronto" )
|
|
|
|
|
( ?q (^ 10 -30) "quecto" )
|
|
|
|
|
))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar math-standard-units-systems
|
|
|
|
|
'( ( base nil )
|
2007-08-15 15:42:58 +00:00
|
|
|
|
( si ( ( g '(/ (var kg var-kg) 1000) ) ) )
|
|
|
|
|
( mks ( ( g '(/ (var kg var-kg) 1000) ) ) )
|
|
|
|
|
( cgs ( ( m '(* (var cm var-cm) 100 ) ) ) )))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar math-units-table nil
|
2008-11-19 17:03:40 +00:00
|
|
|
|
"Internal units table.
|
|
|
|
|
Derived from `math-standard-units' and `math-additional-units'.
|
2001-11-19 07:42:20 +00:00
|
|
|
|
Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
|
|
|
|
|
|
|
|
|
|
(defvar math-units-table-buffer-valid nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;;; Units commands.
|
|
|
|
|
|
|
|
|
|
(defun calc-base-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(let ((calc-autorange-units nil))
|
|
|
|
|
(calc-enter-result 1 "bsun" (math-simplify-units
|
|
|
|
|
(math-to-standard-units (calc-top-n 1)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
nil))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2012-05-18 22:03:35 -05:00
|
|
|
|
(defvar calc-ensure-consistent-units)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-quick-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
2009-01-09 03:57:12 +00:00
|
|
|
|
(let* ((num (- last-command-event ?0))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(pos (if (= num 0) 10 num))
|
|
|
|
|
(units (calc-var-value 'var-Units))
|
|
|
|
|
(expr (calc-top-n 1)))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(unless (and (>= num 0) (<= num 9))
|
2004-09-18 09:29:35 +00:00
|
|
|
|
(error "Bad unit number"))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(unless (math-vectorp units)
|
2004-09-18 09:29:35 +00:00
|
|
|
|
(error "No \"quick units\" are defined"))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(unless (< pos (length units))
|
2004-09-18 09:29:35 +00:00
|
|
|
|
(error "Unit number %d not defined" pos))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (math-units-in-expr-p expr nil)
|
2012-05-18 22:00:48 -05:00
|
|
|
|
(progn
|
|
|
|
|
(if calc-ensure-consistent-units
|
2012-05-18 22:11:09 -05:00
|
|
|
|
(math-check-unit-consistency expr (nth pos units)))
|
2012-05-18 22:00:48 -05:00
|
|
|
|
(calc-enter-result 1 (format "cun%d" num)
|
|
|
|
|
(math-convert-units expr (nth pos units))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-enter-result 1 (format "*un%d" num)
|
|
|
|
|
(math-simplify-units
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-mul expr (nth pos units))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2007-08-14 05:24:35 +00:00
|
|
|
|
(defun math-get-standard-units (expr)
|
|
|
|
|
"Return the standard units in EXPR."
|
|
|
|
|
(math-simplify-units
|
|
|
|
|
(math-extract-units
|
|
|
|
|
(math-to-standard-units expr nil))))
|
|
|
|
|
|
|
|
|
|
(defun math-get-units (expr)
|
|
|
|
|
"Return the units in EXPR."
|
|
|
|
|
(math-simplify-units
|
|
|
|
|
(math-extract-units expr)))
|
|
|
|
|
|
|
|
|
|
(defun math-make-unit-string (expr)
|
|
|
|
|
"Return EXPR in string form.
|
|
|
|
|
If EXPR is nil, return nil."
|
|
|
|
|
(if expr
|
|
|
|
|
(let ((cexpr (math-compose-expr expr 0)))
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 18:58:46 +02:00
|
|
|
|
(string-replace
|
2007-08-15 15:42:58 +00:00
|
|
|
|
" / " "/"
|
|
|
|
|
(if (stringp cexpr)
|
|
|
|
|
cexpr
|
|
|
|
|
(math-composition-to-string cexpr))))))
|
2007-08-14 05:24:35 +00:00
|
|
|
|
|
2007-09-26 00:08:16 +00:00
|
|
|
|
(defvar math-default-units-table
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(make-hash-table :test 'equal)
|
2007-08-14 05:24:35 +00:00
|
|
|
|
"A table storing previously converted units.")
|
|
|
|
|
|
|
|
|
|
(defun math-get-default-units (expr)
|
|
|
|
|
"Get default units to use when converting the units in EXPR."
|
|
|
|
|
(let* ((units (math-get-units expr))
|
|
|
|
|
(standard-units (math-get-standard-units expr))
|
2007-09-26 00:08:16 +00:00
|
|
|
|
(default-units (gethash
|
2007-08-14 05:24:35 +00:00
|
|
|
|
standard-units
|
|
|
|
|
math-default-units-table)))
|
|
|
|
|
(if (equal units (car default-units))
|
|
|
|
|
(math-make-unit-string (cadr default-units))
|
|
|
|
|
(math-make-unit-string (car default-units)))))
|
|
|
|
|
|
2012-08-11 23:32:28 -05:00
|
|
|
|
(defun math-put-default-units (expr &optional comp std)
|
|
|
|
|
"Put the units in EXPR in the default units table.
|
|
|
|
|
If COMP or STD is non-nil, put that in the units table instead."
|
|
|
|
|
(let* ((new-units (or comp std (math-get-units expr)))
|
2015-08-21 06:31:54 -07:00
|
|
|
|
(standard-units (math-get-standard-units
|
2012-08-11 23:32:28 -05:00
|
|
|
|
(cond
|
|
|
|
|
(comp (math-simplify-units expr))
|
|
|
|
|
(std expr)
|
|
|
|
|
(t new-units))))
|
|
|
|
|
(default-units (gethash standard-units math-default-units-table)))
|
|
|
|
|
(unless (eq standard-units 1)
|
|
|
|
|
(cond
|
|
|
|
|
((not default-units)
|
|
|
|
|
(puthash standard-units (list new-units) math-default-units-table))
|
|
|
|
|
((not (equal new-units (car default-units)))
|
|
|
|
|
(puthash standard-units
|
|
|
|
|
(list new-units (car default-units))
|
|
|
|
|
math-default-units-table))))))
|
2007-08-14 05:24:35 +00:00
|
|
|
|
|
2013-04-04 21:20:35 -05:00
|
|
|
|
(defvar calc-allow-units-as-numbers t)
|
2013-02-09 17:17:05 -06:00
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-convert-units (&optional old-units new-units)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(let ((expr (calc-top-n 1))
|
|
|
|
|
(uoldname nil)
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(unitscancel nil)
|
2013-02-09 17:17:05 -06:00
|
|
|
|
(nouold nil)
|
2007-08-14 05:24:35 +00:00
|
|
|
|
units
|
|
|
|
|
defunits)
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(if (or (not (math-units-in-expr-p expr t))
|
2013-02-09 17:17:05 -06:00
|
|
|
|
(setq unitscancel (and
|
2013-04-04 21:20:35 -05:00
|
|
|
|
(if (get 'calc-allow-units-as-numbers 'saved-value)
|
|
|
|
|
(car (get 'calc-allow-units-as-numbers 'saved-value))
|
|
|
|
|
calc-allow-units-as-numbers)
|
2013-02-09 17:17:05 -06:00
|
|
|
|
(eq (math-get-standard-units expr) 1))))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(let ((uold (or old-units
|
|
|
|
|
(progn
|
2015-08-21 06:31:54 -07:00
|
|
|
|
(setq uoldname
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(if unitscancel
|
2015-08-21 06:31:54 -07:00
|
|
|
|
(read-string
|
2013-01-30 08:14:27 -06:00
|
|
|
|
"(The expression is unitless when simplified) Old Units: ")
|
|
|
|
|
(read-string "Old units: ")))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(if (equal uoldname "")
|
|
|
|
|
(progn
|
2013-02-09 17:17:05 -06:00
|
|
|
|
(setq nouold unitscancel)
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(setq uoldname "1")
|
|
|
|
|
1)
|
|
|
|
|
(if (string-match "\\` */" uoldname)
|
|
|
|
|
(setq uoldname (concat "1" uoldname)))
|
|
|
|
|
(math-read-expr uoldname))))))
|
2015-01-28 21:17:10 -06:00
|
|
|
|
(unless (math-units-in-expr-p uold t)
|
|
|
|
|
(error "No units specified"))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (eq (car-safe uold) 'error)
|
|
|
|
|
(error "Bad format in units expression: %s" (nth 1 uold)))
|
|
|
|
|
(setq expr (math-mul expr uold))))
|
2012-08-11 23:32:28 -05:00
|
|
|
|
(setq defunits (math-get-default-units expr))
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(unless new-units
|
|
|
|
|
(setq new-units
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(read-string (format-prompt
|
2013-02-09 17:17:05 -06:00
|
|
|
|
(if (and uoldname (not nouold))
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(concat "Old units: "
|
|
|
|
|
uoldname
|
|
|
|
|
", new units")
|
|
|
|
|
"New units")
|
2021-10-05 03:34:08 +02:00
|
|
|
|
defunits)))
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(if (and
|
|
|
|
|
(string= new-units "")
|
|
|
|
|
defunits)
|
|
|
|
|
(setq new-units defunits)))
|
|
|
|
|
(when (string-match "\\` */" new-units)
|
|
|
|
|
(setq new-units (concat "1" new-units)))
|
|
|
|
|
(setq units (math-read-expr new-units))
|
|
|
|
|
(when (eq (car-safe units) 'error)
|
|
|
|
|
(error "Bad format in units expression: %s" (nth 2 units)))
|
|
|
|
|
(if calc-ensure-consistent-units
|
|
|
|
|
(math-check-unit-consistency expr units))
|
|
|
|
|
(let ((unew (math-units-in-expr-p units t))
|
|
|
|
|
(std (and (eq (car-safe units) 'var)
|
|
|
|
|
(assq (nth 1 units) math-standard-units-systems)))
|
|
|
|
|
(comp (eq (car-safe units) '+)))
|
|
|
|
|
(unless (or unew std)
|
|
|
|
|
(error "No units specified"))
|
2013-03-07 20:11:25 -06:00
|
|
|
|
(let* ((noold (and uoldname (not (equal uoldname "1"))))
|
|
|
|
|
(res
|
|
|
|
|
(if std
|
|
|
|
|
(math-simplify-units (math-to-standard-units expr (nth 1 std)))
|
|
|
|
|
(math-convert-units expr units noold))))
|
|
|
|
|
(unless std
|
|
|
|
|
(math-put-default-units (if noold units res) (if comp units)))
|
2013-01-30 08:14:27 -06:00
|
|
|
|
(calc-enter-result 1 "cvun" res))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2015-01-28 21:17:10 -06:00
|
|
|
|
(defun calc-convert-exact-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(let* ((expr (calc-top-n 1)))
|
|
|
|
|
(unless (math-units-in-expr-p expr t)
|
2021-09-14 08:43:18 +02:00
|
|
|
|
(error "No units in expression"))
|
2015-01-28 21:17:10 -06:00
|
|
|
|
(let* ((old-units (math-extract-units expr))
|
|
|
|
|
(defunits (math-get-default-units expr))
|
|
|
|
|
units
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(new-units (read-string (format-prompt "New units" defunits))))
|
2015-01-28 21:17:10 -06:00
|
|
|
|
(if (and
|
|
|
|
|
(string= new-units "")
|
|
|
|
|
defunits)
|
|
|
|
|
(setq new-units defunits))
|
|
|
|
|
(setq units (math-read-expr new-units))
|
|
|
|
|
(when (eq (car-safe units) 'error)
|
|
|
|
|
(error "Bad format in units expression: %s" (nth 2 units)))
|
|
|
|
|
(math-check-unit-consistency old-units units)
|
|
|
|
|
(let ((res
|
|
|
|
|
(list '* (math-mul (math-remove-units expr)
|
|
|
|
|
(math-simplify-units
|
2015-01-28 21:37:24 -06:00
|
|
|
|
(math-to-standard-units (list '/ old-units units) nil)))
|
2015-01-28 21:17:10 -06:00
|
|
|
|
units)))
|
|
|
|
|
(calc-enter-result 1 "cvxu" res))))))
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-autorange-units (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(calc-change-mode 'calc-autorange-units arg nil t)
|
|
|
|
|
(message (if calc-autorange-units
|
2001-11-19 07:42:20 +00:00
|
|
|
|
"Adjusting target unit prefix automatically"
|
|
|
|
|
"Using target units exactly"))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-convert-temperature (&optional old-units new-units)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
2016-03-03 17:56:44 +00:00
|
|
|
|
(let ((tempunits (delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(if (nth 3 x) (car x)))
|
|
|
|
|
math-standard-units)))
|
|
|
|
|
(expr (calc-top-n 1))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(uold nil)
|
|
|
|
|
(uoldname nil)
|
2007-08-14 05:24:35 +00:00
|
|
|
|
unew
|
|
|
|
|
defunits)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq uold (or old-units
|
|
|
|
|
(let ((units (math-single-units-in-expr-p expr)))
|
|
|
|
|
(if units
|
|
|
|
|
(if (consp units)
|
|
|
|
|
(list 'var (car units)
|
|
|
|
|
(intern (concat "var-"
|
|
|
|
|
(symbol-name
|
|
|
|
|
(car units)))))
|
|
|
|
|
(error "Not a pure temperature expression"))
|
|
|
|
|
(math-read-expr
|
2016-03-03 17:56:44 +00:00
|
|
|
|
(setq uoldname (completing-read
|
|
|
|
|
"Old temperature units: "
|
|
|
|
|
tempunits)))))))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (eq (car-safe uold) 'error)
|
|
|
|
|
(error "Bad format in units expression: %s" (nth 2 uold)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(or (math-units-in-expr-p expr nil)
|
|
|
|
|
(setq expr (math-mul expr uold)))
|
2007-08-14 05:24:35 +00:00
|
|
|
|
(setq defunits (math-get-default-units expr))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq unew (or new-units
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(completing-read (format-prompt
|
|
|
|
|
(if uoldname
|
|
|
|
|
(concat "Old temperature units: "
|
|
|
|
|
uoldname
|
|
|
|
|
", new units")
|
|
|
|
|
"New temperature units")
|
|
|
|
|
defunits)
|
|
|
|
|
tempunits)))
|
2008-09-17 02:25:37 +00:00
|
|
|
|
(setq unew (math-read-expr (if (string= unew "") defunits unew)))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (eq (car-safe unew) 'error)
|
|
|
|
|
(error "Bad format in units expression: %s" (nth 2 unew)))
|
2007-08-14 05:24:35 +00:00
|
|
|
|
(math-put-default-units unew)
|
2007-12-31 02:40:18 +00:00
|
|
|
|
(let ((ntemp (calc-normalize
|
|
|
|
|
(math-simplify-units
|
|
|
|
|
(math-convert-temperature expr uold unew
|
|
|
|
|
uoldname)))))
|
|
|
|
|
(if (Math-zerop ntemp)
|
|
|
|
|
(setq ntemp (list '* ntemp unew)))
|
|
|
|
|
(let ((calc-simplify-mode 'none))
|
|
|
|
|
(calc-enter-result 1 "cvtm" ntemp))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-remove-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(calc-enter-result 1 "rmun" (math-simplify-units
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-remove-units (calc-top-n 1))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-extract-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
2012-05-18 22:00:48 -05:00
|
|
|
|
(calc-enter-result 1 "exun" (math-simplify-units
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-extract-units (calc-top-n 1))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2007-09-26 00:08:16 +00:00
|
|
|
|
;; The variables calc-num-units and calc-den-units are local to
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; calc-explain-units, but are used by calc-explain-units-rec,
|
|
|
|
|
;; which is called by calc-explain-units.
|
|
|
|
|
(defvar calc-num-units)
|
|
|
|
|
(defvar calc-den-units)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-explain-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(let ((calc-num-units nil)
|
|
|
|
|
(calc-den-units nil))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-explain-units-rec (calc-top-n 1) 1)
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(and calc-den-units (string-match "^[^(].* .*[^)]$" calc-den-units)
|
|
|
|
|
(setq calc-den-units (concat "(" calc-den-units ")")))
|
|
|
|
|
(if calc-num-units
|
|
|
|
|
(if calc-den-units
|
|
|
|
|
(message "%s per %s" calc-num-units calc-den-units)
|
|
|
|
|
(message "%s" calc-num-units))
|
|
|
|
|
(if calc-den-units
|
|
|
|
|
(message "1 per %s" calc-den-units)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(message "No units in expression"))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-explain-units-rec (expr pow)
|
|
|
|
|
(let ((u (math-check-unit-name expr))
|
|
|
|
|
pos)
|
|
|
|
|
(if (and u (not (math-zerop pow)))
|
|
|
|
|
(let ((name (or (nth 2 u) (symbol-name (car u)))))
|
|
|
|
|
(if (eq (aref name 0) ?\*)
|
|
|
|
|
(setq name (substring name 1)))
|
2010-05-14 23:50:25 -05:00
|
|
|
|
(if (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name)
|
|
|
|
|
(if (string-match "^[a-zA-Zα-ωΑ-Ω0-9' ()]*$" name)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(while (setq pos (string-match "[ ()]" name))
|
|
|
|
|
(setq name (concat (substring name 0 pos)
|
|
|
|
|
(if (eq (aref name pos) 32) "-" "")
|
|
|
|
|
(substring name (1+ pos)))))
|
|
|
|
|
(setq name (concat "(" name ")"))))
|
|
|
|
|
(or (eq (nth 1 expr) (car u))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setq name (concat (nth 2 (assq (aref (symbol-name (nth 1 expr))
|
|
|
|
|
0)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
math-unit-prefixes))
|
2010-05-14 23:50:25 -05:00
|
|
|
|
(if (and (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(not (memq (car u) '(mHg gf))))
|
|
|
|
|
(concat "-" name)
|
|
|
|
|
(downcase name)))))
|
|
|
|
|
(cond ((or (math-equal-int pow 1)
|
|
|
|
|
(math-equal-int pow -1)))
|
|
|
|
|
((or (math-equal-int pow 2)
|
|
|
|
|
(math-equal-int pow -2))
|
|
|
|
|
(if (equal (nth 4 u) '((m . 1)))
|
|
|
|
|
(setq name (concat "Square-" name))
|
|
|
|
|
(setq name (concat name "-squared"))))
|
|
|
|
|
((or (math-equal-int pow 3)
|
|
|
|
|
(math-equal-int pow -3))
|
|
|
|
|
(if (equal (nth 4 u) '((m . 1)))
|
|
|
|
|
(setq name (concat "Cubic-" name))
|
|
|
|
|
(setq name (concat name "-cubed"))))
|
|
|
|
|
(t
|
|
|
|
|
(setq name (concat name "^"
|
|
|
|
|
(math-format-number (math-abs pow))))))
|
|
|
|
|
(if (math-posp pow)
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(setq calc-num-units (if calc-num-units
|
|
|
|
|
(concat calc-num-units " " name)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
name))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(setq calc-den-units (if calc-den-units
|
|
|
|
|
(concat calc-den-units " " name)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
name))))
|
|
|
|
|
(cond ((eq (car-safe expr) '*)
|
|
|
|
|
(calc-explain-units-rec (nth 1 expr) pow)
|
|
|
|
|
(calc-explain-units-rec (nth 2 expr) pow))
|
|
|
|
|
((eq (car-safe expr) '/)
|
|
|
|
|
(calc-explain-units-rec (nth 1 expr) pow)
|
|
|
|
|
(calc-explain-units-rec (nth 2 expr) (- pow)))
|
|
|
|
|
((memq (car-safe expr) '(neg + -))
|
|
|
|
|
(calc-explain-units-rec (nth 1 expr) pow))
|
|
|
|
|
((and (eq (car-safe expr) '^)
|
|
|
|
|
(math-realp (nth 2 expr)))
|
|
|
|
|
(calc-explain-units-rec (nth 1 expr)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-mul pow (nth 2 expr))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-simplify-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(calc-with-default-simplification
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(calc-enter-result 1 "smun" (math-simplify-units (calc-top-n 1))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-view-units-table (n)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(and n (setq math-units-table-buffer-valid nil))
|
|
|
|
|
(let ((win (get-buffer-window "*Units Table*")))
|
|
|
|
|
(if (and win
|
|
|
|
|
math-units-table
|
|
|
|
|
math-units-table-buffer-valid)
|
|
|
|
|
(progn
|
|
|
|
|
(bury-buffer (window-buffer win))
|
|
|
|
|
(let ((curwin (selected-window)))
|
|
|
|
|
(select-window win)
|
|
|
|
|
(switch-to-buffer nil)
|
|
|
|
|
(select-window curwin)))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-build-units-table-buffer nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-enter-units-table (n)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(and n (setq math-units-table-buffer-valid nil))
|
|
|
|
|
(math-build-units-table-buffer t)
|
2005-09-18 12:42:35 +00:00
|
|
|
|
(message "%s" (substitute-command-keys "Type \\[calc] to return to the Calculator")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2008-09-30 02:40:31 +00:00
|
|
|
|
(defun calc-define-unit (uname desc &optional disp)
|
|
|
|
|
(interactive "SDefine unit name: \nsDescription: \nP")
|
|
|
|
|
(if disp (setq disp (read-string "Display definition: ")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let ((form (calc-top-n 1))
|
|
|
|
|
(unit (assq uname math-additional-units)))
|
|
|
|
|
(or unit
|
|
|
|
|
(setq math-additional-units
|
2008-09-30 02:40:31 +00:00
|
|
|
|
(cons (setq unit (list uname nil nil nil nil))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
math-additional-units)
|
|
|
|
|
math-units-table nil))
|
|
|
|
|
(setcar (cdr unit) (and (not (and (eq (car-safe form) 'var)
|
|
|
|
|
(eq (nth 1 form) uname)))
|
|
|
|
|
(not (math-equal-int form 1))
|
|
|
|
|
(math-format-flat-expr form 0)))
|
|
|
|
|
(setcar (cdr (cdr unit)) (and (not (equal desc ""))
|
2008-09-30 02:40:31 +00:00
|
|
|
|
desc))
|
|
|
|
|
(if disp
|
|
|
|
|
(setcar (cdr (cdr (cdr (cdr unit)))) disp))))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(calc-invalidate-units-table))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-undefine-unit (uname)
|
|
|
|
|
(interactive "SUndefine unit name: ")
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let ((unit (assq uname math-additional-units)))
|
|
|
|
|
(or unit
|
|
|
|
|
(if (assq uname math-standard-units)
|
|
|
|
|
(error "\"%s\" is a predefined unit name" uname)
|
|
|
|
|
(error "Unit name \"%s\" not found" uname)))
|
|
|
|
|
(setq math-additional-units (delq unit math-additional-units)
|
|
|
|
|
math-units-table nil)))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(calc-invalidate-units-table))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-invalidate-units-table ()
|
|
|
|
|
(setq math-units-table nil)
|
|
|
|
|
(let ((buf (get-buffer "*Units Table*")))
|
|
|
|
|
(and buf
|
* calc/calc.el (calc, calc-refresh, calc-trail-buffer, calc-record)
(calcDigit-nondigit):
* calc/calc-yank.el (calc-copy-to-buffer):
* calc/calc-units.el (calc-invalidate-units-table):
* calc/calc-trail.el (calc-trail-yank):
* calc/calc-store.el (calc-insert-variables):
* calc/calc-rewr.el (math-rewrite, math-rewrite-phase):
* calc/calc-prog.el (calc-read-parse-table):
* calc/calc-keypd.el (calc-do-keypad, calc-keypad-right-click):
* calc/calc-help.el (calc-describe-bindings, calc-describe-key):
* calc/calc-graph.el (calc-graph-delete, calc-graph-add-curve)
(calc-graph-juggle, calc-graph-count-curves, calc-graph-plot)
(calc-graph-plot, calc-graph-format-data, calc-graph-set-styles)
(calc-graph-name, calc-graph-find-command, calc-graph-view)
(calc-graph-view, calc-gnuplot-command, calc-graph-init):
* calc/calc-ext.el (calc-realign):
* calc/calc-embed.el (calc-do-embedded, calc-do-embedded)
(calc-embedded-finish-edit, calc-embedded-make-info)
(calc-embedded-finish-command, calc-embedded-stack-change):
* calc/calc-aent.el (calcAlg-enter): Use with-current-buffer.
2009-10-28 18:35:33 +00:00
|
|
|
|
(with-current-buffer buf
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (looking-at "Calculator Units Table")
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(insert "(Obsolete) "))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-get-unit-definition (uname)
|
|
|
|
|
(interactive "SGet definition for unit: ")
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(math-build-units-table)
|
|
|
|
|
(let ((unit (assq uname math-units-table)))
|
|
|
|
|
(or unit
|
|
|
|
|
(error "Unit name \"%s\" not found" uname))
|
|
|
|
|
(let ((msg (nth 2 unit)))
|
|
|
|
|
(if (stringp msg)
|
|
|
|
|
(if (string-match "^\\*" msg)
|
|
|
|
|
(setq msg (substring msg 1)))
|
|
|
|
|
(setq msg (symbol-name uname)))
|
|
|
|
|
(if (nth 1 unit)
|
|
|
|
|
(progn
|
|
|
|
|
(calc-enter-result 0 "ugdf" (nth 1 unit))
|
|
|
|
|
(message "Derived unit: %s" msg))
|
|
|
|
|
(calc-enter-result 0 "ugdf" (list 'var uname
|
|
|
|
|
(intern
|
|
|
|
|
(concat "var-"
|
|
|
|
|
(symbol-name uname)))))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(message "Base unit: %s" msg))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-permanent-units ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let (pos)
|
|
|
|
|
(set-buffer (find-file-noselect (substitute-in-file-name
|
|
|
|
|
calc-settings-file)))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (and (search-forward ";;; Custom units stored by Calc" nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq pos (point))
|
|
|
|
|
(search-forward "\n;;; End of custom units" nil t)))
|
|
|
|
|
(progn
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(delete-region pos (point)))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert "\n\n")
|
|
|
|
|
(forward-char -1))
|
|
|
|
|
(insert ";;; Custom units stored by Calc on " (current-time-string) "\n")
|
|
|
|
|
(if math-additional-units
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(let (expr)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(insert "(setq math-additional-units '(\n")
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(dolist (u math-additional-units)
|
|
|
|
|
(insert " (" (symbol-name (car u)) " "
|
|
|
|
|
(if (setq expr (nth 1 u))
|
|
|
|
|
(if (stringp expr)
|
|
|
|
|
(prin1-to-string expr)
|
|
|
|
|
(prin1-to-string (math-format-flat-expr expr 0)))
|
|
|
|
|
"nil")
|
|
|
|
|
" "
|
|
|
|
|
(prin1-to-string (nth 2 u))
|
|
|
|
|
")\n"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(insert "))\n"))
|
|
|
|
|
(insert ";;; (no custom units defined)\n"))
|
|
|
|
|
(insert ";;; End of custom units\n")
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(save-buffer))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; The variable math-cu-unit-list is local to math-build-units-table,
|
|
|
|
|
;; but is used by math-compare-unit-names, which is called (indirectly)
|
|
|
|
|
;; by math-build-units-table.
|
|
|
|
|
;; math-cu-unit-list is also local to math-convert-units, but is used
|
|
|
|
|
;; by math-convert-units-rec, which is called by math-convert-units.
|
|
|
|
|
(defvar math-cu-unit-list)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-build-units-table ()
|
|
|
|
|
(or math-units-table
|
|
|
|
|
(let* ((combined-units (append math-additional-units
|
|
|
|
|
math-standard-units))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-cu-unit-list (mapcar #'car combined-units))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
tab)
|
|
|
|
|
(message "Building units table...")
|
|
|
|
|
(setq math-units-table-buffer-valid nil)
|
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc)
(calc-do-calc-eval, math-build-parse-table):
* lisp/calc/calc-alg.el (math-polynomial-base):
* lisp/calc/calc-alg.el (math-is-poly-rec):
* lisp/calc/calc-arith.el (calcFunc-scf):
* lisp/calc/calc-arith.el (math-ceiling, math-round):
* lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy):
* lisp/calc/calc-ext.el (calc-init-extensions, calc-reset)
(calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy)
(calc-unary-op-fancy):
* lisp/calc/calc-forms.el (math-make-mod):
* lisp/calc/calc-frac.el (calcFunc-frac):
* lisp/calc/calc-funcs.el (calcFunc-euler):
* lisp/calc/calc-help.el (calc-full-help):
* lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn)
(yacas, maxima, giac, math, maple):
* lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper):
* lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr)
(calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced)
(calcFunc-rreduced, calcFunc-outer):
* lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys):
* lisp/calc/calc-mode.el (calc-save-modes):
* lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec):
* lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list)
(math-mul-list, math-sort-poly-base-list)
(math-partial-fractions):
* lisp/calc/calc-prog.el (calc-user-define-formula):
* lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns)
(math-compile-rewrites, math-parse-schedule)
(math-rwcomp-pattern):
* lisp/calc/calc-store.el (calc-var-name-map, calc-let)
(calc-permanent-variable, calc-insert-variables):
* lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean)
(calcFunc-pfrac):
* lisp/calc/calc-units.el (math-build-units-table)
(math-decompose-units):
* lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col)
(calcFunc-mcol, math-mat-less-col, math-mimic-ident):
* lisp/calc/calc-yank.el (calc-edit):
* lisp/calc/calc.el
(calc-mode-var-list-restore-default-values)
(calc-mode-var-list-restore-saved-values, calc-mode, calc-quit):
* lisp/calc/calccomp.el (math-compose-expr)
(math-compose-matrix, math-vector-to-string): Don't quote lambdas with
'function'.
2020-11-17 02:51:30 +01:00
|
|
|
|
(setq tab (mapcar (lambda (x)
|
|
|
|
|
(list (car x)
|
|
|
|
|
(and (nth 1 x)
|
|
|
|
|
(if (stringp (nth 1 x))
|
|
|
|
|
(let ((exp (math-read-plain-expr
|
|
|
|
|
(nth 1 x))))
|
|
|
|
|
(if (eq (car-safe exp) 'error)
|
|
|
|
|
(error "Format error in definition of %s in units table: %s"
|
|
|
|
|
(car x) (nth 2 exp))
|
|
|
|
|
exp))
|
|
|
|
|
(nth 1 x)))
|
|
|
|
|
(nth 2 x)
|
|
|
|
|
(nth 3 x)
|
|
|
|
|
(and (not (nth 1 x))
|
|
|
|
|
(list (cons (car x) 1)))
|
|
|
|
|
(nth 4 x)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
combined-units))
|
|
|
|
|
(let ((math-units-table tab))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapc #'math-find-base-units tab))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(message "Building units table...done")
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(setq math-units-table tab))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; The variables math-fbu-base and math-fbu-entry are local to
|
|
|
|
|
;; math-find-base-units, but are used by math-find-base-units-rec,
|
|
|
|
|
;; which is called by math-find-base-units.
|
|
|
|
|
(defvar math-fbu-base)
|
|
|
|
|
(defvar math-fbu-entry)
|
|
|
|
|
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(defun math-find-base-units (entry)
|
|
|
|
|
(if (eq (nth 4 entry) 'boom)
|
|
|
|
|
(error "Circular definition involving unit %s" (car entry)))
|
|
|
|
|
(or (nth 4 entry)
|
|
|
|
|
(let (math-fbu-base
|
|
|
|
|
(math-fbu-entry entry))
|
|
|
|
|
(setcar (nthcdr 4 entry) 'boom)
|
|
|
|
|
(math-find-base-units-rec (nth 1 entry) 1)
|
2004-11-25 06:29:11 +00:00
|
|
|
|
'(or math-fbu-base
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(error "Dimensionless definition for unit %s" (car entry)))
|
2004-11-25 06:29:11 +00:00
|
|
|
|
(while (eq (cdr (car math-fbu-base)) 0)
|
|
|
|
|
(setq math-fbu-base (cdr math-fbu-base)))
|
|
|
|
|
(let ((b math-fbu-base))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(while (cdr b)
|
|
|
|
|
(if (eq (cdr (car (cdr b))) 0)
|
|
|
|
|
(setcdr b (cdr (cdr b)))
|
|
|
|
|
(setq b (cdr b)))))
|
2004-11-25 06:29:11 +00:00
|
|
|
|
(setq math-fbu-base (sort math-fbu-base 'math-compare-unit-names))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setcar (nthcdr 4 entry) math-fbu-base)
|
2004-11-25 06:29:11 +00:00
|
|
|
|
math-fbu-base)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-compare-unit-names (a b)
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(memq (car b) (cdr (memq (car a) math-cu-unit-list))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-find-base-units-rec (expr pow)
|
|
|
|
|
(let ((u (math-check-unit-name expr)))
|
|
|
|
|
(cond (u
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(dolist (x (math-find-base-units u))
|
|
|
|
|
(let ((p (* (cdr x) pow))
|
|
|
|
|
(old (assq (car x) math-fbu-base)))
|
|
|
|
|
(if old
|
|
|
|
|
(setcdr old (+ (cdr old) p))
|
|
|
|
|
(setq math-fbu-base
|
|
|
|
|
(cons (cons (car x) p) math-fbu-base))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
((math-scalarp expr))
|
|
|
|
|
((and (eq (car expr) '^)
|
|
|
|
|
(integerp (nth 2 expr)))
|
|
|
|
|
(math-find-base-units-rec (nth 1 expr) (* pow (nth 2 expr))))
|
|
|
|
|
((eq (car expr) '*)
|
|
|
|
|
(math-find-base-units-rec (nth 1 expr) pow)
|
|
|
|
|
(math-find-base-units-rec (nth 2 expr) pow))
|
|
|
|
|
((eq (car expr) '/)
|
|
|
|
|
(math-find-base-units-rec (nth 1 expr) pow)
|
|
|
|
|
(math-find-base-units-rec (nth 2 expr) (- pow)))
|
|
|
|
|
((eq (car expr) 'neg)
|
|
|
|
|
(math-find-base-units-rec (nth 1 expr) pow))
|
|
|
|
|
((eq (car expr) '+)
|
|
|
|
|
(math-find-base-units-rec (nth 1 expr) pow))
|
|
|
|
|
((eq (car expr) 'var)
|
|
|
|
|
(or (eq (nth 1 expr) 'pi)
|
|
|
|
|
(error "Unknown name %s in defining expression for unit %s"
|
2004-11-25 06:29:11 +00:00
|
|
|
|
(nth 1 expr) (car math-fbu-entry))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
((equal expr '(calcFunc-ln 10)))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(t (error "Malformed defining expression for unit %s"
|
|
|
|
|
(car math-fbu-entry))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun math-units-in-expr-p (expr sub-exprs)
|
|
|
|
|
(and (consp expr)
|
|
|
|
|
(if (eq (car expr) 'var)
|
|
|
|
|
(math-check-unit-name expr)
|
2015-01-15 20:02:17 +01:00
|
|
|
|
(if (eq (car expr) 'neg)
|
|
|
|
|
(math-units-in-expr-p (nth 1 expr) sub-exprs)
|
|
|
|
|
(and (or sub-exprs
|
|
|
|
|
(memq (car expr) '(* / ^)))
|
|
|
|
|
(or (math-units-in-expr-p (nth 1 expr) sub-exprs)
|
|
|
|
|
(math-units-in-expr-p (nth 2 expr) sub-exprs)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-only-units-in-expr-p (expr)
|
|
|
|
|
(and (consp expr)
|
|
|
|
|
(if (eq (car expr) 'var)
|
|
|
|
|
(math-check-unit-name expr)
|
|
|
|
|
(if (memq (car expr) '(* /))
|
|
|
|
|
(and (math-only-units-in-expr-p (nth 1 expr))
|
|
|
|
|
(math-only-units-in-expr-p (nth 2 expr)))
|
|
|
|
|
(and (eq (car expr) '^)
|
|
|
|
|
(and (math-only-units-in-expr-p (nth 1 expr))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-realp (nth 2 expr))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-single-units-in-expr-p (expr)
|
|
|
|
|
(cond ((math-scalarp expr) nil)
|
|
|
|
|
((eq (car expr) 'var)
|
|
|
|
|
(math-check-unit-name expr))
|
2015-01-15 20:02:17 +01:00
|
|
|
|
((eq (car expr) 'neg)
|
|
|
|
|
(math-single-units-in-expr-p (nth 1 expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
((eq (car expr) '*)
|
|
|
|
|
(let ((u1 (math-single-units-in-expr-p (nth 1 expr)))
|
|
|
|
|
(u2 (math-single-units-in-expr-p (nth 2 expr))))
|
|
|
|
|
(or (and u1 u2 'wrong)
|
|
|
|
|
u1
|
|
|
|
|
u2)))
|
|
|
|
|
((eq (car expr) '/)
|
|
|
|
|
(if (math-units-in-expr-p (nth 2 expr) nil)
|
|
|
|
|
'wrong
|
|
|
|
|
(math-single-units-in-expr-p (nth 1 expr))))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(t 'wrong)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2012-05-19 09:59:47 -05:00
|
|
|
|
(defun math-consistent-units-p (expr newunits)
|
|
|
|
|
"Non-nil if EXPR and NEWUNITS have consistent units."
|
|
|
|
|
(or
|
|
|
|
|
(and (eq (car-safe newunits) 'var)
|
|
|
|
|
(assq (nth 1 newunits) math-standard-units-systems))
|
2015-01-28 21:29:58 -06:00
|
|
|
|
(math-numberp (math-get-units (math-to-standard-units (list '/ expr newunits) nil)))))
|
2012-05-18 22:00:48 -05:00
|
|
|
|
|
|
|
|
|
(defun math-check-unit-consistency (expr units)
|
|
|
|
|
"Give an error if EXPR and UNITS do not have consistent units."
|
|
|
|
|
(unless (math-consistent-units-p expr units)
|
|
|
|
|
(error "New units (%s) are inconsistent with current units (%s)"
|
|
|
|
|
(math-format-value units)
|
|
|
|
|
(math-format-value (math-get-units expr)))))
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun math-check-unit-name (v)
|
|
|
|
|
(and (eq (car-safe v) 'var)
|
|
|
|
|
(or (assq (nth 1 v) (or math-units-table (math-build-units-table)))
|
|
|
|
|
(let ((name (symbol-name (nth 1 v))))
|
|
|
|
|
(and (> (length name) 1)
|
|
|
|
|
(assq (aref name 0) math-unit-prefixes)
|
|
|
|
|
(or (assq (intern (substring name 1)) math-units-table)
|
|
|
|
|
(and (eq (aref name 0) ?M)
|
|
|
|
|
(> (length name) 3)
|
|
|
|
|
(eq (aref name 1) ?e)
|
|
|
|
|
(eq (aref name 2) ?g)
|
|
|
|
|
(assq (intern (substring name 3))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
math-units-table))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; The variable math-which-standard is local to math-to-standard-units,
|
|
|
|
|
;; but is used by math-to-standard-rec, which is called by
|
|
|
|
|
;; math-to-standard-units.
|
|
|
|
|
(defvar math-which-standard)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(defun math-to-standard-units (expr which-standard)
|
|
|
|
|
(let ((math-which-standard which-standard))
|
|
|
|
|
(math-to-standard-rec expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-to-standard-rec (expr)
|
|
|
|
|
(if (eq (car-safe expr) 'var)
|
|
|
|
|
(let ((u (math-check-unit-name expr))
|
|
|
|
|
(base (nth 1 expr)))
|
|
|
|
|
(if u
|
|
|
|
|
(progn
|
|
|
|
|
(if (nth 1 u)
|
|
|
|
|
(setq expr (math-to-standard-rec (nth 1 u)))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(let ((st (assq (car u) math-which-standard)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if st
|
|
|
|
|
(setq expr (nth 1 st))
|
|
|
|
|
(setq expr (list 'var (car u)
|
|
|
|
|
(intern (concat "var-"
|
|
|
|
|
(symbol-name
|
|
|
|
|
(car u)))))))))
|
|
|
|
|
(or (null u)
|
|
|
|
|
(eq base (car u))
|
|
|
|
|
(setq expr (list '*
|
|
|
|
|
(nth 1 (assq (aref (symbol-name base) 0)
|
|
|
|
|
math-unit-prefixes))
|
|
|
|
|
expr)))
|
|
|
|
|
expr)
|
|
|
|
|
(if (eq base 'pi)
|
|
|
|
|
(math-pi)
|
|
|
|
|
expr)))
|
2011-03-04 00:35:49 -06:00
|
|
|
|
(if (or
|
|
|
|
|
(Math-primp expr)
|
|
|
|
|
(and (eq (car-safe expr) 'calcFunc-subscr)
|
|
|
|
|
(eq (car-safe (nth 1 expr)) 'var)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
expr
|
|
|
|
|
(cons (car expr)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapcar #'math-to-standard-rec (cdr expr))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-apply-units (expr units ulist &optional pure)
|
2005-07-08 04:32:51 +00:00
|
|
|
|
(setq expr (math-simplify-units expr))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if ulist
|
|
|
|
|
(let ((new 0)
|
|
|
|
|
value)
|
|
|
|
|
(or (math-numberp expr)
|
|
|
|
|
(error "Incompatible units"))
|
|
|
|
|
(while (cdr ulist)
|
|
|
|
|
(setq value (math-div expr (nth 1 (car ulist)))
|
|
|
|
|
value (math-floor (let ((calc-internal-prec
|
|
|
|
|
(1- calc-internal-prec)))
|
|
|
|
|
(math-normalize value)))
|
|
|
|
|
new (math-add new (math-mul value (car (car ulist))))
|
|
|
|
|
expr (math-sub expr (math-mul value (nth 1 (car ulist))))
|
|
|
|
|
ulist (cdr ulist)))
|
|
|
|
|
(math-add new (math-mul (math-div expr (nth 1 (car ulist)))
|
|
|
|
|
(car (car ulist)))))
|
2005-07-08 04:32:51 +00:00
|
|
|
|
(if pure
|
|
|
|
|
expr
|
|
|
|
|
(math-simplify-units (list '* expr units)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(defvar math-decompose-units-cache nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun math-decompose-units (units)
|
|
|
|
|
(let ((u (math-check-unit-name units)))
|
|
|
|
|
(and u (eq (car-safe (nth 1 u)) '+)
|
|
|
|
|
(setq units (nth 1 u))))
|
|
|
|
|
(setq units (calcFunc-expand units))
|
|
|
|
|
(and (eq (car-safe units) '+)
|
|
|
|
|
(let ((entry (list units calc-internal-prec calc-prefer-frac)))
|
|
|
|
|
(or (equal entry (car math-decompose-units-cache))
|
|
|
|
|
(let ((ulist nil)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(utemp units))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(while (eq (car-safe utemp) '+)
|
|
|
|
|
(setq ulist (cons (math-decompose-unit-part (nth 2 utemp))
|
|
|
|
|
ulist)
|
|
|
|
|
utemp (nth 1 utemp)))
|
|
|
|
|
(setq ulist (cons (math-decompose-unit-part utemp) ulist)
|
|
|
|
|
utemp ulist)
|
|
|
|
|
(while (setq utemp (cdr utemp))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(unless (equal (nth 2 (car utemp)) (nth 2 (car ulist)))
|
|
|
|
|
(error "Inconsistent units in sum")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq math-decompose-units-cache
|
|
|
|
|
(cons entry
|
|
|
|
|
(sort ulist
|
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc)
(calc-do-calc-eval, math-build-parse-table):
* lisp/calc/calc-alg.el (math-polynomial-base):
* lisp/calc/calc-alg.el (math-is-poly-rec):
* lisp/calc/calc-arith.el (calcFunc-scf):
* lisp/calc/calc-arith.el (math-ceiling, math-round):
* lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy):
* lisp/calc/calc-ext.el (calc-init-extensions, calc-reset)
(calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy)
(calc-unary-op-fancy):
* lisp/calc/calc-forms.el (math-make-mod):
* lisp/calc/calc-frac.el (calcFunc-frac):
* lisp/calc/calc-funcs.el (calcFunc-euler):
* lisp/calc/calc-help.el (calc-full-help):
* lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn)
(yacas, maxima, giac, math, maple):
* lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper):
* lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr)
(calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced)
(calcFunc-rreduced, calcFunc-outer):
* lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys):
* lisp/calc/calc-mode.el (calc-save-modes):
* lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec):
* lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list)
(math-mul-list, math-sort-poly-base-list)
(math-partial-fractions):
* lisp/calc/calc-prog.el (calc-user-define-formula):
* lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns)
(math-compile-rewrites, math-parse-schedule)
(math-rwcomp-pattern):
* lisp/calc/calc-store.el (calc-var-name-map, calc-let)
(calc-permanent-variable, calc-insert-variables):
* lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean)
(calcFunc-pfrac):
* lisp/calc/calc-units.el (math-build-units-table)
(math-decompose-units):
* lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col)
(calcFunc-mcol, math-mat-less-col, math-mimic-ident):
* lisp/calc/calc-yank.el (calc-edit):
* lisp/calc/calc.el
(calc-mode-var-list-restore-default-values)
(calc-mode-var-list-restore-saved-values, calc-mode, calc-quit):
* lisp/calc/calccomp.el (math-compose-expr)
(math-compose-matrix, math-vector-to-string): Don't quote lambdas with
'function'.
2020-11-17 02:51:30 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(not (Math-lessp (nth 1 x)
|
|
|
|
|
(nth 1 y)))))))))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(cdr math-decompose-units-cache))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-decompose-unit-part (unit)
|
|
|
|
|
(cons unit
|
|
|
|
|
(math-is-multiple (math-simplify-units (math-to-standard-units
|
|
|
|
|
unit nil))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
t)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; The variable math-fcu-u is local to math-find-compatible-unit,
|
|
|
|
|
;; but is used by math-find-compatible-rec which is called by
|
|
|
|
|
;; math-find-compatible-unit.
|
|
|
|
|
(defvar math-fcu-u)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun math-find-compatible-unit (expr unit)
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(let ((math-fcu-u (math-check-unit-name unit)))
|
|
|
|
|
(if math-fcu-u
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-find-compatible-unit-rec expr 1))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-find-compatible-unit-rec (expr pow)
|
|
|
|
|
(cond ((eq (car-safe expr) '*)
|
|
|
|
|
(or (math-find-compatible-unit-rec (nth 1 expr) pow)
|
|
|
|
|
(math-find-compatible-unit-rec (nth 2 expr) pow)))
|
|
|
|
|
((eq (car-safe expr) '/)
|
|
|
|
|
(or (math-find-compatible-unit-rec (nth 1 expr) pow)
|
|
|
|
|
(math-find-compatible-unit-rec (nth 2 expr) (- pow))))
|
2015-01-15 20:02:17 +01:00
|
|
|
|
((eq (car-safe expr) 'neg)
|
|
|
|
|
(math-find-compatible-unit-rec (nth 1 expr) pow))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
((and (eq (car-safe expr) '^)
|
|
|
|
|
(integerp (nth 2 expr)))
|
|
|
|
|
(math-find-compatible-unit-rec (nth 1 expr) (* pow (nth 2 expr))))
|
|
|
|
|
(t
|
|
|
|
|
(let ((u2 (math-check-unit-name expr)))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(if (equal (nth 4 math-fcu-u) (nth 4 u2))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(cons expr pow))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2007-09-26 00:08:16 +00:00
|
|
|
|
;; The variables math-cu-new-units and math-cu-pure are local to
|
|
|
|
|
;; math-convert-units, but are used by math-convert-units-rec,
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
;; which is called by math-convert-units.
|
|
|
|
|
(defvar math-cu-new-units)
|
|
|
|
|
(defvar math-cu-pure)
|
|
|
|
|
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(defun math-convert-units (expr new-units &optional pure)
|
|
|
|
|
(if (eq (car-safe new-units) 'var)
|
|
|
|
|
(let ((unew (assq (nth 1 new-units)
|
2005-11-09 06:02:54 +00:00
|
|
|
|
(math-build-units-table))))
|
|
|
|
|
(if (eq (car-safe (nth 1 unew)) '+)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setq new-units (nth 1 unew)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-with-extra-prec 2
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(let ((compat (and (not pure)
|
|
|
|
|
(math-find-compatible-unit expr new-units)))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(math-cu-unit-list nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-combining-units nil))
|
|
|
|
|
(if compat
|
|
|
|
|
(math-simplify-units
|
|
|
|
|
(math-mul (math-mul (math-simplify-units
|
|
|
|
|
(math-div expr (math-pow (car compat)
|
|
|
|
|
(cdr compat))))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-pow new-units (cdr compat)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-simplify-units
|
|
|
|
|
(math-to-standard-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-pow (math-div (car compat) new-units)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(cdr compat))
|
|
|
|
|
nil))))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(when (setq math-cu-unit-list (math-decompose-units new-units))
|
|
|
|
|
(setq new-units (nth 2 (car math-cu-unit-list))))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (eq (car-safe expr) '+)
|
|
|
|
|
(setq expr (math-simplify-units expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (math-units-in-expr-p expr t)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(let ((math-cu-new-units new-units)
|
|
|
|
|
(math-cu-pure pure))
|
|
|
|
|
(math-convert-units-rec expr))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-apply-units (math-to-standard-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(list '/ expr new-units) nil)
|
|
|
|
|
new-units math-cu-unit-list pure))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-convert-units-rec (expr)
|
|
|
|
|
(if (math-units-in-expr-p expr nil)
|
2007-09-26 00:08:16 +00:00
|
|
|
|
(math-apply-units (math-to-standard-units
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(list '/ expr math-cu-new-units) nil)
|
|
|
|
|
math-cu-new-units math-cu-unit-list math-cu-pure)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (Math-primp expr)
|
|
|
|
|
expr
|
|
|
|
|
(cons (car expr)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapcar #'math-convert-units-rec (cdr expr))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-convert-temperature (expr old new &optional pure)
|
|
|
|
|
(let* ((units (math-single-units-in-expr-p expr))
|
|
|
|
|
(uold (if old
|
|
|
|
|
(if (or (null units)
|
|
|
|
|
(equal (nth 1 old) (car units)))
|
|
|
|
|
(math-check-unit-name old)
|
|
|
|
|
(error "Inconsistent temperature units"))
|
|
|
|
|
units))
|
|
|
|
|
(unew (math-check-unit-name new)))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(unless (and (consp unew) (nth 3 unew))
|
|
|
|
|
(error "Not a valid temperature unit"))
|
|
|
|
|
(unless (and (consp uold) (nth 3 uold))
|
|
|
|
|
(error "Not a pure temperature expression"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((v (car uold)))
|
|
|
|
|
(setq expr (list '/ expr (list 'var v
|
|
|
|
|
(intern (concat "var-"
|
|
|
|
|
(symbol-name v)))))))
|
|
|
|
|
(or (eq (nth 3 uold) (nth 3 unew))
|
|
|
|
|
(cond ((eq (nth 3 uold) 'K)
|
2007-08-07 21:06:29 +00:00
|
|
|
|
(setq expr (list '- expr '(/ 27315 100)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (eq (nth 3 unew) 'F)
|
2007-08-07 21:06:29 +00:00
|
|
|
|
(setq expr (list '+ (list '* expr '(/ 9 5)) 32))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
((eq (nth 3 uold) 'C)
|
|
|
|
|
(if (eq (nth 3 unew) 'F)
|
2007-08-07 21:06:29 +00:00
|
|
|
|
(setq expr (list '+ (list '* expr '(/ 9 5)) 32))
|
|
|
|
|
(setq expr (list '+ expr '(/ 27315 100)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(t
|
2007-08-07 21:06:29 +00:00
|
|
|
|
(setq expr (list '* (list '- expr 32) '(/ 5 9)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (eq (nth 3 unew) 'K)
|
2007-08-07 21:06:29 +00:00
|
|
|
|
(setq expr (list '+ expr '(/ 27315 100)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if pure
|
|
|
|
|
expr
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(list '* expr new))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun math-simplify-units (a)
|
|
|
|
|
(let ((math-simplifying-units t)
|
|
|
|
|
(calc-matrix-mode 'scalar))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(math-simplify a)))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(defalias 'calcFunc-usimplify 'math-simplify-units)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2018-11-20 10:37:46 -05:00
|
|
|
|
;; The function created by math-defsimplify uses the variable `expr'.
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-defsimplify (+ -)
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
|
|
|
|
(let* ((units (math-extract-units (nth 1 expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(ratio (math-simplify (math-to-standard-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(list '/ (nth 2 expr) units) nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (math-units-in-expr-p ratio nil)
|
|
|
|
|
(progn
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(calc-record-why "*Inconsistent units" expr)
|
|
|
|
|
expr)
|
|
|
|
|
(list '* (math-add (math-remove-units (nth 1 expr))
|
|
|
|
|
(if (eq (car expr) '-)
|
2004-11-17 19:23:41 +00:00
|
|
|
|
(math-neg ratio) ratio))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
units)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify *
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-simplify-units-prod expr))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(defun math-simplify-units-prod (expr)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(and math-simplifying-units
|
|
|
|
|
calc-autorange-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(Math-realp (nth 1 expr))
|
|
|
|
|
(let* ((num (math-float (nth 1 expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(xpon (calcFunc-xpon num))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(unitp (cdr (cdr expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(unit (car unitp))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(pow (if (eq (car expr) '*) 1 -1))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
u)
|
|
|
|
|
(and (eq (car-safe unit) '*)
|
|
|
|
|
(setq unitp (cdr unit)
|
|
|
|
|
unit (car unitp)))
|
|
|
|
|
(and (eq (car-safe unit) '^)
|
|
|
|
|
(integerp (nth 2 unit))
|
|
|
|
|
(setq pow (* pow (nth 2 unit))
|
|
|
|
|
unitp (cdr unit)
|
|
|
|
|
unit (car unitp)))
|
|
|
|
|
(and (setq u (math-check-unit-name unit))
|
|
|
|
|
(integerp xpon)
|
|
|
|
|
(or (< xpon 0)
|
|
|
|
|
(>= xpon (if (eq (car u) 'm) 1 3)))
|
|
|
|
|
(let* ((uxpon 0)
|
|
|
|
|
(pref (if (< pow 0)
|
|
|
|
|
(reverse math-unit-prefixes)
|
|
|
|
|
math-unit-prefixes))
|
|
|
|
|
(p pref)
|
|
|
|
|
pxpon pname)
|
|
|
|
|
(or (eq (car u) (nth 1 unit))
|
|
|
|
|
(setq uxpon (* pow
|
|
|
|
|
(nth 2 (nth 1 (assq
|
|
|
|
|
(aref (symbol-name
|
|
|
|
|
(nth 1 unit)) 0)
|
|
|
|
|
math-unit-prefixes))))))
|
|
|
|
|
(setq xpon (+ xpon uxpon))
|
|
|
|
|
(while (and p
|
|
|
|
|
(or (memq (car (car p)) '(?d ?D ?h ?H))
|
|
|
|
|
(and (eq (car (car p)) ?c)
|
|
|
|
|
(not (eq (car u) 'm)))
|
|
|
|
|
(< xpon (setq pxpon (* (nth 2 (nth 1 (car p)))
|
|
|
|
|
pow)))
|
|
|
|
|
(progn
|
|
|
|
|
(setq pname (math-build-var-name
|
|
|
|
|
(if (eq (car (car p)) 0)
|
|
|
|
|
(car u)
|
|
|
|
|
(concat (char-to-string
|
|
|
|
|
(car (car p)))
|
|
|
|
|
(symbol-name
|
|
|
|
|
(car u))))))
|
|
|
|
|
(and (/= (car (car p)) 0)
|
|
|
|
|
(assq (nth 1 pname)
|
|
|
|
|
math-units-table)))))
|
|
|
|
|
(setq p (cdr p)))
|
|
|
|
|
(and p
|
|
|
|
|
(/= pxpon uxpon)
|
|
|
|
|
(or (not (eq p pref))
|
|
|
|
|
(< xpon (+ pxpon (* (math-abs pow) 3))))
|
|
|
|
|
(progn
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setcar (cdr expr)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((calc-prefer-frac nil))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(calcFunc-scf (nth 1 expr)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(- uxpon pxpon))))
|
|
|
|
|
(setcar unitp pname)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
expr)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(defvar math-try-cancel-units)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-defsimplify /
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(let ((np (cdr expr))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(math-try-cancel-units 0)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
n)
|
|
|
|
|
(setq n (if (eq (car-safe (nth 2 expr)) '*)
|
|
|
|
|
(cdr (nth 2 expr))
|
|
|
|
|
(nthcdr 2 expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (math-realp (car n))
|
|
|
|
|
(progn
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setcar (cdr expr) (math-mul (nth 1 expr)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((calc-prefer-frac nil))
|
|
|
|
|
(math-div 1 (car n)))))
|
|
|
|
|
(setcar n 1)))
|
|
|
|
|
(while (eq (car-safe (setq n (car np))) '*)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-simplify-units-divisor (cdr n) (cdr (cdr expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq np (cdr (cdr n))))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-simplify-units-divisor np (cdr (cdr expr)))
|
(calc-convert-units): Make units a local variable.
(calc-num-units, calc-den-units): New variables.
(calc-explain-units, calc-explain-units-rec): Replace variables
num-units and den-units by declared variables.
(math-cu-unit-list): New variable.
(math-build-units-table, math-compare-unit-names)
(math-convert-units, math-convert-units-rec): Replace variable
unit-list by declared variable.
(math-fbu-base, math-fbu-entry): New variables.
(math-find-base-units, math-find-base-units-rec): Replace variables
base and entry by declared variables.
(math-which-standard): New variable.
(math-to-standard-units, math-to-standard-rec): Replace variable
which-standard by declared variable.
(math-fcu-u): New variable.
(math-find-compatible-unit, math-find-compatible-unit-rec):
Replace variable u by declared variable.
(math-cu-new-units, math-cu-pure): New variables.
(math-convert-units, math-convert-units-rec): Replace variables
new-units and pure by declared variables.
(math-try-cancel-units): New variable.
(math-simplify-units-quotient): Replace variable try-cancel-units by
declared variable.
2004-11-25 05:53:35 +00:00
|
|
|
|
(if (eq math-try-cancel-units 0)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let* ((math-simplifying-units nil)
|
2007-09-26 00:08:16 +00:00
|
|
|
|
(base (math-simplify
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units expr nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (Math-numberp base)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(setq expr base))))
|
|
|
|
|
(if (eq (car-safe expr) '/)
|
|
|
|
|
(math-simplify-units-prod expr))
|
|
|
|
|
expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-simplify-units-divisor (np dp)
|
|
|
|
|
(let ((n (car np))
|
2018-11-20 10:37:46 -05:00
|
|
|
|
d temp)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(while (eq (car-safe (setq d (car dp))) '*)
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (setq temp (math-simplify-units-quotient n (nth 1 d)))
|
|
|
|
|
(setcar np (setq n temp))
|
|
|
|
|
(setcar (cdr d) 1))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq dp (cdr (cdr d))))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (setq temp (math-simplify-units-quotient n d))
|
|
|
|
|
(setcar np (setq n temp))
|
|
|
|
|
(setcar dp 1))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;; Simplify, e.g., "in / cm" to "2.54" in a units expression.
|
|
|
|
|
(defun math-simplify-units-quotient (n d)
|
|
|
|
|
(let ((pow1 1)
|
|
|
|
|
(pow2 1))
|
2001-11-19 07:42:20 +00:00
|
|
|
|
(when (and (eq (car-safe n) '^)
|
|
|
|
|
(integerp (nth 2 n)))
|
|
|
|
|
(setq pow1 (nth 2 n) n (nth 1 n)))
|
|
|
|
|
(when (and (eq (car-safe d) '^)
|
|
|
|
|
(integerp (nth 2 d)))
|
|
|
|
|
(setq pow2 (nth 2 d) d (nth 1 d)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((un (math-check-unit-name n))
|
|
|
|
|
(ud (math-check-unit-name d)))
|
|
|
|
|
(and un ud
|
|
|
|
|
(if (and (equal (nth 4 un) (nth 4 ud))
|
|
|
|
|
(eq pow1 pow2))
|
2007-10-24 01:51:40 +00:00
|
|
|
|
(if (eq pow1 1)
|
|
|
|
|
(math-to-standard-units (list '/ n d) nil)
|
|
|
|
|
(list '^ (math-to-standard-units (list '/ n d) nil) pow1))
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(setq un (nth 4 un)
|
|
|
|
|
ud (nth 4 ud))
|
|
|
|
|
(dolist (x un)
|
|
|
|
|
(dolist (y ud)
|
|
|
|
|
(when (eq (car x) (car y))
|
|
|
|
|
(setq math-try-cancel-units
|
|
|
|
|
(+ math-try-cancel-units
|
|
|
|
|
(- (* (cdr x) pow1)
|
|
|
|
|
(* (cdr (car ud)) pow2))))))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify ^
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-realp (nth 2 expr))
|
|
|
|
|
(if (memq (car-safe (nth 1 expr)) '(* /))
|
|
|
|
|
(list (car (nth 1 expr))
|
|
|
|
|
(list '^ (nth 1 (nth 1 expr))
|
|
|
|
|
(nth 2 expr))
|
|
|
|
|
(list '^ (nth 2 (nth 1 expr))
|
|
|
|
|
(nth 2 expr)))
|
|
|
|
|
(math-simplify-units-pow (nth 1 expr)
|
|
|
|
|
(nth 2 expr)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-sqrt
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(if (memq (car-safe (nth 1 expr)) '(* /))
|
|
|
|
|
(list (car (nth 1 expr))
|
|
|
|
|
(list 'calcFunc-sqrt (nth 1 (nth 1 expr)))
|
|
|
|
|
(list 'calcFunc-sqrt (nth 2 (nth 1 expr))))
|
|
|
|
|
(math-simplify-units-pow (nth 1 expr) '(frac 1 2)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify (calcFunc-floor
|
|
|
|
|
calcFunc-ceil
|
|
|
|
|
calcFunc-round
|
|
|
|
|
calcFunc-rounde
|
|
|
|
|
calcFunc-roundu
|
|
|
|
|
calcFunc-trunc
|
|
|
|
|
calcFunc-float
|
|
|
|
|
calcFunc-frac
|
|
|
|
|
calcFunc-abs
|
|
|
|
|
calcFunc-clean)
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(= (length expr) 2)
|
|
|
|
|
(if (math-only-units-in-expr-p (nth 1 expr))
|
|
|
|
|
(nth 1 expr)
|
|
|
|
|
(if (and (memq (car-safe (nth 1 expr)) '(* /))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(or (math-only-units-in-expr-p
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(nth 1 (nth 1 expr)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-only-units-in-expr-p
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(nth 2 (nth 1 expr)))))
|
|
|
|
|
(list (car (nth 1 expr))
|
|
|
|
|
(cons (car expr)
|
|
|
|
|
(cons (nth 1 (nth 1 expr))
|
|
|
|
|
(cdr (cdr expr))))
|
|
|
|
|
(cons (car expr)
|
|
|
|
|
(cons (nth 2 (nth 1 expr))
|
|
|
|
|
(cdr (cdr expr)))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-simplify-units-pow (a pow)
|
|
|
|
|
(if (and (eq (car-safe a) '^)
|
|
|
|
|
(math-check-unit-name (nth 1 a))
|
|
|
|
|
(math-realp (nth 2 a)))
|
|
|
|
|
(list '^ (nth 1 a) (math-mul pow (nth 2 a)))
|
|
|
|
|
(let* ((u (math-check-unit-name a))
|
|
|
|
|
(pf (math-to-simple-fraction pow))
|
|
|
|
|
(d (and (eq (car-safe pf) 'frac) (nth 2 pf))))
|
|
|
|
|
(and u d
|
|
|
|
|
(math-units-are-multiple u d)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(list '^ (math-to-standard-units a nil) pow)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun math-units-are-multiple (u n)
|
|
|
|
|
(setq u (nth 4 u))
|
|
|
|
|
(while (and u (= (% (cdr (car u)) n) 0))
|
|
|
|
|
(setq u (cdr u)))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(null u))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-sin
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(list 'calcFunc-sin (nth 1 rad))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-cos
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(list 'calcFunc-cos (nth 1 rad))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-tan
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(list 'calcFunc-tan (nth 1 rad))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(math-defsimplify calcFunc-sec
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
|
|
|
|
(list 'calcFunc-sec (nth 1 rad))))))
|
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-csc
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
|
|
|
|
(list 'calcFunc-csc (nth 1 rad))))))
|
|
|
|
|
|
|
|
|
|
(math-defsimplify calcFunc-cot
|
|
|
|
|
(and math-simplifying-units
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-units-in-expr-p (nth 1 expr) nil)
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(let ((rad (math-simplify-units
|
|
|
|
|
(math-evaluate-expr
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(math-to-standard-units (nth 1 expr) nil))))
|
2005-02-15 19:27:17 +00:00
|
|
|
|
(calc-angle-mode 'rad))
|
|
|
|
|
(and (eq (car-safe rad) '*)
|
|
|
|
|
(math-realp (nth 1 rad))
|
|
|
|
|
(eq (car-safe (nth 2 rad)) 'var)
|
|
|
|
|
(eq (nth 1 (nth 2 rad)) 'rad)
|
|
|
|
|
(list 'calcFunc-cot (nth 1 rad))))))
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-remove-units (expr)
|
|
|
|
|
(if (math-check-unit-name expr)
|
|
|
|
|
1
|
|
|
|
|
(if (Math-primp expr)
|
|
|
|
|
expr
|
|
|
|
|
(cons (car expr)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapcar #'math-remove-units (cdr expr))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-extract-units (expr)
|
2012-10-19 23:14:32 -05:00
|
|
|
|
(cond
|
|
|
|
|
((memq (car-safe expr) '(* /))
|
|
|
|
|
(cons (car expr)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapcar #'math-extract-units (cdr expr))))
|
2015-01-15 20:02:17 +01:00
|
|
|
|
((eq (car-safe expr) 'neg)
|
|
|
|
|
(math-extract-units (nth 1 expr)))
|
2013-05-16 21:57:09 -05:00
|
|
|
|
((eq (car-safe expr) '^)
|
|
|
|
|
(list '^ (math-extract-units (nth 1 expr)) (nth 2 expr)))
|
2012-10-19 23:14:32 -05:00
|
|
|
|
((math-check-unit-name expr) expr)
|
|
|
|
|
(t 1)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun math-build-units-table-buffer (enter-buffer)
|
|
|
|
|
(if (not (and math-units-table math-units-table-buffer-valid
|
|
|
|
|
(get-buffer "*Units Table*")))
|
|
|
|
|
(let ((buf (get-buffer-create "*Units Table*"))
|
|
|
|
|
(uptr (math-build-units-table))
|
|
|
|
|
(calc-language (if (eq calc-language 'big) nil calc-language))
|
|
|
|
|
(calc-float-format '(float 0))
|
|
|
|
|
(calc-group-digits nil)
|
|
|
|
|
(calc-number-radix 10)
|
2009-11-20 00:59:50 +00:00
|
|
|
|
(calc-twos-complement-mode nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-point-char ".")
|
|
|
|
|
(std nil)
|
|
|
|
|
u name shadowed)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(message "Formatting units table...")
|
|
|
|
|
(set-buffer buf)
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert "Calculator Units Table:\n\n")
|
2008-10-06 12:40:39 +00:00
|
|
|
|
(insert "(All definitions are exact unless marked with an asterisk (*).)\n\n")
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(insert "Unit Type Definition Description\n\n")
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(dolist (u uptr)
|
|
|
|
|
(setq name (nth 2 u))
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(when (eq (car u) 'm)
|
|
|
|
|
(setq std t))
|
|
|
|
|
(setq shadowed (and std (assq (car u) math-additional-units)))
|
|
|
|
|
(when (and name
|
|
|
|
|
(> (length name) 1)
|
|
|
|
|
(eq (aref name 0) ?\*))
|
|
|
|
|
(unless (eq uptr math-units-table)
|
|
|
|
|
(insert "\n"))
|
|
|
|
|
(setq name (substring name 1)))
|
|
|
|
|
(insert " ")
|
|
|
|
|
(and shadowed (insert "("))
|
|
|
|
|
(insert (symbol-name (car u)))
|
|
|
|
|
(and shadowed (insert ")"))
|
|
|
|
|
(if (nth 3 u)
|
|
|
|
|
(progn
|
|
|
|
|
(indent-to 10)
|
|
|
|
|
(insert (symbol-name (nth 3 u))))
|
|
|
|
|
(or std
|
|
|
|
|
(progn
|
|
|
|
|
(indent-to 10)
|
|
|
|
|
(insert "U"))))
|
|
|
|
|
(indent-to 14)
|
|
|
|
|
(and shadowed (insert "("))
|
2008-09-30 02:40:31 +00:00
|
|
|
|
(if (nth 5 u)
|
|
|
|
|
(insert (nth 5 u))
|
|
|
|
|
(if (nth 1 u)
|
|
|
|
|
(insert (math-format-value (nth 1 u) 80))
|
|
|
|
|
(insert (symbol-name (car u)))))
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(and shadowed (insert ")"))
|
|
|
|
|
(indent-to 41)
|
|
|
|
|
(insert " ")
|
|
|
|
|
(when name
|
|
|
|
|
(insert name))
|
|
|
|
|
(if shadowed
|
|
|
|
|
(insert " (redefined above)")
|
|
|
|
|
(unless (nth 1 u)
|
|
|
|
|
(insert " (base unit)")))
|
2017-06-27 23:59:24 -04:00
|
|
|
|
(insert "\n"))
|
2005-05-20 22:39:33 +00:00
|
|
|
|
(insert "\n\nUnit Prefix Table:\n\n")
|
|
|
|
|
(setq uptr math-unit-prefixes)
|
|
|
|
|
(while uptr
|
|
|
|
|
(setq u (car uptr))
|
|
|
|
|
(insert " " (char-to-string (car u)))
|
|
|
|
|
(if (equal (nth 1 u) (nth 1 (nth 1 uptr)))
|
|
|
|
|
(insert " " (char-to-string (car (car (setq uptr (cdr uptr)))))
|
|
|
|
|
" ")
|
|
|
|
|
(insert " "))
|
|
|
|
|
(insert "10^" (int-to-string (nth 2 (nth 1 u))))
|
|
|
|
|
(indent-to 15)
|
|
|
|
|
(insert " " (nth 2 u) "\n")
|
|
|
|
|
(while (eq (car (car (setq uptr (cdr uptr)))) 0)))
|
2010-11-18 19:14:36 -06:00
|
|
|
|
(insert "\n\n")
|
2015-08-21 06:31:54 -07:00
|
|
|
|
(insert
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(format-message
|
2015-08-21 06:31:54 -07:00
|
|
|
|
(concat
|
|
|
|
|
"(**) When in TeX or LaTeX display mode, the TeX specific unit\n"
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"names will not use the `tex' prefix; the unit name for a\n"
|
|
|
|
|
"TeX point will be `pt' instead of `texpt', for example.\n"
|
2015-08-21 06:31:54 -07:00
|
|
|
|
"To avoid conflicts, the unit names for pint and parsec will\n"
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"be `pint' and `parsec' instead of `pt' and `pc'."))))
|
2016-02-16 11:48:46 -05:00
|
|
|
|
(special-mode)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(message "Formatting units table...done"))
|
|
|
|
|
(setq math-units-table-buffer-valid t)
|
|
|
|
|
(let ((oldbuf (current-buffer)))
|
|
|
|
|
(set-buffer buf)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(set-buffer oldbuf))
|
|
|
|
|
(if enter-buffer
|
|
|
|
|
(pop-to-buffer buf)
|
|
|
|
|
(display-buffer buf)))
|
|
|
|
|
(if enter-buffer
|
|
|
|
|
(pop-to-buffer (get-buffer "*Units Table*"))
|
2001-11-14 09:08:03 +00:00
|
|
|
|
(display-buffer (get-buffer "*Units Table*")))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2011-01-23 23:08:04 -06:00
|
|
|
|
;;; Logarithmic units functions
|
|
|
|
|
|
|
|
|
|
(defvar math-logunits '((var dB var-dB)
|
|
|
|
|
(var Np var-Np)))
|
|
|
|
|
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(defun math-conditional-apply (fn &rest args)
|
|
|
|
|
"Evaluate f(args) unless in symbolic mode.
|
|
|
|
|
In symbolic mode, return the list (fn args)."
|
|
|
|
|
(if calc-symbolic-mode
|
|
|
|
|
(cons fn args)
|
|
|
|
|
(apply fn args)))
|
|
|
|
|
|
|
|
|
|
(defun math-conditional-pow (a b)
|
|
|
|
|
"Evaluate a^b unless in symbolic mode.
|
|
|
|
|
In symbolic mode, return the list (^ a b)."
|
|
|
|
|
(if calc-symbolic-mode
|
|
|
|
|
(list '^ a b)
|
|
|
|
|
(math-pow a b)))
|
|
|
|
|
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(defun math-extract-logunits (expr)
|
|
|
|
|
(if (memq (car-safe expr) '(* /))
|
|
|
|
|
(cons (car expr)
|
2018-11-20 10:37:46 -05:00
|
|
|
|
(mapcar #'math-extract-logunits (cdr expr)))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(if (memq (car-safe expr) '(^))
|
|
|
|
|
(list '^ (math-extract-logunits (nth 1 expr)) (nth 2 expr))
|
|
|
|
|
(if (member expr math-logunits) expr 1))))
|
|
|
|
|
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(defun math-logunits-add (a b neg power)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(let ((aunit (math-simplify (math-extract-logunits a))))
|
|
|
|
|
(if (not (eq (car-safe aunit) 'var))
|
|
|
|
|
(calc-record-why "*Improper logarithmic unit" aunit)
|
|
|
|
|
(let* ((units (math-extract-units a))
|
|
|
|
|
(acoeff (math-simplify (math-remove-units a)))
|
|
|
|
|
(bcoeff (math-simplify (math-to-standard-units
|
|
|
|
|
(list '/ b units) nil))))
|
|
|
|
|
(if (math-units-in-expr-p bcoeff nil)
|
|
|
|
|
(calc-record-why "*Inconsistent units" nil)
|
|
|
|
|
(if (and neg
|
|
|
|
|
(or (math-lessp acoeff bcoeff)
|
|
|
|
|
(math-equal acoeff bcoeff)))
|
|
|
|
|
(calc-record-why "*Improper coefficients" nil)
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-mul
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(if (equal aunit '(var dB var-dB))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(let ((coef (if power 10 20)))
|
|
|
|
|
(math-mul coef
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-log10
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if neg
|
|
|
|
|
(math-sub
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-pow 10 (math-div acoeff coef))
|
|
|
|
|
(math-conditional-pow 10 (math-div bcoeff coef)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-add
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-pow 10 (math-div acoeff coef))
|
|
|
|
|
(math-conditional-pow 10 (math-div bcoeff coef)))))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(let ((coef (if power 2 1)))
|
|
|
|
|
(math-div
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-ln
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if neg
|
|
|
|
|
(math-sub
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-exp (math-mul coef acoeff))
|
|
|
|
|
(math-conditional-apply 'calcFunc-exp (math-mul coef bcoeff)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-add
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-exp (math-mul coef acoeff))
|
|
|
|
|
(math-conditional-apply 'calcFunc-exp (math-mul coef bcoeff)))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
coef)))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
units)))))))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lufadd (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-add a b nil nil))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lupadd (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-add a b nil t))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lufsub (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-add a b t nil))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lupsub (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-add a b t t))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-lu-plus (arg)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-inverse)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu-" 'calcFunc-lufsub arg)
|
|
|
|
|
(calc-binary-op "lu-" 'calcFunc-lupsub arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu+" 'calcFunc-lufadd arg)
|
|
|
|
|
(calc-binary-op "lu+" 'calcFunc-lupadd arg)))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-lu-minus (arg)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-inverse)
|
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu+" 'calcFunc-lufadd arg)
|
|
|
|
|
(calc-binary-op "lu+" 'calcFunc-lupadd arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu-" 'calcFunc-lufsub arg)
|
|
|
|
|
(calc-binary-op "lu-" 'calcFunc-lupsub arg)))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(defun math-logunits-mul (a b power)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(let (logunit coef units number)
|
|
|
|
|
(cond
|
|
|
|
|
((and
|
|
|
|
|
(setq logunit (math-simplify (math-extract-logunits a)))
|
|
|
|
|
(eq (car-safe logunit) 'var)
|
|
|
|
|
(eq (math-simplify (math-extract-units b)) 1))
|
|
|
|
|
(setq coef (math-simplify (math-remove-units a))
|
|
|
|
|
units (math-extract-units a)
|
|
|
|
|
number b))
|
|
|
|
|
((and
|
|
|
|
|
(setq logunit (math-simplify (math-extract-logunits b)))
|
|
|
|
|
(eq (car-safe logunit) 'var)
|
|
|
|
|
(eq (math-simplify (math-extract-units a)) 1))
|
|
|
|
|
(setq coef (math-simplify (math-remove-units b))
|
|
|
|
|
units (math-extract-units b)
|
|
|
|
|
number a))
|
|
|
|
|
(t (setq logunit nil)))
|
|
|
|
|
(if logunit
|
|
|
|
|
(cond
|
|
|
|
|
((equal logunit '(var dB var-dB))
|
|
|
|
|
(math-simplify
|
|
|
|
|
(math-mul
|
|
|
|
|
(math-add
|
2011-11-14 23:55:13 -08:00
|
|
|
|
coef
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-mul (if power 10 20)
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-log10 number)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
units)))
|
|
|
|
|
(t
|
|
|
|
|
(math-simplify
|
|
|
|
|
(math-mul
|
|
|
|
|
(math-add
|
2011-11-14 23:55:13 -08:00
|
|
|
|
coef
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-div (math-conditional-apply 'calcFunc-ln number) (if power 2 1)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
units))))
|
|
|
|
|
(calc-record-why "*Improper units" nil))))
|
|
|
|
|
|
|
|
|
|
(defun math-logunits-divide (a b power)
|
|
|
|
|
(let ((logunit (math-simplify (math-extract-logunits a))))
|
|
|
|
|
(if (not (eq (car-safe logunit) 'var))
|
|
|
|
|
(calc-record-why "*Improper logarithmic unit" logunit)
|
|
|
|
|
(if (math-units-in-expr-p b nil)
|
|
|
|
|
(calc-record-why "*Improper units quantity" b)
|
|
|
|
|
(let* ((units (math-extract-units a))
|
|
|
|
|
(coef (math-simplify (math-remove-units a))))
|
|
|
|
|
(cond
|
|
|
|
|
((equal logunit '(var dB var-dB))
|
|
|
|
|
(math-simplify
|
|
|
|
|
(math-mul
|
|
|
|
|
(math-sub
|
2011-11-14 23:55:13 -08:00
|
|
|
|
coef
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-mul (if power 10 20)
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-log10 b)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
units)))
|
|
|
|
|
(t
|
|
|
|
|
(math-simplify
|
|
|
|
|
(math-mul
|
|
|
|
|
(math-sub
|
2011-11-14 23:55:13 -08:00
|
|
|
|
coef
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-div (math-conditional-apply 'calcFunc-ln b) (if power 2 1)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
units)))))))))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lufmul (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-mul a b nil))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lupmul (a b)
|
2011-02-06 18:54:23 -06:00
|
|
|
|
(math-logunits-mul a b t))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-lu-times (arg)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-inverse)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu/" 'calcFunc-lufdiv arg)
|
|
|
|
|
(calc-binary-op "lu/" 'calcFunc-lupdiv arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu*" 'calcFunc-lufmul arg)
|
|
|
|
|
(calc-binary-op "lu*" 'calcFunc-lupmul arg)))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lufdiv (a b)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-divide a b nil))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-lupdiv (a b)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-divide a b t))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-lu-divide (arg)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-inverse)
|
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu*" 'calcFunc-lufmul arg)
|
|
|
|
|
(calc-binary-op "lu*" 'calcFunc-lupmul arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-hyperbolic)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lu/" 'calcFunc-lufdiv arg)
|
|
|
|
|
(calc-binary-op "lu/" 'calcFunc-lupdiv arg)))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
|
|
|
|
(defun math-logunits-quant (val ref power)
|
2011-02-07 16:25:31 -06:00
|
|
|
|
(let* ((units (math-simplify (math-extract-units val)))
|
|
|
|
|
(lunit (math-simplify (math-extract-logunits units))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(if (not (eq (car-safe lunit) 'var))
|
|
|
|
|
(calc-record-why "*Improper logarithmic unit" lunit)
|
2011-02-07 16:25:31 -06:00
|
|
|
|
(let ((runits (math-simplify (math-div units lunit)))
|
|
|
|
|
(coeff (math-simplify (math-div val units))))
|
|
|
|
|
(math-mul
|
|
|
|
|
(if (equal lunit '(var dB var-dB))
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-mul
|
2011-02-07 16:25:31 -06:00
|
|
|
|
ref
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-conditional-pow
|
2011-02-07 16:25:31 -06:00
|
|
|
|
10
|
|
|
|
|
(math-div
|
|
|
|
|
coeff
|
|
|
|
|
(if power 10 20))))
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-mul
|
2011-02-07 16:25:31 -06:00
|
|
|
|
ref
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-exp
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(if power
|
2011-02-07 16:25:31 -06:00
|
|
|
|
(math-mul 2 coeff)
|
|
|
|
|
coeff))))
|
|
|
|
|
runits)))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defvar calc-lu-field-reference)
|
|
|
|
|
(defvar calc-lu-power-reference)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 21:25:36 -05:00
|
|
|
|
(defun calcFunc-lufquant (val &optional ref)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-field-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-quant val ref nil))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 21:25:36 -05:00
|
|
|
|
(defun calcFunc-lupquant (val &optional ref)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-power-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-quant val ref t))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-lu-quant (arg)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-hyperbolic)
|
|
|
|
|
(if (calc-is-option)
|
2011-03-16 21:25:36 -05:00
|
|
|
|
(calc-binary-op "lupq" 'calcFunc-lufquant arg)
|
|
|
|
|
(calc-unary-op "lupq" 'calcFunc-lufquant arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-option)
|
2011-03-16 21:25:36 -05:00
|
|
|
|
(calc-binary-op "lufq" 'calcFunc-lupquant arg)
|
|
|
|
|
(calc-unary-op "lufq" 'calcFunc-lupquant arg)))))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
|
|
|
|
|
(defun math-logunits-level (val ref db power)
|
|
|
|
|
"Compute the value of VAL in decibels or nepers."
|
|
|
|
|
(let* ((ratio (math-simplify-units (math-div val ref)))
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(ratiou (math-simplify-units (math-remove-units ratio)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(units (math-simplify (math-extract-units ratio))))
|
|
|
|
|
(math-mul
|
|
|
|
|
(if db
|
|
|
|
|
(math-mul
|
|
|
|
|
(math-mul (if power 10 20)
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-conditional-apply 'calcFunc-log10 ratiou))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
'(var dB var-dB))
|
|
|
|
|
(math-mul
|
2011-03-01 21:07:34 -06:00
|
|
|
|
(math-div (math-conditional-apply 'calcFunc-ln ratiou) (if power 2 1))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
'(var Np var-Np)))
|
|
|
|
|
units)))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-dbfield (val &optional ref)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-field-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-level val ref t nil))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-dbpower (val &optional ref)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-power-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-level val ref t t))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-npfield (val &optional ref)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-field-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-level val ref nil nil))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calcFunc-nppower (val &optional ref)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(unless ref
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(setq ref (math-read-expr calc-lu-power-reference)))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(math-logunits-level val ref nil t))
|
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-db (arg)
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-hyperbolic)
|
|
|
|
|
(if (calc-is-option)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "ludb" 'calcFunc-dbfield arg)
|
|
|
|
|
(calc-unary-op "ludb" 'calcFunc-dbfield arg))
|
calc/calc.el (calc-logunits-field-reference) Renamed from
`calc-default-field-reference-level'.
(calc-logunits-power-reference): Renamed from `calc-default-power-reference-level'
calc/calc-units.el (math-logunits-quant): Renamed from `math-logunits-level'
(math-logunits-plus): Renamed from math-logcombine.
(calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove functions.
(calcFunc-lufieldplus, calcFunc-lupowerplus, calcFunc-lufieldminus)
(calcFunc-lufieldminus,calc-logunits-plus calc-logunits-minus): New functions.
(calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
(calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
(calc-logunits-quantity): Renamed from `calc-level'.
(calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
(calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
(math-logunits-times, calcFunc-lufieldtimes, calcFunc-lupowertimes)
(calc-logunits-times, math-logunits-divide, calcFunc-lufielddiv)
(calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
New functions.
calc-help.el (calc-u-prefix-help): Removed "L" reference.
(calc-ul-prefix-help): Remove.
(calc-l-prefix-help): New function.
(calc-full-help): Add reference to `calc-l-prefix-help'.
calc-ext.el (calc-init-extensions): Update autoloads.
2011-02-06 16:42:14 -06:00
|
|
|
|
(if (calc-is-option)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "ludb" 'calcFunc-dbpower arg)
|
|
|
|
|
(calc-unary-op "ludb" 'calcFunc-dbpower arg)))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(defun calc-np (arg)
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(if (calc-is-hyperbolic)
|
|
|
|
|
(if (calc-is-option)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lunp" 'calcFunc-npfield arg)
|
|
|
|
|
(calc-unary-op "lunp" 'calcFunc-npfield arg))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
(if (calc-is-option)
|
2011-03-16 20:30:08 -05:00
|
|
|
|
(calc-binary-op "lunp" 'calcFunc-nppower arg)
|
|
|
|
|
(calc-unary-op "lunp" 'calcFunc-nppower arg)))))
|
2011-01-23 23:08:04 -06:00
|
|
|
|
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
;;; Musical notes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar calc-note-threshold)
|
|
|
|
|
|
|
|
|
|
(defun math-midi-round (num)
|
|
|
|
|
"Round NUM to an integer N if NUM is within calc-note-threshold cents of N."
|
|
|
|
|
(let* ((n (math-round num))
|
|
|
|
|
(diff (math-abs
|
|
|
|
|
(math-sub num n))))
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(if (< (math-compare diff
|
2011-03-05 22:36:15 -06:00
|
|
|
|
(math-div (math-read-expr calc-note-threshold) 100)) 0)
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
n
|
|
|
|
|
num)))
|
|
|
|
|
|
|
|
|
|
(defconst math-notes
|
|
|
|
|
'(((var C var-C) . 0)
|
|
|
|
|
((var Csharp var-Csharp) . 1)
|
|
|
|
|
; ((var C♯ var-C♯) . 1)
|
|
|
|
|
((var Dflat var-Dflat) . 1)
|
|
|
|
|
; ((var D♭ var-D♭) . 1)
|
|
|
|
|
((var D var-D) . 2)
|
|
|
|
|
((var Dsharp var-Dsharp) . 3)
|
|
|
|
|
; ((var D♯ var-D♯) . 3)
|
|
|
|
|
((var E var-E) . 4)
|
|
|
|
|
((var F var-F) . 5)
|
|
|
|
|
((var Fsharp var-Fsharp) . 6)
|
|
|
|
|
; ((var F♯ var-F♯) . 6)
|
|
|
|
|
((var Gflat var-Gflat) . 6)
|
|
|
|
|
; ((var G♭ var-G♭) . 6)
|
|
|
|
|
((var G var-G) . 7)
|
|
|
|
|
((var Gsharp var-Gsharp) . 8)
|
|
|
|
|
; ((var G♯ var-G♯) . 8)
|
|
|
|
|
((var A var-A) . 9)
|
|
|
|
|
((var Asharp var-Asharp) . 10)
|
|
|
|
|
; ((var A♯ var-A♯) . 10)
|
|
|
|
|
((var Bflat var-Bflat) . 10)
|
|
|
|
|
; ((var B♭ var-B♭) . 10)
|
|
|
|
|
((var B var-B) . 11))
|
|
|
|
|
"An alist of notes with their number of semitones above C.")
|
|
|
|
|
|
|
|
|
|
(defun math-freqp (freq)
|
|
|
|
|
"Non-nil if FREQ is a positive number times the unit Hz.
|
|
|
|
|
If non-nil, return the coefficient of Hz."
|
|
|
|
|
(let ((freqcoef (math-simplify-units
|
|
|
|
|
(math-div freq '(var Hz var-Hz)))))
|
|
|
|
|
(if (Math-posp freqcoef) freqcoef)))
|
|
|
|
|
|
|
|
|
|
(defun math-midip (num)
|
|
|
|
|
"Non-nil if NUM is a possible MIDI note number.
|
|
|
|
|
If non-nil, return NUM."
|
|
|
|
|
(if (Math-numberp num) num))
|
|
|
|
|
|
|
|
|
|
(defun math-spnp (spn)
|
|
|
|
|
"Non-nil if NUM is a scientific pitch note (note + cents).
|
|
|
|
|
If non-nil, return a list consisting of the note and the cents coefficient."
|
|
|
|
|
(let (note cents rnote rcents)
|
|
|
|
|
(if (eq (car-safe spn) '+)
|
|
|
|
|
(setq note (nth 1 spn)
|
|
|
|
|
cents (nth 2 spn))
|
|
|
|
|
(setq note spn
|
|
|
|
|
cents nil))
|
|
|
|
|
(cond
|
|
|
|
|
((and ;; NOTE is a note, CENTS is nil or cents.
|
|
|
|
|
(eq (car-safe note) 'calcFunc-subscr)
|
|
|
|
|
(assoc (nth 1 note) math-notes)
|
|
|
|
|
(integerp (nth 2 note))
|
|
|
|
|
(setq rnote note)
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(or
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(not cents)
|
|
|
|
|
(Math-numberp (setq rcents
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-simplify
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(math-div cents '(var cents var-cents)))))))
|
|
|
|
|
(list rnote rcents))
|
|
|
|
|
((and ;; CENTS is a note, NOTE is cents.
|
|
|
|
|
(eq (car-safe cents) 'calcFunc-subscr)
|
|
|
|
|
(assoc (nth 1 cents) math-notes)
|
|
|
|
|
(integerp (nth 2 cents))
|
|
|
|
|
(setq rnote cents)
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(or
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(not note)
|
|
|
|
|
(Math-numberp (setq rcents
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-simplify
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(math-div note '(var cents var-cents)))))))
|
|
|
|
|
(list rnote rcents)))))
|
|
|
|
|
|
|
|
|
|
(defun math-freq-to-midi (freq)
|
|
|
|
|
"Return the midi note number corresponding to FREQ Hz."
|
|
|
|
|
(let ((midi (math-add
|
|
|
|
|
69
|
|
|
|
|
(math-mul
|
|
|
|
|
12
|
|
|
|
|
(calcFunc-log
|
|
|
|
|
(math-div freq 440)
|
|
|
|
|
2)))))
|
|
|
|
|
(math-midi-round midi)))
|
|
|
|
|
|
|
|
|
|
(defun math-spn-to-midi (spn)
|
|
|
|
|
"Return the MIDI number corresponding to SPN."
|
|
|
|
|
(let* ((note (cdr (assoc (nth 1 (car spn)) math-notes)))
|
|
|
|
|
(octave (math-add (nth 2 (car spn)) 1))
|
|
|
|
|
(cents (nth 1 spn))
|
|
|
|
|
(midi (math-add
|
|
|
|
|
(math-mul 12 octave)
|
|
|
|
|
note)))
|
|
|
|
|
(if cents
|
|
|
|
|
(math-add midi (math-div cents 100))
|
|
|
|
|
midi)))
|
|
|
|
|
|
|
|
|
|
(defun math-midi-to-spn (midi)
|
|
|
|
|
"Return the scientific pitch notation corresponding to midi number MIDI."
|
|
|
|
|
(let (midin cents)
|
|
|
|
|
(if (math-integerp midi)
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(setq midin midi
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
cents nil)
|
|
|
|
|
(setq midin (math-floor midi)
|
|
|
|
|
cents (math-mul 100 (math-sub midi midin))))
|
|
|
|
|
(let* ((nr ;; This should be (math-idivmod midin 12), but with
|
|
|
|
|
;; better behavior for negative midin.
|
|
|
|
|
(if (Math-negp midin)
|
|
|
|
|
(let ((dm (math-idivmod (math-neg midin) 12)))
|
|
|
|
|
(if (= (cdr dm) 0)
|
|
|
|
|
(cons (math-neg (car dm)) 0)
|
|
|
|
|
(cons
|
|
|
|
|
(math-sub (math-neg (car dm)) 1)
|
|
|
|
|
(math-sub 12 (cdr dm)))))
|
|
|
|
|
(math-idivmod midin 12)))
|
|
|
|
|
(n (math-sub (car nr) 1))
|
|
|
|
|
(note (car (rassoc (cdr nr) math-notes))))
|
|
|
|
|
(if cents
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(list '+ (list 'calcFunc-subscr note n)
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(list '* cents '(var cents var-cents)))
|
|
|
|
|
(list 'calcFunc-subscr note n)))))
|
|
|
|
|
|
|
|
|
|
(defun math-freq-to-spn (freq)
|
|
|
|
|
"Return the scientific pitch notation corresponding to FREQ Hz."
|
|
|
|
|
(math-with-extra-prec 3
|
|
|
|
|
(math-midi-to-spn (math-freq-to-midi freq))))
|
|
|
|
|
|
|
|
|
|
(defun math-midi-to-freq (midi)
|
|
|
|
|
"Return the frequency of the note with midi number MIDI."
|
|
|
|
|
(list '*
|
|
|
|
|
(math-mul
|
|
|
|
|
440
|
|
|
|
|
(math-pow
|
|
|
|
|
2
|
2011-11-14 23:55:13 -08:00
|
|
|
|
(math-div
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(math-sub
|
|
|
|
|
midi
|
|
|
|
|
69)
|
|
|
|
|
12)))
|
|
|
|
|
'(var Hz var-Hz)))
|
|
|
|
|
|
|
|
|
|
(defun math-spn-to-freq (spn)
|
|
|
|
|
"Return the frequency of the note with scientific pitch notation SPN."
|
|
|
|
|
(math-midi-to-freq (math-spn-to-midi spn)))
|
|
|
|
|
|
|
|
|
|
(defun calcFunc-spn (expr)
|
|
|
|
|
"Return EXPR written as scientific pitch notation + cents."
|
2011-11-14 23:55:13 -08:00
|
|
|
|
;; Get the coefficient of Hz
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(let (note)
|
|
|
|
|
(cond
|
|
|
|
|
((setq note (math-freqp expr))
|
|
|
|
|
(math-freq-to-spn note))
|
|
|
|
|
((setq note (math-midip expr))
|
|
|
|
|
(math-midi-to-spn note))
|
|
|
|
|
((math-spnp expr)
|
|
|
|
|
expr)
|
|
|
|
|
(t
|
|
|
|
|
(math-reject-arg expr "*Improper expression")))))
|
|
|
|
|
|
|
|
|
|
(defun calcFunc-midi (expr)
|
|
|
|
|
"Return EXPR written as a MIDI number."
|
|
|
|
|
(let (note)
|
|
|
|
|
(cond
|
|
|
|
|
((setq note (math-freqp expr))
|
|
|
|
|
(math-freq-to-midi note))
|
|
|
|
|
((setq note (math-spnp expr))
|
|
|
|
|
(math-spn-to-midi note))
|
|
|
|
|
((math-midip expr)
|
|
|
|
|
expr)
|
|
|
|
|
(t
|
|
|
|
|
(math-reject-arg expr "*Improper expression")))))
|
|
|
|
|
|
|
|
|
|
(defun calcFunc-freq (expr)
|
|
|
|
|
"Return the frequency corresponding to EXPR."
|
|
|
|
|
(let (note)
|
|
|
|
|
(cond
|
|
|
|
|
((setq note (math-midip expr))
|
|
|
|
|
(math-midi-to-freq note))
|
|
|
|
|
((setq note (math-spnp expr))
|
|
|
|
|
(math-spn-to-freq note))
|
|
|
|
|
((math-freqp expr)
|
|
|
|
|
expr)
|
|
|
|
|
(t
|
|
|
|
|
(math-reject-arg expr "*Improper expression")))))
|
|
|
|
|
|
|
|
|
|
(defun calc-freq (arg)
|
|
|
|
|
"Return the frequency corresponding to the expression on the stack."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(calc-unary-op "freq" 'calcFunc-freq arg)))
|
|
|
|
|
|
|
|
|
|
(defun calc-midi (arg)
|
|
|
|
|
"Return the MIDI number corresponding to the expression on the stack."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(calc-unary-op "midi" 'calcFunc-midi arg)))
|
|
|
|
|
|
|
|
|
|
(defun calc-spn (arg)
|
2020-12-19 17:14:33 +01:00
|
|
|
|
"Return scientific pitch notation corresponding to the expression on the stack."
|
* calc/calc-units.el (math-midi-round, math-freqp, math-midip)
(math-spnp, math-spn-to-midi, math-midi-to-spn, math-freq-to-spn)
(math-midi-to-freq, math-spn-to-freq, calcFunc-spn, calcFunc-midi)
(calcFunc-freq, calc-freq, calc-midi, calc-spn): New functions.
(math-notes): New variable.
* calc/calc.el (calc-note-threshold): New variable.
* calc/calc-ext.el (calc-init-extensions): Add keybindings for
calc-spn, calc-midi, calc-freq. Add autoloads for calcFunc-spn,
calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
* doc/misc/calc.tex (Musical Notes): New section.
(Customizing Calc): Mention calc-note-threshold.
2011-03-05 22:28:39 -06:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
|
|
|
|
(calc-unary-op "spn" 'calcFunc-spn arg)))
|
|
|
|
|
|
|
|
|
|
|
2004-11-30 17:27:44 +00:00
|
|
|
|
(provide 'calc-units)
|
|
|
|
|
|
2001-11-14 09:08:03 +00:00
|
|
|
|
;;; calc-units.el ends here
|