diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 01c9c23adcb..85d3a91c533 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3fp.dtx 2857 2011-09-26 19:46:31Z joseph $ {L3 Experimental floating-point operations} %</driver|package> %<*driver> @@ -3299,19 +3299,21 @@ % \end{macro} % % \begin{macro}{\fp_trig_octant:} -% \begin{macro}[aux]{\fp_trig_octant_aux:} +% \begin{macro}[aux] +% {\fp_trig_octant_aux_i:, \fp_trig_octant_aux_ii:} % Here, the input is further reduced into the range -% $ 0 \le x < \pi / 4 $. This is pretty simple: check if +% $ 0 < x \le \pi / 4 $. This is pretty simple: check if % $ \pi / 4 $ can be taken off and if it can do it and loop. The % check at the end is to \enquote{mop up} values which are so close to % $ \pi / 4 $ that they should be treated as such. The test for % an even octant is needed as the `remainder' needed is from -% the nearest $ \pi / 2 $. +% the nearest $ \pi / 2 $. The check for octant $4$ is needed as an exact +% $\pi$ input will otherwise end up in the wrong place! % \begin{macrocode} \cs_new_protected_nopar:Npn \fp_trig_octant: { \l_fp_trig_octant_int \c_one - \fp_trig_octant_aux: + \fp_trig_octant_aux_i: \if_int_compare:w \l_fp_input_a_decimal_int < \c_ten \l_fp_input_a_decimal_int \c_zero \l_fp_input_a_extended_int \c_zero @@ -3326,7 +3328,17 @@ \l_fp_input_a_extended_int \fi: } -\cs_new_protected_nopar:Npn \fp_trig_octant_aux: +\cs_new_protected_nopar:Npn \fp_trig_octant_aux_i: + { + \if_int_compare:w \l_fp_trig_octant_int > \c_four + \l_fp_trig_octant_int \c_four + \l_fp_input_a_decimal_int \c_fp_pi_by_four_decimal_int + \l_fp_input_a_extended_int \c_fp_pi_by_four_extended_int + \else: + \exp_after:wN \fp_trig_octant_aux_ii: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_octant_aux_ii: { \if_int_compare:w \l_fp_input_a_integer_int > \c_zero \fp_sub:NNNNNNNNN @@ -3336,7 +3348,7 @@ \l_fp_input_a_integer_int \l_fp_input_a_decimal_int \l_fp_input_a_extended_int \tex_advance:D \l_fp_trig_octant_int \c_one - \exp_after:wN \fp_trig_octant_aux: + \exp_after:wN \fp_trig_octant_aux_i: \else: \if_int_compare:w \l_fp_input_a_decimal_int > \c_fp_pi_by_four_decimal_int @@ -3349,7 +3361,7 @@ \l_fp_input_a_extended_int \tex_advance:D \l_fp_trig_octant_int \c_one \exp_after:wN \exp_after:wN \exp_after:wN - \fp_trig_octant_aux: + \fp_trig_octant_aux_i: \fi: \fi: } |