Skip to content

Commit

Permalink
Fixed quadratic modular equation
Browse files Browse the repository at this point in the history
  • Loading branch information
alpertron committed May 1, 2024
1 parent 37b115b commit cbe909a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ConsoleApplication1.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;FACTORIZATION_APP=1;ENABLE_VERBOSE;FACTORIZATION_FUNCTIONS=1;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USING64BITS_;USING_BLOCKLY=1;ENABLE_VERBOSE;POLYEXPR=1</PreprocessorDefinitions>
Expand Down
2 changes: 1 addition & 1 deletion ConsoleApplication1.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>5 "x^1024-1" 0 0</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>11 11 10 121</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(ProjectDir)\x64\release</LocalDebuggerWorkingDirectory>
Expand Down
32 changes: 18 additions & 14 deletions coverage
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
flags="flags_coverage=--coverage"
#flags="flags_coverage=--coverage flags_sanitize=-fsanitize=address"
rm *.info *.out
make clean
make ecm flags_coverage=--coverage
make ecm $flags
echo -e "**** ECM ****" > coverage.out
./ecm "10**150000" >> coverage.out
./ecm "10**300000" >> coverage.out
Expand Down Expand Up @@ -95,7 +97,8 @@ echo -e "**** ECM ****" > coverage.out
lcov --capture --directory . --output-file ecm.info
gcovr --json run-1.json
make clean
make blockly flags_coverage=--coverage
make blockly $flags

echo -e "**** BLOCKLY ****" >> coverage.out
./blockly xml.txt 0 >> coverage.out
./blockly xml.txt 1 >> coverage.out
Expand All @@ -121,7 +124,7 @@ echo -e "**** BLOCKLY ****" >> coverage.out
lcov --capture --directory . --output-file blockly.info
gcovr --json run-2.json
make clean
make polfact flags_coverage=--coverage
make polfact $flags
echo -e "\n\n**** POLFACT ****" >> coverage.out
./polfact 0 "x^510-1" 0 0 >> coverage.out
./polfact 0 "x^120-1" 0 0 >> coverage.out
Expand Down Expand Up @@ -318,7 +321,7 @@ echo -e "\n\n**** POLFACT ****" >> coverage.out
lcov --capture --directory . --output-file polfact.info
gcovr --json run-3.json
make clean
make fsquares flags_coverage=--coverage
make fsquares $flags
echo -e "\n\n**** FSQUARES ****" >> coverage.out
./fsquares "-2" >> coverage.out
./fsquares "10**15000" >> coverage.out
Expand All @@ -331,7 +334,7 @@ echo -e "\n\n**** FSQUARES ****" >> coverage.out
lcov --capture --directory . --output-file fsquares.info
gcovr --json run-4.json
make clean
make tsqcubes flags_coverage=--coverage
make tsqcubes $flags
echo -e "\n\n**** TSQCUBES ****" >> coverage.out
./tsqcubes "-2" 3 >> coverage.out
./tsqcubes "10**150" 3 >> coverage.out
Expand All @@ -346,7 +349,7 @@ echo -e "\n\n**** TSQCUBES ****" >> coverage.out
lcov --capture --directory . --output-file fsquares.info
gcovr --json run-5.json
make clean
make fcubes flags_coverage=--coverage
make fcubes $flags
echo -e "\n\n**** FCUBES ****" >> coverage.out
./fcubes 0 >> coverage.out
./fcubes 16 >> coverage.out
Expand All @@ -357,7 +360,7 @@ echo -e "\n\n**** FCUBES ****" >> coverage.out
lcov --capture --directory . --output-file fcubes.info
gcovr --json run-6.json
make clean
make dilog flags_coverage=--coverage
make dilog $flags
echo -e "\n\n**** DILOG ****" >> coverage.out
./dilog -1 4 5 >> coverage.out
./dilog 3 -1 5 >> coverage.out
Expand All @@ -378,7 +381,7 @@ echo -e "\n\n**** DILOG ****" >> coverage.out
lcov --capture --directory . --output-file dilog.info
gcovr --json run-7.json
make clean
make quad flags_coverage=--coverage
make quad $flags
echo -e "\n\n**** QUAD ****" >> coverage.out
./quad 0 0 0 0 0 0 0 >> coverage.out
./quad 0 0 0 0 5 6 0 >> coverage.out
Expand Down Expand Up @@ -425,7 +428,7 @@ echo -e "\n\n**** QUAD ****" >> coverage.out
lcov --capture --directory . --output-file quad.info
gcovr --json run-8.json
make clean
make contfrac flags_coverage=--coverage
make contfrac $flags
echo -e "\n\n**** CONTFRAC ****" >> coverage.out
./contfrac 1 2 3 0 0 >> coverage.out
./contfrac 1 0 991 0 0 >> coverage.out
Expand All @@ -447,7 +450,7 @@ echo -e "\n\n**** CONTFRAC ****" >> coverage.out
lcov --capture --directory . --output-file contfrac.info
gcovr --json run-9.json
make clean
make quadmod flags_coverage=--coverage
make quadmod $flags
echo -e "\n\n**** QUADMOD ****" >> coverage.out
./quadmod 1 2 3 7 >> coverage.out
./quadmod 1 0 991 "n(10^5)" >> coverage.out
Expand Down Expand Up @@ -486,11 +489,12 @@ echo -e "\n\n**** QUADMOD ****" >> coverage.out
./quadmod 1 0 112 243 >> coverage.out
./quadmod 1 0 195722369727 1099511627776 >> coverage.out
./quadmod 1 0 -1 "2**90" >> coverage.out
./quadmod 11 11 10 121 >> coverage.out
./quadmod T Q R M >> coverage.out
lcov --capture --directory . --output-file quadmod.info
gcovr --json run-10.json
make clean
make gaussian flags_coverage=--coverage
make gaussian $flags
echo -e "\n\n**** GAUSSIAN ****" >> coverage.out
./gaussian 5 1 >> coverage.out
./gaussian 1 1 >> coverage.out
Expand Down Expand Up @@ -523,7 +527,7 @@ echo -e "\n\n**** GAUSSIAN ****" >> coverage.out
lcov --capture --directory . --output-file gaussian.info
gcovr --json run-11.json
make clean
make sumquad flags_coverage=--coverage
make sumquad $flags
echo -e "\n\n**** SUMQUAD ****" >> coverage.out
./sumquad 100 >> coverage.out
./sumquad 200 >> coverage.out
Expand All @@ -533,7 +537,7 @@ echo -e "\n\n**** SUMQUAD ****" >> coverage.out
lcov --capture --directory . --output-file sumquad.info
gcovr --json run-12.json
make clean
make divisors flags_coverage=--coverage
make divisors $flags
echo -e "\n\n**** DIVISORS ****" >> coverage.out
./divisors 0 >> coverage.out
./divisors 2 >> coverage.out
Expand All @@ -543,7 +547,7 @@ echo -e "\n\n**** DIVISORS ****" >> coverage.out
lcov --capture --directory . --output-file divisors.info
gcovr --json run-13.json
make clean
make isprime flags_coverage=--coverage
make isprime $flags
echo -e "\n\n**** ISPRIME ****" >> coverage.out
./isprime -3 -5 -7 -9 4759 81463477561 25326001 341550071728321 1000000000000000003 >> coverage.out
./isprime 0 1 2 3 4 15 65537 -4294967296 >> coverage.out
Expand Down
7 changes: 4 additions & 3 deletions quadmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void Show1(const BigInteger *num, int t)
}
}

void Solution(BigInteger *value)
void Solution(const BigInteger *value)
{
SolNbr++;
copyStr(&ptrOutput, "<li>x = ");
Expand Down Expand Up @@ -181,7 +181,7 @@ static void ModulusIsNotZero(void)
(void)BigIntRemainder(&ValC, &ValN, &ValC);
BigIntGcd(&ValA, &ValB, &Aux0);
Aux0.sign = SIGN_POSITIVE;
BigIntGcd(&ValC, &Aux0, &GcdAll);
BigIntGcd(&ValN, &Aux0, &GcdAll);
GcdAll.sign = SIGN_POSITIVE;
(void)BigIntRemainder(&ValC, &GcdAll, &Aux0);
if (!BigIntIsZero(&Aux0))
Expand Down Expand Up @@ -216,7 +216,8 @@ static void ModulusIsNotZero(void)
}
return;
}
SetCallbacksForSolveEquation(Solution, NULL, NULL);
SetCallbacksForSolveEquation(&Solution, NULL,
NULL);
SolveEquation(&ValA, &ValB, &ValC, &ValN, &GcdAll, &ValNn);
}

Expand Down
2 changes: 1 addition & 1 deletion test.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "fromBlockly.h"
#include "isprime.h"
#ifndef DEBUG_CODE
#define DEBUG_CODE 9
#define DEBUG_CODE 16
#endif
#if (DEBUG_CODE == 9) || (DEBUG_CODE == 17)
extern bool teach;
Expand Down

0 comments on commit cbe909a

Please sign in to comment.