- 0DC7983700B4D2EEC0CD0FE41D7BE166568CAF3BEE53D635CAB6685A0FBFC4057AB6B5836A3CD74AC152973A4A6CBBCFE4C8A514942E03F3591DCD811C8D1AA2
+ 772AAAF953790FBB7D7FE6AFD0BF2DEAF77988B1376A7C169FBD21F47F5AAFF6DF87B2C333B90E8CD373C11379BA4830CEDC3A48B36C26767AC7303889EF6A69
ffa/ffacalc/ffa_calc.adb
(513 . 6)(513 . 29)
13 FFA_FZ_Clear(Stack(SP));
14 FFA_FZ_Set_Head(Stack(SP), Word(FFA_K_Version));
15
16 -- Constant-Time Miller-Rabin Test on N using the given Witness.
17 -- Witness will be used as-is if it conforms to the valid range,
18 -- i.e. 2 <= Witness <= N - 2; else will be transformed into a
19 -- valid Witness via modular arithmetic.
20 -- Outputs ONE if N WAS FOUND composite; ZERO if NOT FOUND.
21 -- Handles degenerate cases of N that M-R per se cannot eat:
22 -- N=0, N=1: ALWAYS 'FOUND COMPOS.'; 2, 3 - ALWAYS 'NOT FOUND'.
23 -- If N is Even and not equal to 2, N is ALWAYS 'FOUND COMPOS.'
24 -- For ALL other N, the output is equal to that of the M-R test.
25 -- At most 1/4 of all possible Witnesses will be 'liars' for
26 -- a particular composite N , i.e. fail to attest to its
27 -- compositivity.
28 when 'P' =>
29 Want(2);
30 declare
31 MR_Result : WBool :=
32 FFA_FZ_MR_Composite_On_Witness(N => Stack(SP - 1),
33 Witness => Stack(SP));
34 begin
35 FFA_WBool_To_FZ(MR_Result, Stack(SP - 1));
36 end;
37 Drop;
38
39 --------------
40 -- Prefixes --
41 --------------
(534 . 7)(557 . 7)
43 ---------------------------------------------------------
44 when '!' | '@' | '$' | ':' | ';' | ',' |
45 'H' | 'I' | 'J' | 'K' | 'N' |
46 'P' | 'T' | 'X' | 'Y' =>
47 'T' | 'X' | 'Y' =>
48
49 E("This Operator is not defined yet: " & C);
50 ---------------------------------------------------------