Skip to content

Commit

Permalink
Actualizacion de archivos
Browse files Browse the repository at this point in the history
  • Loading branch information
Dsyboot committed Jun 30, 2024
1 parent c5ed383 commit 0b6b5d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 40 deletions.
Binary file modified __pycache__/functions.cpython-311.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source.dir = .
source.include_exts = py,png,jpg,kv,atlas

# (list) List of inclusions using pattern matching
source.include_patterns = assets/*
source.include_patterns = assets/images/*.png, assets/fonts/*.ttf

# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec, gitignore
Expand Down
8 changes: 5 additions & 3 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class InvalidCommandException(Exception):
# Clase estatica matematica
class Math:
# Variables matematicas
e = 2.71828182845905
pi = 3.14159265358979
tau = 6.28318530717958
e = 2.718281828459045
pi = 3.141592653589793
tau = 6.283185307179586
n = 17 # Variable default
inRadians = True # Variable de Grados/Radianes

Expand Down Expand Up @@ -342,6 +342,8 @@ def evaluate_expression(self, expression) -> tuple:
result = ("Error de calculo", True)
except TypeError:
result = ("Error de sintaxis", True)
except NameError:
result = ("Error de sintaxis", True)
except ValueError:
result = ("Error en el dominio", True)
except NaturalNumberException:
Expand Down
6 changes: 2 additions & 4 deletions macCons.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def operation() -> int:
else:
# No es un comando, asi que se evalua la expresion
solve = Solver() # Crear objeto de la clase Solver
Math.usesRadians(radians) # Cambiar el modo de calculo
global ans
solve.functions["ans"] = ans

Expand Down Expand Up @@ -130,8 +129,7 @@ def save_log():
#end def

# Funcion para correr el programa
def run():
global radians
def run():
global global_result

while True:
Expand Down Expand Up @@ -184,7 +182,7 @@ def run():
if command == 0:
save_log() # /save
elif command == 1:
radians = not radians # /chgrad
Math.usesRadians(not Math.inRadians) # /chgrad
elif command == 2:
print("Cerrando...")
sleep(0.750) # Sleep maneja segundos
Expand Down
37 changes: 5 additions & 32 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
import functions as fn
from math import pi, e, tau

# Función para convertir grados a radianes
def toRadians(degrees: float) -> float:
return degrees * (math.pi / 180)

# Función para convertir radianes a grados
def toDegrees(radians: float) -> float:
return radians * (180 / math.pi)

# Función para convertir grados a grados-minutos-segundos (DMS)
def toDMS(degrees: float) -> tuple:
deg = int(degrees)
minutes_float = (degrees - deg) * 60
minutes = int(minutes_float)
seconds = (minutes_float - minutes) * 60
return deg, minutes, seconds

# Función para convertir grados-minutos-segundos (DMS) a grados decimales
def fromDMS(degrees, minutes, seconds) -> float:
return degrees + (minutes / 60) + (seconds / 3600)

# Ejemplo de uso
degrees = 45
radians = toRadians(degrees)
dms = toDMS(degrees)
degrees_from_dms = fromDMS(*dms)

print()

print(f"{degrees} grados son {radians} radianes.")
print(f"{degrees} grados son {dms[0]}° {dms[1]}' {dms[2]:.2f}\".")
print(f"Conversión de grados-minutos-segundos a grados decimales: {degrees_from_dms} grados.")
print(pi)
print(e)
print(tau)
print(2*pi)

0 comments on commit 0b6b5d6

Please sign in to comment.