2026-05-07 16:05:00 +02:00
2026-04-28 08:08:37 +02:00
2026-05-07 14:29:48 +02:00
2026-05-07 16:05:00 +02:00
2026-05-07 16:05:00 +02:00
2026-04-28 09:22:55 +02:00
2026-04-17 16:01:37 +02:00
2026-04-17 16:05:39 +02:00
2026-05-07 16:05:00 +02:00
2026-05-07 14:29:48 +02:00

42_EXT_05_computorv1

ressources

install

this project uses submodules (maybe recursively), so either :

  • git clone --recurse-submodules <repo-url>
  • or, after cloning : git submodule update --init --recursive

steps

  1. lexer -> tokens types :
    • TOKEN_VARIABLE // x, y, etc.
    • TOKEN_NUMBER_INT // int
    • TOKEN_NUMBER_DOUBLE // double
    • TOKEN_POWER // ^ or **
    • TOKEN_SIGN_PLUS // +
    • TOKEN_SIGN_MINUS // -
    • TOKEN_FACTOR_MULT // *
    • TOKEN_FACTOR_DIV // / or :
    • TOKEN_EQUAL // =
    • END // null
  2. parser -> terms :
    • POSITION // left or righ from =
    • SIGN // + or -
    • COEFFICIENT // double
    • EXPONENT // double
  3. reduce -> polynom :
    • 0
    • 1
    • 2
    • 3
    • ...
  4. print reduced form -> print reduced form -> if degree 1 :
    • if c = 0 -> print "any real is a solution"
    • if c != 0 -> print "no solution" -> if degree 2 :
    • print degree -> if degree 3 :
    • print degree
  5. solve -> discriminant : Δ = b² - 4ac -> Δ > 0 -> 2 solutions : x = ( -b / 2a ) +- ( √|Δ| / 2a ) -> Δ == 0 -> : x = ( -b / 2a ) -> Δ < 0 -> 2 solutions : x = ( -b / 2a ) +- i( √|Δ| / 2a ) -> solution :
    • delta_sign; // + or -
    • delta_absolute; // |Δ|
    • first_term_gcd; // gcd(b, 2a)
    • first_term_numerator; // -b / gcd
    • first_term_denominator; // 2a / gcd
    • first_term; // double (-b / 2a)
    • second_term_gcd; // gcd(√|Δ|, 2a)
    • second_term_numerator; // √|Δ| / gcd
    • second_term_denominator; // 2a / gcd
    • second_term; // double (√|Δ| / 2a)
    • double solution1; // first_term + second_term
    • double solution2; // first_term - second_term
  6. print solution
Description
No description provided
Readme 3.2 MiB
Languages
C 59.2%
Shell 37.5%
Makefile 3.3%