Skip to content

Commit

Permalink
Revert multiply.cpp and updated README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCG-coder committed Mar 21, 2024
1 parent 3cbab71 commit acf4a1e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ we are planning to implement next (and in the near future):
- [x] Multiplication of integers and decimals
- [x] Powers of integers
- [x] Division of integers and decimals
- [ ] Addition of fractions
- [ ] Subtraction of fractions
- [ ] Multiplication of fractions
- [x] Addition of fractions
- [x] Subtraction of fractions
- [x] Multiplication of fractions
- [ ] Simplification of fractions
- [ ] Division of fractions
- [x] Division of fractions
- [ ] Conversion between fractions and decimals
- [ ] Expansion of polynomials
- [ ] Factoring of polynomials
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
file(GLOB UTILS *.cpp)
add_library(util ${UTILS})

file(GLOB GUIS gui/*.cpp)
add_executable(gui ${GUIS})
# file(GLOB GUIS gui/*.cpp)
# add_executable(gui ${GUIS})

set(CALCULATOR_FILES)

Expand All @@ -48,9 +48,9 @@ endforeach ()

add_library(calc ${CALCULATOR_FILES})
target_link_libraries(calc util)
target_link_libraries(gui util)
# target_link_libraries(gui util)
target_include_directories(calc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_include_directories(gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
# target_include_directories(gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_compile_definitions(calc PRIVATE NO_MAIN)

foreach (COMPONENT IN LISTS COMPONENTS)
Expand Down
9 changes: 5 additions & 4 deletions src/multiply/multiply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ std::string multiply(const std::string_view& a, const std::string_view& b, const
finalProdDigits[indexDigit] = sum;
}

const auto scale = determineProductScale(static_cast<std::string>(a), static_cast<std::string>(b));
size_t numberDecimals = 0;
// const auto scale = determineProductScale(static_cast<std::string>(a), static_cast<std::string>(b));
// size_t numberDecimals = 0;

if (scale < 0)
;
// if (scale < 0)
// ;
const size_t numberDecimals = aDecimal.length() + bDecimal.length();
return reportMultiply(static_cast<std::string>(a),
static_cast<std::string>(b),
aStr,
Expand Down

0 comments on commit acf4a1e

Please sign in to comment.