### Testing advanced arithmetic
print_ln("\nTesting secret values advanced arithmetic")
sfix_a = sfix(2.5)
sfix_b = sfix(36.4)
sfix_c = sfix(487)
sfix_d = sfix(128)
print_ln("a = %s is a secret fixed point number.", sfix_a.reveal())
print_ln("b = %s is a secret fixed point number.", sfix_b.reveal())
print_ln("c = %s is a secret fixed point number.", sfix_c.reveal())
print_ln("d = %s is a secret fixed point number.", sfix_d.reveal())
sfloat.vlen = 15 # Length of mantissa in bits
sfloat.plen = 10 # Length of exponent in bits
sfloat.kappa = 4 # Statistical security parameter for floats
# log_2
print_ln("\nTesting logarithm")
print_ln("log_2(a) = %s.", mpc_math.log2_fx(sfix_a).reveal())
print_ln("log_2(b) = %s.", mpc_math.log2_fx(sfix_b).reveal())
print_ln("log_2(c) = %s.", mpc_math.log2_fx(sfix_c).reveal())
print_ln("log_2(d) = %s.", mpc_math.log2_fx(sfix_d).reveal())
# exp_2
print_ln("\nTesting exponentiation")
print_ln("exp_2(a) = %s.", mpc_math.exp2_fx(sfix_a).reveal())
print_ln("exp_2(b) = %s.", mpc_math.exp2_fx(sfix_b).reveal())
print_ln("exp_2(c) = %s.", mpc_math.exp2_fx(sfix_c).reveal())
print_ln("exp_2(d) = %s.", mpc_math.exp2_fx(sfix_d).reveal())
# pow
print_ln("\nTesting power")
print_ln("2^{%s*log_2(a)} = %s.", 5, mpc_math.pow_fx(sfix_a,5).reveal())
print_ln("2^{%s*log_2(b)} = %s.", 4, mpc_math.pow_fx(sfix_b,4).reveal())
print_ln("2^{%s*log_2(c)} = %s.", 3, mpc_math.pow_fx(sfix_c,3).reveal())
print_ln("2^{%s*log_2(d)} = %s.", 2, mpc_math.pow_fx(sfix_d,2).reveal())
# log
print_ln("\nTesting general logarithm")
print_ln("log_%s(a) = %s.", 3, mpc_math.log_fx(sfix_a,3).reveal())
print_ln("log_%s(b) = %s.", 4, mpc_math.log_fx(sfix_b,4).reveal())
print_ln("log_%s(c) = %s.", 5, mpc_math.log_fx(sfix_c,5).reveal())
print_ln("log_%s(d) = %s.", 6, mpc_math.log_fx(sfix_d,6).reveal())