Skip to content

Commit

Permalink
constants: Fix constants
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Mar 23, 2024
1 parent 41fcb46 commit a904e9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/app_constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ local ui = require('ui.shared')
-- E with sym.EE
-- - with sym.NEGATE
local function replace_symbols(str)
return (str:gsub('E', sym.EE)):gsub('-', sym.NEGATE)
return (str:gsub('E', sym.EE)):gsub('-', sym.NEGATE):gsub('DEG', sym.DEGREE)
end

local function C(symbol, name, value, unit)
return { symbol, name, replace_symbols(value), unit }
end

local constants = {
C("NA", "Avogadro's number", "6.02214076E23", "1/mol"),
C("k", "Boltzmann", "1.380649E-23", "J/K"),
C("R", "Universal gas", "8.31446261815324", "J/mol K"),
C("NA", "Avogadro's number", "6.02214076E23", "mol^-1"),
C("k", "Boltzmann", "1.380649E-23", "J/DEGK"),
C("R", "Universal gas", "8.31446261815324", "J/mol DEGK"),
C("StdT", "Standard temperature", "273.15", "K"),
C("StdP", "Standard pressure", "101.325", "kPa"),
C("c", "Speed of light Vakuum", "2.99792458E8", "m/s"),
C("e", "Elemental charge", "1.60217646E-19", "Coul"),
C("me", "Elektron rest mass", "9.10938188E-31", "kg"),
C("mn", "Neutron rest mass", "1.67492716E-27", "kg"),
C("mp", "Proton rest mass", "1.67262158E-27", "kg"),
C("h", "Planck's constant", "6.62607015E-34", "J s")
}

local function run_consts(stack)
Expand Down

0 comments on commit a904e9e

Please sign in to comment.