round.diff
b/doc/sty/automultiplechoice.dtx.in Mon Nov 27 17:16:27 2017 +0100 | ||
---|---|---|
3438 | 3438 |
\amc_fp_decompose:NNn \amc_num_mantissa_fp \amc_num_exponent_int |
3439 | 3439 |
{ #2 } |
3440 | 3440 |
\fp_set:Nn #1 |
3441 |
{ round(\amc_num_mantissa_fp * 10^((#3)-1),0,0) }
|
|
3441 |
{ round(\amc_num_mantissa_fp * 10^((#3)-1)) } |
|
3442 | 3442 |
\fp_compare:nTF { abs(#1) >= 10^(#3) } |
3443 | 3443 |
{ |
3444 | 3444 |
\fp_set:Nn #1 { #1 / 10 } |
... | ... | |
3458 | 3458 | |
3459 | 3459 |
\cs_new:Npn \amc_fp_n_digits:Nnn #1 #2 #3 { |
3460 | 3460 |
\fp_set:Nn #1 |
3461 |
{ round((#2) * 10^(#3),0,0) }
|
|
3461 |
{ round((#2) * 10^(#3)) } |
|
3462 | 3462 |
} |
3463 | 3463 | |
3464 | 3464 |
\int_new:N \amc_todigits_int |
3465 | 3465 |
\cs_new:Npn \amc_fp_to_digits:Nnnn #1 #2 #3 #4 { |
3466 | 3466 |
\clist_clear:N #1 |
3467 |
\int_set:Nn \amc_todigits_int { \fp_eval:n { abs(round(#2,0,0)) } }
|
|
3467 |
\int_set:Nn \amc_todigits_int { \fp_eval:n { abs(round(#2)) } } |
|
3468 | 3468 |
\prg_replicate:nn { #3 } { |
3469 | 3469 |
\clist_put_left:Nx #1 { \int_mod:nn \amc_todigits_int { #4 } } |
3470 | 3470 |
\int_set:Nn \amc_todigits_int |
b/tests/t/tex_arithm/arithm.tex Mon Nov 27 17:16:27 2017 +0100 | ||
---|---|---|
21 | 21 | |
22 | 22 |
\test{-0.0065}{1}{-6} |
23 | 23 | |
24 |
\test{0.0075}{1}{8} |
|
25 | ||
26 |
\test{-0.0075}{1}{-8} |
|
27 | ||
24 | 28 |
\test{0.996}{2}{10} |
25 | 29 | |
26 | 30 |
\test{-9.76}{1}{-1} |