From 4efb0e288e61307337a1593f83dead03178acc61 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 22 Nov 2013 00:05:28 +0000
Subject: l3 (19nov13)

git-svn-id: svn://tug.org/texlive/trunk@32204 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/l3kernel/l3fp.sty | 2318 ++++++++++++++++---------
 1 file changed, 1492 insertions(+), 826 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/l3kernel/l3fp.sty')

diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty
index 48e8d757bfe..679f97c2519 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty
@@ -25,7 +25,7 @@
 %% 
 %% Do not distribute a modified version of this file.
 %% 
-%% File: l3fp.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -59,12 +59,12 @@
 %% -----------------------------------------------------------------------
 %%
 \RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3fp.dtx 4521 2013-07-09 11:45:31Z joseph $
+\GetIdInfo$Id: l3fp.dtx 4601 2013-11-18 23:13:28Z bruno $
   {L3 Floating points}
 \ProvidesExplPackage
   {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
 \__expl_package_check:
-%% File: l3fp-aux.dtx Copyright(C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-aux.dtx Copyright(C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -99,11 +99,14 @@
 %%
 \cs_new:Npn \__fp_use_none_stop_f:n #1 { \exp_stop_f: }
 \cs_new:Npn \__fp_use_s:n #1 { #1; }
+\cs_new:Npn \__fp_use_braced_s:n #1 { {#1} ; }
 \cs_new:Npn \__fp_use_s:nn #1#2 { #1#2; }
 \cs_new:Npn \__fp_use_none_until_s:w #1; { }
 \cs_new:Npn \__fp_use_i_until_s:nw #1#2; {#1}
 \cs_new:Npn \__fp_use_ii_until_s:nnw #1#2#3; {#2}
 \cs_new:Npn \__fp_reverse_args:Nww #1 #2; #3; { #1 #3; #2; }
+\cs_new:Npn \__fp_rrot:www #1; #2; #3; { #2; #3; #1; }
+\cs_new:Npn \__fp_use_i:ww #1; #2; { #1; }
 \__scan_new:N \s__fp
 \cs_new_protected:Npn \__fp_chk:w #1 ;
   {
@@ -366,7 +369,7 @@
     conversion~functions.
   }
 %%
-%% File: l3fp-traps.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-traps.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -533,6 +536,7 @@
 \fp_trap:nn { underflow } { flag }
 \cs_new_nopar:Npn \__fp_invalid_operation_o:nw
   { \__fp_invalid_operation:nnw { \exp_after:wN \c_nan_fp } }
+\cs_generate_variant:Nn \__fp_invalid_operation_o:nw { f }
 \cs_new:Npn \__fp_error:nnnn #1
   { \__msg_kernel_expandable_error:nnnnn { kernel } { fp - #1 } }
 \cs_generate_variant:Nn \__fp_error:nnnn { nnf, nff }
@@ -773,7 +777,7 @@
     \exp_after:wN \__fp_exp_after_o:w \tex_romannumeral:D -`0
     \__fp_sanitize:Nw #1#2; {1000}{0000}{0000}{0000};
   }
-%% File: l3fp-parse.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-parse.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -844,84 +848,109 @@
 \__fp_tmp:w {ii}   \__fp_parse_digits_i:N    { 00 ; 2 }
 \__fp_tmp:w {i}    \__fp_parse_digits_:N     { 0 ; 1 }
 \cs_new_nopar:Npn \__fp_parse_digits_:N { ; ; 0 }
-\cs_new:Npn \__fp_parse_operand:Nw #1 #2
+\cs_new:Npn \__fp_parse_one:Nw #1 #2
   {
-    \if_catcode:w \tex_relax:D #2
-      \if_meaning:w \tex_relax:D #2
+    \if_catcode:w \scan_stop: \exp_not:N #2
+      \if_meaning:w \scan_stop: #2
         \exp_after:wN \exp_after:wN
-        \exp_after:wN \__fp_parse_operand_relax:NN
+        \exp_after:wN \__fp_parse_one_fp:NN
       \else:
         \exp_after:wN \exp_after:wN
-        \exp_after:wN \__fp_parse_operand_register:NN
+        \exp_after:wN \__fp_parse_one_register:NN
       \fi:
     \else:
       \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f:
         \exp_after:wN \exp_after:wN
-        \exp_after:wN \__fp_parse_operand_digit:NN
+        \exp_after:wN \__fp_parse_one_digit:NN
       \else:
         \exp_after:wN \exp_after:wN
-        \exp_after:wN \__fp_parse_operand_other:NN
+        \exp_after:wN \__fp_parse_one_other:NN
       \fi:
     \fi:
     #1 #2
   }
+\cs_new:Npn \__fp_parse_one_fp:NN #1#2
+  {
+    \cs:w __fp_exp_after \__fp_type_from_scan:N #2 _f:nw \cs_end:
+      {
+        \exp_after:wN \__fp_parse_infix:NN
+        \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w
+      }
+    #2
+  }
+\cs_new:Npn \__fp_exp_after_mark_f:nw #1
+  {
+    \__msg_kernel_expandable_error:nn { kernel } { fp-early-end }
+    \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1
+  }
+\cs_new:cpn { __fp_exp_after_?_f:nw } #1#2
+  {
+    \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2}
+    \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1
+  }
+\cs_new:Npn \__fp_parse_one_register:NN #1#2
+  {
+    \exp_after:wN \__fp_parse_infix_after_operand:NwN
+    \exp_after:wN #1
+    \tex_romannumeral:D -`0
+      \exp_after:wN \__fp_parse_one_register_aux:Nw
+      \exp_after:wN #2
+      \__int_value:w
+        \exp_after:wN \__fp_parse_exponent:N
+        \tex_romannumeral:D \__fp_parse_expand:w
+  }
 \group_begin:
 \char_set_catcode_other:N \P
 \char_set_catcode_other:N \T
+\char_set_catcode_other:N \M
+\char_set_catcode_other:N \U
 \tl_to_lowercase:n
   {
     \group_end:
-    \cs_new:Npn \__fp_parse_operand_register:NN #1#2
-      {
-        \exp_after:wN \__fp_parse_infix_after_operand:NwN
-        \exp_after:wN #1
-        \tex_romannumeral:D -`0
-          \exp_after:wN \__fp_parse_operand_register_aux:www
-          \tex_the:D
-            \exp_after:wN #2
-            \exp_after:wN P
-            \exp_after:wN T
-            \exp_after:wN \q_stop
-          \__int_value:w \__fp_parse_exponent:N
-      }
-    \cs_new:Npn \__fp_parse_operand_register_aux:www #1 PT #2 \q_stop #3 ;
-      { \__fp_parse:n { #1 e #3 } }
-  }
-\cs_new:Npn \__fp_parse_operand_relax:NN #1#2
-  {
-    \cs:w __fp_parse_exp_after \__fp_type_from_scan:N #2 _f:nw \cs_end:
+    \cs_new:Npn \__fp_parse_one_register_aux:Nw #1
       {
-        \exp_after:wN \__fp_parse_infix:NN
-        \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w
+        \exp_after:wN \use:nn
+        \exp_after:wN \__fp_parse_one_register_auxii:wwwNw
+        \exp_after:wN { \tex_the:D \exp_not:N #1 }
+          ; \__fp_parse_one_register_dim:ww
+          PT ; \__fp_parse_one_register_mu:www
+          . PT ; \__fp_parse_one_register_int:www
+          \q_stop
       }
-    #2
+    \cs_new:Npn \__fp_parse_one_register_auxii:wwwNw
+        #1 . #2 PT #3 ; #4#5 \q_stop { #4 #1.#2; }
+    \cs_new:Npn \__fp_parse_one_register_mu:www #1 MU; #2;
+      { \__fp_parse_one_register_dim:ww #1; }
   }
-\cs_new_eq:NN \__fp_parse_exp_after_f:nw \__fp_exp_after_f:nw
-\cs_new:Npn \__fp_parse_exp_after_mark_f:nw #1
+\cs_new:Npn \__fp_parse_one_register_int:www #1; #2.; #3;
+  { \__fp_parse:n { #1 e #3 } }
+\cs_new:Npn \__fp_parse_one_register_dim:ww #1; #2;
   {
-    \__msg_kernel_expandable_error:nn { kernel } { fp-early-end }
-    \exp_after:wN \c_nan_fp
-    \tex_romannumeral:D -`0 #1
+    \exp_after:wN \__fp_from_dim_test:ww
+    \__int_value:w #2 \exp_after:wN ,
+    \__int_value:w \__dim_eval:w #1 pt ;
   }
-\cs_new:cpn { __fp_parse_exp_after_?_f:nw } #1#2
+\cs_new:Npn \__fp_parse_one_digit:NN #1
   {
-    \__msg_kernel_expandable_error:nnn
-      { kernel } { bad-variable } {#2}
-    \exp_after:wN \c_nan_fp
-    \tex_romannumeral:D -`0 #1
+    \exp_after:wN \__fp_parse_infix_after_operand:NwN
+    \exp_after:wN #1
+    \tex_romannumeral:D -`0
+      \exp_after:wN \__fp_sanitize:wN
+      \int_use:N \__int_eval:w \c_zero \__fp_parse_trim_zeros:N
   }
-\cs_new:Npn \__fp_parse_operand_other:NN #1 #2
+\cs_new:Npn \__fp_parse_one_other:NN #1 #2
   {
     \if_int_compare:w
-        \__int_eval:w \tex_uccode:D `#2 / 26 = \c_three
-      \exp_after:wN \__fp_parse_operand_other_word_aux:Nw
+        \__int_eval:w
+          ( `#2 \if_int_compare:w `#2 > `Z - \c_thirty_two \fi: ) / 26
+        = \c_three
+      \exp_after:wN \__fp_parse_word:Nw
       \exp_after:wN #1
+      \exp_after:wN #2
+      \tex_romannumeral:D \exp_after:wN \__fp_parse_letters:N
       \tex_romannumeral:D
-        \exp_after:wN \__fp_parse_letters:NN
-        \exp_after:wN #2
-        \tex_romannumeral:D
     \else:
-      \exp_after:wN \__fp_parse_operand_other_prefix_aux:NNN
+      \exp_after:wN \__fp_parse_prefix:NNN
       \exp_after:wN #1
       \exp_after:wN #2
       \cs:w __fp_parse_prefix_#2:Nw \exp_after:wN \cs_end:
@@ -929,81 +958,67 @@
     \fi:
     \__fp_parse_expand:w
   }
-
-\cs_new:Npn \__fp_parse_letters:NN #1#2
-  {
-    \exp_after:wN \c_zero
-    \exp_after:wN #1
-    \tex_romannumeral:D
-      \if_int_compare:w
-          \if_catcode:w \tex_relax:D #2
-            \c_zero
-          \else:
-            \__int_eval:w \tex_uccode:D `#2 / 26
-          \fi:
-          = \c_three
-        \exp_after:wN \__fp_parse_letters:NN
-        \exp_after:wN #2
-        \tex_romannumeral:D
-        \exp_after:wN \__fp_parse_expand:w
-      \else:
-        \exp_after:wN \c_zero
-        \exp_after:wN ;
-        \exp_after:wN #2
-      \fi:
-  }
-\cs_new:Npn \__fp_parse_operand_other_word_aux:Nw #1 #2;
+\cs_new:Npn \__fp_parse_word:Nw #1#2;
   {
     \cs_if_exist_use:cF { __fp_parse_word_#2:N }
       {
         \__msg_kernel_expandable_error:nnn
           { kernel } { unknown-fp-word } {#2}
-        \exp_after:wN \c_nan_fp
-        \tex_romannumeral:D -`0
-          \__fp_parse_infix:NN
+        \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0
+        \__fp_parse_infix:NN
       }
       #1
   }
-\cs_new_eq:NN \s__fp_unknown \tex_relax:D
-\cs_new:Npn \__fp_parse_operand_other_prefix_aux:NNN #1#2#3
+\cs_new:Npn \__fp_parse_letters:N #1
   {
-    \if_meaning:w \tex_relax:D #3
-      \exp_after:wN \__fp_parse_operand_other_prefix_unknown:NNN
+    -`0
+    \if_int_compare:w
+        \if_catcode:w \scan_stop: \exp_not:N #1
+          \c_zero
+        \else:
+          \__int_eval:w
+            ( `#1 \if_int_compare:w `#1 > `Z - \c_thirty_two \fi: )
+            / 26
+        \fi:
+        = \c_three
+      \exp_after:wN #1
+      \tex_romannumeral:D \exp_after:wN \__fp_parse_letters:N
+      \tex_romannumeral:D
+    \else:
+      \__fp_parse_return_semicolon:w #1
+    \fi:
+    \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_prefix:NNN #1#2#3
+  {
+    \if_meaning:w \scan_stop: #3
+      \exp_after:wN \__fp_parse_prefix_unknown:NNN
       \exp_after:wN #2
     \fi:
     #3 #1
   }
-\cs_new:Npn \__fp_parse_operand_other_prefix_unknown:NNN #1#2#3
+\cs_new:Npn \__fp_parse_prefix_unknown:NNN #1#2#3
   {
     \cs_if_exist:cTF { __fp_parse_infix_#1:N }
       {
         \__msg_kernel_expandable_error:nnn
           { kernel } { fp-missing-number } {#1}
-        \exp_after:wN \c_nan_fp
-        \tex_romannumeral:D -`0
-          \__fp_parse_infix:NN #3 #1
+        \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0
+        \__fp_parse_infix:NN #3 #1
       }
       {
         \__msg_kernel_expandable_error:nnn
           { kernel } { fp-unknown-symbol } {#1}
-        \__fp_parse_operand:Nw #3
+        \__fp_parse_one:Nw #3
       }
   }
-\cs_new:Npn \__fp_parse_operand_digit:NN #1
-  {
-    \exp_after:wN \__fp_parse_infix_after_operand:NwN
-    \exp_after:wN #1
-    \tex_romannumeral:D -`0
-      \exp_after:wN \__fp_sanitize:wN
-      \int_use:N \__int_eval:w \c_zero \__fp_parse_trim_zeros:N
-  }
 \cs_new:Npn \__fp_parse_trim_zeros:N #1
   {
-    \if:w 0 #1
+    \if:w 0 \exp_not:N #1
       \exp_after:wN \__fp_parse_trim_zeros:N
       \tex_romannumeral:D
     \else:
-      \if:w . #1
+      \if:w . \exp_not:N #1
         \exp_after:wN \__fp_parse_strim_zeros:N
         \tex_romannumeral:D
       \else:
@@ -1025,10 +1040,9 @@
   }
 \cs_new:Npn \__fp_parse_strim_zeros:N #1
   {
-    \if:w 0 #1
+    \if:w 0 \exp_not:N #1
       - \c_one
-      \exp_after:wN \__fp_parse_strim_zeros:N
-      \tex_romannumeral:D
+      \exp_after:wN \__fp_parse_strim_zeros:N \tex_romannumeral:D
     \else:
       \__fp_parse_strim_end:w #1
     \fi:
@@ -1119,7 +1133,7 @@
           \exp_after:wN \__fp_parse_digits_vi:N
           \tex_romannumeral:D
       \else:
-        \if:w . #4
+        \if:w . \exp_not:N #4
           \exp_after:wN \__fp_parse_small_leading:wwNN
           \__int_value:w 1
             \cs:w
@@ -1151,7 +1165,7 @@
       \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww
       \int_use:N \__int_eval:w \c_seven - #3 \exp_stop_f:
       \int_use:N \__int_eval:w 1 #1
-        \if:w . #4
+        \if:w . \exp_not:N #4
           \exp_after:wN \__fp_parse_small_trailing:wwNN
           \__int_value:w 1
             \cs:w
@@ -1166,6 +1180,100 @@
     \fi:
     \__fp_parse_expand:w
   }
+\cs_new:Npn \__fp_parse_round_loop:N #1
+  {
+    \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
+      + \c_one
+      \if:w 0 \token_to_str:N #1
+        \exp_after:wN \__fp_parse_round_loop:N
+        \tex_romannumeral:D
+      \else:
+        \exp_after:wN \__fp_parse_round_up:N
+        \tex_romannumeral:D
+      \fi:
+    \else:
+      \__fp_parse_return_semicolon:w \c_zero #1
+    \fi:
+    \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_round_up:N #1
+  {
+    \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
+      + \c_one
+      \exp_after:wN \__fp_parse_round_up:N
+      \tex_romannumeral:D
+    \else:
+      \__fp_parse_return_semicolon:w \c_one #1
+    \fi:
+    \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_round_after:wN #1; #2
+  {
+    + #2 \exp_after:wN ;
+    \int_use:N \__int_eval:w #1 + \__fp_parse_exponent:N
+  }
+\cs_new:Npn \__fp_parse_small_round:NN #1#2
+  {
+    \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f:
+      +
+      \exp_after:wN \__fp_round_s:NNNw
+      \exp_after:wN 0
+      \exp_after:wN #1
+      \exp_after:wN #2
+      \int_use:N \__int_eval:w
+        \exp_after:wN \__fp_parse_round_after:wN
+        \int_use:N \__int_eval:w \c_zero * \__int_eval:w \c_zero
+          \exp_after:wN \__fp_parse_round_loop:N
+          \tex_romannumeral:D
+    \else:
+      \__fp_parse_exponent:Nw #2
+    \fi:
+    \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_large_round:NN #1#2
+  {
+    \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f:
+      +
+      \exp_after:wN \__fp_round_s:NNNw
+      \exp_after:wN 0
+      \exp_after:wN #1
+      \exp_after:wN #2
+      \int_use:N \__int_eval:w
+        \exp_after:wN \__fp_parse_large_round_aux:wNN
+        \int_use:N \__int_eval:w \c_one
+          \exp_after:wN \__fp_parse_round_loop:N
+    \else: %^^A could be dot, or e, or other
+      \exp_after:wN \__fp_parse_large_round_test:NN
+      \exp_after:wN #1
+      \exp_after:wN #2
+    \fi:
+  }
+\cs_new:Npn \__fp_parse_large_round_test:NN #1#2
+  {
+    \if:w . \exp_not:N #2
+      \exp_after:wN \__fp_parse_small_round:NN
+      \exp_after:wN #1
+      \tex_romannumeral:D
+    \else:
+      \__fp_parse_exponent:Nw #2
+    \fi:
+    \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_large_round_aux:wNN #1 ; #2 #3
+  {
+    + #2
+    \exp_after:wN \__fp_parse_round_after:wN
+    \int_use:N \__int_eval:w #1
+      \if:w . \exp_not:N #3
+        + \c_zero * \__int_eval:w \c_zero
+          \exp_after:wN \__fp_parse_round_loop:N
+          \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
+      \else:
+        \exp_after:wN ;
+        \exp_after:wN \c_zero
+        \exp_after:wN #3
+      \fi:
+  }
 \cs_new:Npn \__fp_parse_exponent:Nw #1 #2 \__fp_parse_expand:w
   {
     \exp_after:wN ;
@@ -1173,7 +1281,7 @@
   }
 \cs_new:Npn \__fp_parse_exponent:N #1
   {
-    \if:w e #1
+    \if:w e \exp_not:N #1
       \exp_after:wN \__fp_parse_exponent_aux:N
       \tex_romannumeral:D
     \else:
@@ -1183,7 +1291,7 @@
   }
 \cs_new:Npn \__fp_parse_exponent_aux:N #1
   {
-    \if_int_compare:w \if_catcode:w \tex_relax:D #1
+    \if_int_compare:w \if_catcode:w \scan_stop: \exp_not:N #1
                 \c_zero \else: `#1 \fi: > `9 \exp_stop_f:
       0 \exp_after:wN ; \exp_after:wN e
     \else:
@@ -1193,7 +1301,7 @@
   }
 \cs_new:Npn \__fp_parse_exponent_sign:N #1
   {
-    \if:w + \if:w - #1 + \fi: \token_to_str:N #1
+    \if:w + \if:w - \exp_not:N #1 + \fi: \token_to_str:N #1
       \exp_after:wN \__fp_parse_exponent_sign:N
       \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
     \else:
@@ -1230,9 +1338,10 @@
   }
 \prg_new_conditional:Npnn \__fp_parse_exponent_keep:N #1 { TF }
   {
-    \if_catcode:w \tex_relax:D #1
-      \if_meaning:w \tex_relax:D #1
-        \if_int_compare:w \pdftex_strcmp:D { \s__fp } { #1 } = \c_zero
+    \if_catcode:w \scan_stop: \exp_not:N #1
+      \if_meaning:w \scan_stop: #1
+        \if_int_compare:w
+            \pdftex_strcmp:D { \s__fp } { \exp_not:N #1 } = \c_zero
           0
           \__msg_kernel_expandable_error:nnn
             { kernel } { fp-after-e } { floating~point~ }
@@ -1262,210 +1371,70 @@
       \prg_return_true:
     \fi:
   }
-\cs_new:Npn \__fp_cfs_round_loop:N #1
-  {
-    \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
-      + \c_one
-      \if:w 0 #1
-        \exp_after:wN \__fp_cfs_round_loop:N
-        \tex_romannumeral:D
-      \else:
-        \exp_after:wN \__fp_cfs_round_up:N
-        \tex_romannumeral:D
-      \fi:
-    \else:
-      \__fp_parse_return_semicolon:w \c_zero #1
-    \fi:
-    \__fp_parse_expand:w
-  }
-\cs_new:Npn \__fp_cfs_round_up:N #1
-  {
-    \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
-      + 1
-      \exp_after:wN \__fp_cfs_round_up:N
-      \tex_romannumeral:D
-    \else:
-      \__fp_parse_return_semicolon:w \c_one #1
-    \fi:
-    \__fp_parse_expand:w
-  }
-\cs_new:Npn \__fp_parse_large_round:NN #1#2
-  {
-    \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f:
-      +
-      \exp_after:wN \__fp_round_s:NNNw
-      \exp_after:wN 0
-      \exp_after:wN #1
-      \exp_after:wN #2
-      \int_use:N \__int_eval:w
-        \exp_after:wN \__fp_parse_large_round_after:wNN
-        \int_use:N \__int_eval:w \c_one
-          \exp_after:wN \__fp_cfs_round_loop:N
-    \else: %^^A could be dot, or e, or other
-      \exp_after:wN \__fp_parse_large_round_dot_test:NNw
-      \exp_after:wN #1
-      \exp_after:wN #2
-    \fi:
-  }
-\cs_new:Npn \__fp_parse_large_round_dot_test:NNw #1#2
-  {
-    \if:w . #2
-      \exp_after:wN \__fp_parse_small_round:NN
-      \exp_after:wN #1
-      \tex_romannumeral:D
-    \else:
-      \__fp_parse_exponent:Nw #2
-    \fi:
-    \__fp_parse_expand:w
-  }
-\cs_new:Npn \__fp_parse_large_round_after:wNN #1 ; #2 #3
-  {
-    \if:w . #3
-      \exp_after:wN \__fp_parse_large_round_after_aux:wN
-      \int_use:N \__int_eval:w #1 +
-        \c_zero * \__int_eval:w \c_zero
-          \exp_after:wN \__fp_cfs_round_loop:N
-          \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
-    \else:
-      + #2
-      \exp_after:wN ;
-      \int_use:N \__int_eval:w #1 +
-        \exp_after:wN \__fp_parse_exponent:N
-        \exp_after:wN #3
-    \fi:
-  }
-\cs_new:Npn \__fp_parse_large_round_after_aux:wN #1 ; #2
-  {
-    + #2
-    \exp_after:wN ;
-    \int_use:N \__int_eval:w #1 +
-      \__fp_parse_exponent:N
-  }
-\cs_new:Npn \__fp_parse_small_round:NN #1#2
-  {
-    \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f:
-      +
-      \exp_after:wN \__fp_round_s:NNNw
-      \exp_after:wN 0
-      \exp_after:wN #1
-      \exp_after:wN #2
-      \int_use:N \__int_eval:w
-        \exp_after:wN \__fp_parse_small_round_after:wN
-        \int_use:N \__int_eval:w \c_zero
-          \exp_after:wN \__fp_cfs_round_loop:N
-          \tex_romannumeral:D
-    \else:
-      \__fp_parse_exponent:Nw #2
-    \fi:
-    \__fp_parse_expand:w
-  }
-\cs_new:Npn \__fp_parse_small_round_after:wN #1; #2
+\cs_new_eq:cN { __fp_parse_prefix_+:Nw } \__fp_parse_one:Nw
+\cs_new:Npn \__fp_parse_apply_unary:NNNwN #1#2#3#4@#5
   {
-    + #2 \exp_after:wN ;
-    \__int_value:w \__fp_parse_exponent:N
+    #3 #2 #4 @
+    \tex_romannumeral:D -`0 #5 #1
   }
-\cs_new:Npn \__fp_parse:n #1
-  {
-    \tex_romannumeral:D
-      \exp_after:wN \__fp_parse_after:ww
-      \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_minus_one
-        \__fp_parse_expand:w #1 \s__fp_mark
-      \s__fp_stop
-  }
-\cs_new:Npn \__fp_parse_after:ww #1@ #2 \s__fp_stop
+\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
   {
-    \c_zero #1
+    \cs_new:cpn { __fp_parse_prefix_ #1 :Nw } ##1
+      {
+        \exp_after:wN \__fp_parse_apply_unary:NNNwN
+        \exp_after:wN ##1
+        \exp_after:wN #4
+        \cs:w __fp_#3_o:w \exp_after:wN \cs_end:
+        \tex_romannumeral:D
+        \if_int_compare:w #2 < ##1
+          \__fp_parse_operand:Nw ##1
+        \else:
+          \__fp_parse_operand:Nw #2
+        \fi:
+        \__fp_parse_expand:w
+      }
   }
-\cs_new:Npn \__fp_parse_until:Nw #1
+\__fp_tmp:w - \c_twelve { set_sign } 2
+\__fp_tmp:w ! \c_twelve { not } ?
+\cs_new:cpn { __fp_parse_prefix_.:Nw } #1
   {
-    -`0
-    \exp_after:wN \__fp_parse_until_test:NwN
+    \exp_after:wN \__fp_parse_infix_after_operand:NwN
     \exp_after:wN #1
     \tex_romannumeral:D -`0
-    \exp_after:wN \__fp_parse_operand:Nw
-    \exp_after:wN #1
-    \tex_romannumeral:D
-  }
-\cs_new:Npn \__fp_parse_until_test:NwN #1 #2 @ #3 { #3 #1 #2 @ }
-\cs_new_eq:NN \__fp_parse_stop_until:N \use_none:n
-\cs_new:Npn \__fp_parse_infix_after_operand:NwN #1 #2;
-  {
-    \__fp_exp_after_f:nw { \__fp_parse_infix:NN #1 }
-    #2;
+      \exp_after:wN \__fp_sanitize:wN
+      \int_use:N \__int_eval:w \c_zero \__fp_parse_strim_zeros:N
   }
 \group_begin:
-  \char_set_catcode_letter:N \*
-  \cs_new:Npn \__fp_parse_infix:NN #1 #2
+  \char_set_catcode_letter:N (
+  \char_set_catcode_letter:N )
+  \cs_new:Npn \__fp_parse_prefix_(:Nw #1
     {
-      \if_catcode:w \tex_relax:D #2
-        \if_int_compare:w
-            \pdftex_strcmp:D { \s__fp_mark } { #2 }
-            = \c_zero
-          \exp_after:wN \exp_after:wN
-          \exp_after:wN \__fp_parse_infix_end:N
-        \else:
-          \exp_after:wN \exp_after:wN
-          \exp_after:wN \__fp_parse_infix_juxtapose:N
-        \fi:
+      \exp_after:wN \__fp_parse_lparen_after:NwN
+      \exp_after:wN #1
+      \tex_romannumeral:D
+      \if_int_compare:w #1 = \c_sixteen
+        \__fp_parse_operand:Nw \c_one
       \else:
-        \if_int_compare:w
-            \__int_eval:w \tex_uccode:D `#2 / 26
-            = \c_three
-          \exp_after:wN \exp_after:wN
-          \exp_after:wN \__fp_parse_infix_juxtapose:N
-        \else:
-          \exp_after:wN \__fp_parse_infix_check:NNN
-          \cs:w
-            __fp_parse_infix_#2:N
-            \exp_after:wN \exp_after:wN \exp_after:wN
-          \cs_end:
-        \fi:
+        \__fp_parse_operand:Nw \c_zero
       \fi:
-      #1
-      #2
+      \__fp_parse_expand:w
     }
-  \cs_new:Npn \__fp_parse_infix_check:NNN #1#2#3
+  \cs_new:Npn \__fp_parse_lparen_after:NwN #1#2 @ #3
     {
-      \if_meaning:w \tex_relax:D #1
-        \__msg_kernel_expandable_error:nnn { kernel } { fp-missing } { * }
-        \exp_after:wN \__fp_parse_infix_*:N
-        \exp_after:wN #2
-        \exp_after:wN #3
-      \else:
-        \exp_after:wN #1
-        \exp_after:wN #2
-        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
-      \fi:
+      \token_if_eq_meaning:NNTF #3 \__fp_parse_infix_):N
+        {
+          \__fp_exp_after_array_f:w #2 \s__fp_stop
+          \exp_after:wN \__fp_parse_infix:NN
+          \exp_after:wN #1
+          \tex_romannumeral:D \__fp_parse_expand:w
+        }
+        {
+          \__msg_kernel_expandable_error:nnn
+            { kernel } { fp-missing } { ) }
+          #2 @ \use_none:n #3
+        }
     }
 \group_end:
-\cs_new:Npn \__fp_parse_apply_binary:NwNwN #1 #2#3@ #4 #5#6@ #7
-  {
-    \exp_after:wN \__fp_parse_until_test:NwN
-    \exp_after:wN #1
-    \tex_romannumeral:D -`0
-      \cs:w
-        __fp
-        \__fp_type_from_scan:N #2
-        _ #4
-        \__fp_type_from_scan:N #5
-        _o:ww
-      \cs_end:
-      #2#3 #5#6
-    \tex_romannumeral:D -`0 #7 #1
-  }
-\cs_new:Npn \__fp_parse_apply_unary_array:NNwN #1#2#3@#4
-  {
-    #2 #3 @
-    \tex_romannumeral:D -`0 #4 #1
-  }
-\cs_new:Npn \__fp_parse_apply_unary:NNwN #1#2#3@#4
-  {
-    #2 #3
-    \tex_romannumeral:D -`0 #4 #1
-  }
-\cs_new:Npn \__fp_parse_unary_type:N #1
-  { \__fp_type_from_scan:N #1 _o:w \cs_end: #1 }
 \cs_set_protected:Npn \__fp_tmp:w #1 #2
   {
     \cs_new_nopar:cpn { __fp_parse_word_#1:N }
@@ -1477,7 +1446,6 @@
 \__fp_tmp:w { deg } \c_one_degree_fp
 \__fp_tmp:w { true } \c_one_fp
 \__fp_tmp:w { false } \c_zero_fp
-\__fp_tmp:w { pt } \c_one_fp
 \cs_set_protected:Npn \__fp_tmp:w #1 #2
   {
     \cs_new_nopar:cpn { __fp_parse_word_#1:N }
@@ -1486,6 +1454,7 @@
         \s__fp \__fp_chk:w 10 #2 ;
       }
   }
+\__fp_tmp:w {pt} { {1} {1000} {0000} {0000} {0000} }
 \__fp_tmp:w {in} { {2} {7227} {0000} {0000} {0000} }
 \__fp_tmp:w {pc} { {2} {1200} {0000} {0000} {0000} }
 \__fp_tmp:w {cm} { {2} {2845} {2755} {9055} {1181} }
@@ -1500,37 +1469,59 @@
   {
     \cs_new_nopar:cpn { __fp_parse_word_#1:N }
       {
-        \exp_after:wN \dim_to_fp:n \exp_after:wN
-          { \dim_use:N \__dim_eval:w 1 #1 \exp_after:wN }
+        \exp_after:wN \__fp_from_dim_test:ww
+        \exp_after:wN 0 \exp_after:wN ,
+        \__int_value:w \__dim_eval:w 1 #1 \exp_after:wN ;
         \tex_romannumeral:D -`0 \__fp_parse_infix:NN
       }
   }
+\cs_new:Npn \__fp_parse_unary_function:nNN #1#2#3
+  {
+    \exp_after:wN \__fp_parse_apply_unary:NNNwN
+    \exp_after:wN #3
+    \exp_after:wN #2
+    \cs:w __fp_#1_o:w \exp_after:wN \cs_end:
+    \tex_romannumeral:D
+    \__fp_parse_operand:Nw \c_fifteen \__fp_parse_expand:w
+  }
+\cs_new:Npn \__fp_parse_function:NNN #1#2#3
+  {
+    \exp_after:wN \__fp_parse_apply_unary:NNNwN
+    \exp_after:wN #3
+    \exp_after:wN #2
+    \exp_after:wN #1
+    \tex_romannumeral:D
+    \__fp_parse_operand:Nw \c_sixteen \__fp_parse_expand:w
+  }
+\cs_new_nopar:Npn \__fp_parse_word_acot:N
+  { \__fp_parse_function:NNN \__fp_acot_o:Nw \use_i:nn }
+\cs_new_nopar:Npn \__fp_parse_word_acotd:N
+  { \__fp_parse_function:NNN \__fp_acot_o:Nw \use_ii:nn }
+\cs_new_nopar:Npn \__fp_parse_word_atan:N
+  { \__fp_parse_function:NNN \__fp_atan_o:Nw \use_i:nn }
+\cs_new_nopar:Npn \__fp_parse_word_atand:N
+  { \__fp_parse_function:NNN \__fp_atan_o:Nw \use_ii:nn }
+\cs_new_nopar:Npn \__fp_parse_word_max:N
+  { \__fp_parse_function:NNN \__fp_minmax_o:Nw 2 }
+\cs_new_nopar:Npn \__fp_parse_word_min:N
+  { \__fp_parse_function:NNN \__fp_minmax_o:Nw 0 }
+\cs_new:Npn \__fp_parse_word_abs:N
+  { \__fp_parse_unary_function:nNN { set_sign } 0 }
+\cs_new_nopar:Npn \__fp_parse_word_exp:N
+  { \__fp_parse_unary_function:nNN {exp} ? }
+\cs_new_nopar:Npn \__fp_parse_word_ln:N
+  { \__fp_parse_unary_function:nNN {ln} ? }
 \tl_map_inline:nn
-  { {abs} {cos} {cot} {csc} {exp} {ln} {sec} {sin} {tan} }
   {
-    \cs_new:cpn { __fp_parse_word_#1:N } ##1
-      {
-        \exp_after:wN \__fp_parse_apply_unary:NNwN
-        \exp_after:wN ##1
-        \cs:w __fp_ #1 \exp_after:wN \__fp_parse_unary_type:N
-        \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_fifteen
-        \__fp_parse_expand:w
-      }
+    {acos} {acsc} {asec} {asin}
+    {cos} {cot} {csc} {sec} {sin} {tan}
   }
-\cs_set_protected:Npn \__fp_tmp:w #1#2
   {
-    \cs_new:Npn #1 ##1
-      {
-        \exp_after:wN \__fp_parse_apply_unary_array:NNwN
-        \exp_after:wN ##1
-        \exp_after:wN #2
-        \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_sixteen \__fp_parse_expand:w
-      }
+    \cs_new_nopar:cpn { __fp_parse_word_#1:N }
+      { \__fp_parse_unary_function:nNN {#1} \use_i:nn }
+    \cs_new_nopar:cpn { __fp_parse_word_#1d:N }
+      { \__fp_parse_unary_function:nNN {#1} \use_ii:nn }
   }
-\__fp_tmp:w \__fp_parse_word_max:N \__fp_max_o:w
-\__fp_tmp:w \__fp_parse_word_min:N \__fp_min_o:w
 \cs_new:Npn \__fp_parse_word_round:N #1#2
   {
     \if_meaning:w + #2
@@ -1548,7 +1539,7 @@
     \exp_after:wN #1
     \exp_after:wN \__fp_round_to_nearest:NNN
     \tex_romannumeral:D
-    \__fp_parse_until:Nw \c_sixteen \__fp_parse_expand:w #2
+    \__fp_parse_operand:Nw \c_sixteen \__fp_parse_expand:w #2
   }
 \cs_new:Npn \__fp_parse_round:Nw
     #1 #2 \__fp_round_to_nearest:NNN #3 \__fp_parse_expand:w #4
@@ -1565,96 +1556,199 @@
     \fi:
     -`0 #4 #1
   }
-\cs_new_eq:cN { __fp_parse_prefix_+:Nw } \__fp_parse_operand:Nw
-\cs_set_protected:Npn \__fp_tmp:w #1#2
+\cs_new:Npn \__fp_parse:n #1
   {
-    \cs_new:cpn { __fp_parse_prefix_#1:Nw } ##1
-      {
-        \exp_after:wN \__fp_parse_apply_unary:NNwN
-        \exp_after:wN ##1
-        \cs:w __fp_ #2 \exp_after:wN \__fp_parse_unary_type:N
-        \tex_romannumeral:D
-        \if_int_compare:w \c_twelve < ##1
-          \__fp_parse_until:Nw ##1
+    \tex_romannumeral:D
+      \exp_after:wN \__fp_parse_after:ww
+      \tex_romannumeral:D
+        \__fp_parse_operand:Nw \c_minus_one
+        \__fp_parse_expand:w #1 \s__fp_mark
+      \s__fp_stop
+  }
+\cs_new:Npn \__fp_parse_after:ww
+    #1@ \__fp_parse_infix_end:N \s__fp_mark \s__fp_stop
+  { \c_zero #1 }
+\cs_new:Npn \__fp_parse_operand:Nw #1
+  {
+    -`0
+    \exp_after:wN \__fp_parse_continue:NwN
+    \exp_after:wN #1
+    \tex_romannumeral:D -`0
+    \exp_after:wN \__fp_parse_one:Nw
+    \exp_after:wN #1
+    \tex_romannumeral:D
+  }
+\cs_new:Npn \__fp_parse_continue:NwN #1 #2 @ #3 { #3 #1 #2 @ }
+\cs_new:Npn \__fp_parse_apply_binary:NwNwN #1 #2@ #3 #4@ #5
+  {
+    \exp_after:wN \__fp_parse_continue:NwN
+    \exp_after:wN #1
+    \tex_romannumeral:D -`0 \cs:w __fp_#3_o:ww \cs_end: #2 #4
+    \tex_romannumeral:D -`0 #5 #1
+  }
+\cs_new:Npn \__fp_parse_infix_after_operand:NwN #1 #2;
+  {
+    \__fp_exp_after_f:nw { \__fp_parse_infix:NN #1 }
+    #2;
+  }
+\group_begin:
+  \char_set_catcode_letter:N \*
+  \cs_new:Npn \__fp_parse_infix:NN #1 #2
+    {
+      \if_catcode:w \scan_stop: \exp_not:N #2
+        \if_int_compare:w
+            \pdftex_strcmp:D { \s__fp_mark } { \exp_not:N #2 }
+            = \c_zero
+          \exp_after:wN \exp_after:wN
+          \exp_after:wN \__fp_parse_infix_end:N
         \else:
-          \__fp_parse_until:Nw \c_twelve
+          \exp_after:wN \exp_after:wN
+          \exp_after:wN \__fp_parse_infix_juxtapose:N
         \fi:
-        \__fp_parse_expand:w
-      }
-  }
-\__fp_tmp:w - { - }
-\__fp_tmp:w ! { ! }
+      \else:
+        \if_int_compare:w
+            \__int_eval:w
+              ( `#2 \if_int_compare:w `#2 > `Z - \c_thirty_two \fi: )
+              / 26
+            = \c_three
+          \exp_after:wN \exp_after:wN
+          \exp_after:wN \__fp_parse_infix_juxtapose:N
+        \else:
+          \exp_after:wN \__fp_parse_infix_check:NNN
+          \cs:w
+            __fp_parse_infix_#2:N
+            \exp_after:wN \exp_after:wN \exp_after:wN
+          \cs_end:
+        \fi:
+      \fi:
+      #1
+      #2
+    }
+  \cs_new:Npn \__fp_parse_infix_check:NNN #1#2#3
+    {
+      \if_meaning:w \scan_stop: #1
+        \__msg_kernel_expandable_error:nnn
+          { kernel } { fp-missing } { * }
+        \exp_after:wN \__fp_parse_infix_*:N
+        \exp_after:wN #2
+        \exp_after:wN #3
+      \else:
+        \exp_after:wN #1
+        \exp_after:wN #2
+        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
+      \fi:
+    }
+\group_end:
+\cs_new:Npn \__fp_parse_infix_end:N #1
+  { @ \use_none:n \__fp_parse_infix_end:N }
 \group_begin:
   \char_set_catcode_letter:N \)
-  \cs_new:cpn { __fp_parse_prefix_(:Nw } #1
+  \cs_new:Npn \__fp_parse_infix_):N #1
     {
-      \exp_after:wN \__fp_parse_lparen_after:NwN
-      \exp_after:wN #1
-      \tex_romannumeral:D
-      \if_int_compare:w #1 = \c_sixteen
-        \__fp_parse_until:Nw \c_one
+      \if_int_compare:w #1 < \c_zero
+        \__msg_kernel_expandable_error:nnn { kernel } { fp-extra } { ) }
+        \exp_after:wN \__fp_parse_infix:NN
+        \exp_after:wN #1
+        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
       \else:
-        \__fp_parse_until:Nw \c_zero
+        \exp_after:wN @
+        \exp_after:wN \use_none:n
+        \exp_after:wN \__fp_parse_infix_):N
       \fi:
-      \__fp_parse_expand:w
     }
-  \cs_new:Npn \__fp_parse_lparen_after:NwN #1#2@#3
+\group_end:
+\group_begin:
+  \char_set_catcode_letter:N \,
+  \cs_new:Npn \__fp_parse_infix_,:N #1
     {
-      \token_if_eq_meaning:NNTF #3 \__fp_parse_infix_):N
-        {
-          \__fp_exp_after_array_f:w #2 \s__fp_stop
-          \exp_after:wN \__fp_parse_infix:NN
-          \exp_after:wN #1
-          \tex_romannumeral:D \__fp_parse_expand:w
-        }
+      \if_int_compare:w #1 > \c_one
+        \exp_after:wN @
+        \exp_after:wN \use_none:n
+        \exp_after:wN \__fp_parse_infix_,:N
+      \else:
+        \if_int_compare:w #1 = \c_one
+          \exp_after:wN \__fp_parse_infix_comma:w
+          \tex_romannumeral:D
+        \else:
+          \exp_after:wN \__fp_parse_infix_comma_gobble:w
+          \tex_romannumeral:D
+        \fi:
+        \__fp_parse_operand:Nw \c_one
+        \exp_after:wN \__fp_parse_expand:w
+      \fi:
+    }
+  \cs_new:Npn \__fp_parse_infix_comma:w #1 @
+    { #1 @ \use_none:n }
+  \cs_new:Npn \__fp_parse_infix_comma_gobble:w #1 @
+    {
+      \__msg_kernel_expandable_error:nn { kernel } { fp-extra-comma }
+      @ \use_none:n
+    }
+\group_end:
+\group_begin:
+  \char_set_catcode_other:N \&
+  \char_set_catcode_letter:N \^
+  \char_set_catcode_letter:N \/
+  \char_set_catcode_letter:N \-
+  \char_set_catcode_letter:N \+
+  \cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
+    {
+      \cs_new:Npn #1 ##1
         {
-          \__msg_kernel_expandable_error:nnn { kernel } { fp-missing } { ) }
-          #2 @ \__fp_parse_stop_until:N #3
+          \if_int_compare:w ##1 < #3
+            \exp_after:wN @
+            \exp_after:wN \__fp_parse_apply_binary:NwNwN
+            \exp_after:wN #2
+            \tex_romannumeral:D
+            \__fp_parse_operand:Nw #4
+            \exp_after:wN \__fp_parse_expand:w
+          \else:
+            \exp_after:wN @
+            \exp_after:wN \use_none:n
+            \exp_after:wN #1
+          \fi:
         }
     }
+  \__fp_tmp:w \__fp_parse_infix_^:N   ^ \c_fifteen \c_fourteen
+  \__fp_tmp:w \__fp_parse_infix_/:N   / \c_ten     \c_ten
+  \__fp_tmp:w \__fp_parse_infix_mul:N * \c_ten     \c_ten
+  \__fp_tmp:w \__fp_parse_infix_-:N   - \c_nine    \c_nine
+  \__fp_tmp:w \__fp_parse_infix_+:N   + \c_nine    \c_nine
+  \__fp_tmp:w \__fp_parse_infix_and:N & \c_five    \c_five
+  \__fp_tmp:w \__fp_parse_infix_or:N  | \c_four    \c_four
 \group_end:
-\cs_new:cpn {__fp_parse_prefix_.:Nw} #1
+\cs_new:cpn { __fp_parse_infix_(:N } #1
+  { \__fp_parse_infix_juxtapose:N #1 ( }
+\cs_new:Npn \__fp_parse_infix_juxtapose:N #1
   {
-    \exp_after:wN \__fp_parse_infix_after_operand:NwN
-    \exp_after:wN #1
-    \tex_romannumeral:D -`0
-      \exp_after:wN \__fp_sanitize:wN
-      \int_use:N \__int_eval:w \c_zero \__fp_parse_strim_zeros:N
+    \if_int_compare:w #1 < \c_thirty_two
+      \exp_after:wN @
+      \exp_after:wN \__fp_parse_apply_juxtapose:NwwN
+      \tex_romannumeral:D
+      \__fp_parse_operand:Nw \c_thirty_two
+      \exp_after:wN \__fp_parse_expand:w
+    \else:
+      \exp_after:wN @
+      \exp_after:wN \use_none:n
+      \exp_after:wN \__fp_parse_infix_juxtapose:N
+    \fi:
   }
-\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
+\cs_new:Npn \__fp_parse_apply_juxtapose:NwwN #1 #2;#3@ #4;#5@
   {
-    \cs_new:Npn #1 ##1
-      {
-        \if_int_compare:w ##1 < #3
-          \exp_after:wN @
-          \exp_after:wN \__fp_parse_apply_binary:NwNwN
-          \exp_after:wN #2
-          \tex_romannumeral:D
-          \__fp_parse_until:Nw #4
-          \exp_after:wN \__fp_parse_expand:w
-        \else:
-          \exp_after:wN @
-          \exp_after:wN \__fp_parse_stop_until:N
-          \exp_after:wN #1
-        \fi:
-      }
+    \if_catcode:w ^ \tl_to_str:n { #3 #5 } ^
+    \else:
+      \__fp_error:nffn { invalid-ii }
+        { \__fp_array_to_clist:n { #2; #3 } }
+        { \__fp_array_to_clist:n { #4; #5 } }
+        { }
+    \fi:
+    \__fp_parse_apply_binary:NwNwN #1 #2;@ * #4;@
   }
-\group_begin:
-  \char_set_catcode_other:N \&
-  \__fp_tmp:w \__fp_parse_infix_juxtapose:N * \c_thirty_two \c_thirty_two
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ / :N } / \c_ten \c_ten
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_mul:N } * \c_ten \c_ten
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ - :N } - \c_nine \c_nine
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ + :N } + \c_nine \c_nine
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_and:N } & \c_five \c_five
-  \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ or:N } | \c_four \c_four
-\group_end:
 \group_begin:
   \char_set_catcode_letter:N ^
-  \__fp_tmp:w \__fp_parse_infix_^:N ^ \c_fifteen \c_fourteen
   \cs_new:cpn { __fp_parse_infix_*:N } #1#2
     {
-      \if:w * #2
+      \if:w * \exp_not:N #2
         \exp_after:wN \__fp_parse_infix_^:N
         \exp_after:wN #1
       \else:
@@ -1669,26 +1763,59 @@
   \char_set_catcode_letter:N \&
   \cs_new:Npn \__fp_parse_infix_|:N #1#2
     {
-      \if:w | #2
+      \if:w | \exp_not:N #2
         \exp_after:wN \__fp_parse_infix_|:N
         \exp_after:wN #1
         \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
       \else:
-        \exp_after:wN \__fp_parse_infix_or:N
-        \exp_after:wN #1
-        \exp_after:wN #2
+        \exp_after:wN \__fp_parse_infix_or:N
+        \exp_after:wN #1
+        \exp_after:wN #2
+      \fi:
+    }
+  \cs_new:Npn \__fp_parse_infix_&:N #1#2
+    {
+      \if:w & \exp_not:N #2
+        \exp_after:wN \__fp_parse_infix_&:N
+        \exp_after:wN #1
+        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
+      \else:
+        \exp_after:wN \__fp_parse_infix_and:N
+        \exp_after:wN #1
+        \exp_after:wN #2
+      \fi:
+    }
+\group_end:
+\group_begin:
+  \char_set_catcode_letter:N \?
+  \cs_new:Npn \__fp_parse_infix_?:N #1
+    {
+      \if_int_compare:w #1 < \c_three
+        \exp_after:wN @
+        \exp_after:wN \__fp_ternary:NwwN
+        \tex_romannumeral:D
+        \__fp_parse_operand:Nw \c_three
+        \exp_after:wN \__fp_parse_expand:w
+      \else:
+        \exp_after:wN @
+        \exp_after:wN \use_none:n
+        \exp_after:wN \__fp_parse_infix_?:N
       \fi:
     }
-  \cs_new:Npn \__fp_parse_infix_&:N #1#2
+  \cs_new:Npn \__fp_parse_infix_::N #1
     {
-      \if:w & #2
-        \exp_after:wN \__fp_parse_infix_&:N
-        \exp_after:wN #1
-        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
+      \if_int_compare:w #1 < \c_three
+        \__msg_kernel_expandable_error:nnnn
+          { kernel } { fp-missing } { ? } { ~for~?: }
+        \exp_after:wN @
+        \exp_after:wN \__fp_ternary_auxii:NwwN
+        \tex_romannumeral:D
+        \__fp_parse_operand:Nw \c_two
+        \exp_after:wN \__fp_parse_expand:w
       \else:
-        \exp_after:wN \__fp_parse_infix_and:N
-        \exp_after:wN #1
-        \exp_after:wN #2
+        \exp_after:wN @
+        \exp_after:wN \use_none:n
+        \exp_after:wN \__fp_parse_infix_::N
       \fi:
     }
 \group_end:
@@ -1729,14 +1856,14 @@
       \exp_after:wN \__fp_parse_infix_excl_error:
     \else:
       \exp_after:wN @
-      \exp_after:wN \__fp_parse_stop_until:N
+      \exp_after:wN \use_none:n
       \exp_after:wN \__fp_infix_compare:N
     \fi:
   }
 \cs_new:Npn \__fp_parse_compare:NNNNNNw #1#2#3#4#5#6#7
   {
     \if_case:w
-          \if_catcode:w \tex_relax:D #7
+          \if_catcode:w \scan_stop: #7
             \c_minus_one
           \else:
             \__int_eval:w `#7 - `< \__int_eval_end:
@@ -1769,11 +1896,11 @@
     \exp_after:wN #3
     \exp_after:wN #4
     \tex_romannumeral:D
-    \__fp_parse_until:Nw \c_seven \__fp_parse_expand:w #5
+    \__fp_parse_operand:Nw \c_seven \__fp_parse_expand:w #5
   }
 \cs_new:Npn \__fp_parse_apply_compare:NwNNNNwN #1 #2@ #3#4#5#6 #7@ #8
   {
-    \exp_after:wN \__fp_parse_until_test:NwN
+    \exp_after:wN \__fp_parse_continue:NwN
     \exp_after:wN #1
     \tex_romannumeral:D -`0
       \exp_after:wN \exp_after:wN
@@ -1787,85 +1914,6 @@
       \fi:
     \tex_romannumeral:D -`0 #8 #1
   }
-\group_begin:
-  \char_set_catcode_letter:N \?
-  \cs_new:Npn \__fp_parse_infix_?:N #1
-    {
-      \if_int_compare:w #1 < \c_three
-        \exp_after:wN @
-        \exp_after:wN \__fp_ternary:NwwN
-        \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_three
-        \exp_after:wN \__fp_parse_expand:w
-      \else:
-        \exp_after:wN @
-        \exp_after:wN \__fp_parse_stop_until:N
-        \exp_after:wN \__fp_parse_infix_?:N
-      \fi:
-    }
-  \cs_new:Npn \__fp_parse_infix_::N #1
-    {
-      \if_int_compare:w #1 < \c_three
-        \__msg_kernel_expandable_error:nnnn
-          { kernel } { fp-missing } { ? } { ~for~?: }
-        \exp_after:wN @
-        \exp_after:wN \__fp_ternary_auxii:NwwN
-        \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_two
-        \exp_after:wN \__fp_parse_expand:w
-      \else:
-        \exp_after:wN @
-        \exp_after:wN \__fp_parse_stop_until:N
-        \exp_after:wN \__fp_parse_infix_::N
-      \fi:
-    }
-\group_end:
-\group_begin:
-  \char_set_catcode_letter:N \)
-  \cs_new:Npn \__fp_parse_infix_):N #1
-    {
-      \if_int_compare:w #1 < \c_zero
-        \__msg_kernel_expandable_error:nnn { kernel } { fp-extra } { ) }
-        \exp_after:wN \__fp_parse_infix:NN
-        \exp_after:wN #1
-        \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w
-      \else:
-        \exp_after:wN @
-        \exp_after:wN \__fp_parse_stop_until:N
-        \exp_after:wN \__fp_parse_infix_):N
-      \fi:
-    }
-\group_end:
-\cs_new:Npn \__fp_parse_infix_end:N #1
-  { @ \__fp_parse_stop_until:N \__fp_parse_infix_end:N }
-\group_begin:
-  \char_set_catcode_letter:N \,
-  \cs_new:Npn \__fp_parse_infix_,:N #1
-    {
-      \if_int_compare:w #1 > \c_one
-        \exp_after:wN @
-        \exp_after:wN \__fp_parse_stop_until:N
-        \exp_after:wN \__fp_parse_infix_,:N
-      \else:
-        \if_int_compare:w #1 = \c_one
-          \exp_after:wN \__fp_parse_infix_comma:w
-          \tex_romannumeral:D
-        \else:
-          \exp_after:wN \__fp_parse_infix_comma_gobble:w
-          \tex_romannumeral:D
-        \fi:
-        \__fp_parse_until:Nw \c_one
-        \exp_after:wN \__fp_parse_expand:w
-      \fi:
-    }
-  \cs_new:Npn \__fp_parse_infix_comma:w #1 @
-    { #1 @ \__fp_parse_stop_until:N }
-  \cs_new:Npn \__fp_parse_infix_comma_gobble:w #1 @
-    {
-      \__msg_kernel_expandable_error:nn { kernel } { fp-extra-comma }
-      @ \__fp_parse_stop_until:N
-    }
-\group_end:
 \__msg_kernel_new:nnn { kernel } { unknown-fp-word }
   { Unknown~fp~word~#1. }
 \__msg_kernel_new:nnn { kernel } { fp-missing }
@@ -1884,7 +1932,7 @@
   { Unexpected~comma:~extra~arguments~ignored. }
 \__msg_kernel_new:nnn { kernel } { fp-num-args }
   { #1~expects~between~#2~and~#3~arguments. }
-%% File: l3fp-logic.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-logic.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -2052,20 +2100,15 @@
         \fp_while_do:nNnn {#1} #2 {#3} {#4}
       }
   }
-\cs_new:Npn \__fp_max_o:w #1 @
-  {
-    \exp_after:wN \__fp_minmax_loop:Nww
-    \exp_after:wN \c_minus_one
-    \c_minus_inf_fp
-    #1
-    \s__fp \__fp_chk:w { 3 \__fp_minmax_break_o:w } ;
-  }
-\cs_new:Npn \__fp_min_o:w #1 @
+\cs_new:Npn \__fp_minmax_o:Nw #1#2 @
   {
-    \exp_after:wN \__fp_minmax_loop:Nww
-    \exp_after:wN \c_one
-    \c_inf_fp
-    #1
+    \if_meaning:w 0 #1
+      \exp_after:wN \__fp_minmax_loop:Nww \exp_after:wN \c_one
+    \else:
+      \exp_after:wN \__fp_minmax_loop:Nww \exp_after:wN \c_minus_one
+    \fi:
+    #2
+    \s__fp \__fp_chk:w 2 #1 \s__fp_exact ;
     \s__fp \__fp_chk:w { 3 \__fp_minmax_break_o:w } ;
   }
 \cs_new:Npn \__fp_minmax_loop:Nww
@@ -2098,9 +2141,9 @@
   { \fi: \fi: #2 }
 \cs_new:Npn \__fp_minmax_break_o:w #1 \fi: \fi: #2 \s__fp #3; #4;
   { \fi: \__fp_exp_after_o:w \s__fp #3; }
-\cs_new:cpn { __fp_!_o:w } \s__fp \__fp_chk:w #1#2;
+\cs_new:cpn { __fp_not_o:w } #1 \s__fp \__fp_chk:w #2#3; @
   {
-    \if_meaning:w 0 #1
+    \if_meaning:w 0 #2
       \exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp
     \else:
       \exp_after:wN \exp_after:wN \exp_after:wN \c_zero_fp
@@ -2131,12 +2174,12 @@
       \__fp_exp_after_array_f:w #3 \s__fp_stop
       \exp_after:wN @
       \tex_romannumeral:D
-        \__fp_parse_until:Nw \c_two
+        \__fp_parse_operand:Nw \c_two
         \__fp_parse_expand:w
     \else:
       \__msg_kernel_expandable_error:nnnn
         { kernel } { fp-missing } { : } { ~for~?: }
-      \exp_after:wN \__fp_parse_until_test:NwN
+      \exp_after:wN \__fp_parse_continue:NwN
       \exp_after:wN #1
       \tex_romannumeral:D -`0
       \__fp_exp_after_array_f:w #3 \s__fp_stop
@@ -2159,7 +2202,7 @@
 \cs_new:Npn \__fp_ternary_map_break: #1 \__fp_ternary_break_point:n #2 {#2}
 \cs_new:Npn \__fp_ternary_auxi:NwwN #1#2@#3@#4
   {
-    \exp_after:wN \__fp_parse_until_test:NwN
+    \exp_after:wN \__fp_parse_continue:NwN
     \exp_after:wN #1
     \tex_romannumeral:D -`0
     \__fp_exp_after_array_f:w #2 \s__fp_stop
@@ -2167,13 +2210,13 @@
   }
 \cs_new:Npn \__fp_ternary_auxii:NwwN #1#2@#3@#4
   {
-    \exp_after:wN \__fp_parse_until_test:NwN
+    \exp_after:wN \__fp_parse_continue:NwN
     \exp_after:wN #1
     \tex_romannumeral:D -`0
     \__fp_exp_after_array_f:w #3 \s__fp_stop
     #4 #1
   }
-%% File: l3fp-basics.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-basics.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -2781,23 +2824,17 @@
         \__int_value:w \__fp_round_digit:Nw #7 #8 ;
       \exp_after:wN ;
   }
-\cs_new:cpn { __fp_-_o:w } #1 \s__fp \__fp_chk:w #2 #3
+\cs_new:Npn \__fp_set_sign_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
     \exp_after:wN \__fp_exp_after_o:w
     \exp_after:wN \s__fp
     \exp_after:wN \__fp_chk:w
     \exp_after:wN #2
-    \int_use:N \__int_eval:w \c_two - #3 \__int_eval_end:
-  }
-\cs_new:Npn \__fp_abs_o:w \s__fp \__fp_chk:w #1 #2
-  {
-    \exp_after:wN \__fp_exp_after_o:w
-    \exp_after:wN \s__fp
-    \exp_after:wN \__fp_chk:w
-    \exp_after:wN #1
-    \__int_value:w \if_meaning:w 1 #2 1 \else: 0 \fi: \exp_stop_f:
+    \__int_value:w
+      \if_case:w #3 \exp_stop_f: #1 \or: 1 \or: 0 \fi: \exp_stop_f:
+    #4;
   }
-%% File: l3fp-extended.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-extended.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -2838,7 +2875,39 @@
     \exp_after:wN #3 \exp_after:wN
       { \int_use:N \__int_eval:w \c_ten_thousand + #1 } #2 ;
   }
+\cs_new:Npn \__fp_fixed_div_myriad:wn #1#2#3#4#5#6; #7
+  {
+    \exp_after:wN \__fp_fixed_mul_after:wn
+    \int_use:N \__int_eval:w \c__fp_leading_shift_int
+      \exp_after:wN \__fp_pack:NNNNNwn
+      \int_use:N \__int_eval:w \c__fp_trailing_shift_int
+        + #1 ; {#7} {#2}{#3}{#4}{#5};
+  }
 \cs_new:Npn \__fp_fixed_mul_after:wn #1; #2 { #2 {#1} }
+\cs_new:Npn \__fp_fixed_mul_short:wwn #1#2#3#4#5#6; #7#8#9;
+  {
+    \exp_after:wN \__fp_fixed_mul_after:wn
+    \int_use:N \__int_eval:w \c__fp_leading_shift_int
+      + #1*#7
+      \exp_after:wN \__fp_pack:NNNNNwn
+      \int_use:N \__int_eval:w \c__fp_middle_shift_int
+        + #1*#8 + #2*#7
+        \exp_after:wN \__fp_pack:NNNNNwn
+        \int_use:N \__int_eval:w \c__fp_middle_shift_int
+          + #1*#9 + #2*#8 + #3*#7
+          \exp_after:wN \__fp_pack:NNNNNwn
+          \int_use:N \__int_eval:w \c__fp_middle_shift_int
+            + #2*#9 + #3*#8 + #4*#7
+            \exp_after:wN \__fp_pack:NNNNNwn
+            \int_use:N \__int_eval:w \c__fp_middle_shift_int
+              + #3*#9 + #4*#8 + #5*#7
+              \exp_after:wN \__fp_pack:NNNNNwn
+              \int_use:N \__int_eval:w \c__fp_trailing_shift_int
+                + #4*#9 + #5*#8 + #6*#7
+                + ( #5*#9 + #6*#8 + #6*#9 / \c_ten_thousand )
+                / \c_ten_thousand
+                \exp_after:wN ; \__fp_use_braced_s:n
+  }
 \cs_new:Npn \__fp_fixed_div_int:wwN #1#2#3#4#5#6 ; #7 ; #8
   {
     \exp_after:wN \__fp_fixed_div_int_after:Nw
@@ -2977,10 +3046,213 @@
     #9 (#4* #1 *#7)
     #9 (#5*#6+#4* #2 *#7+#3*#8) / \c_ten_thousand
   }
+\cs_new:Npn \__fp_ep_to_fixed:wwn #1,#2
+  {
+    \exp_after:wN \__fp_ep_to_fixed_auxi:www
+    \int_use:N \__int_eval:w 1 0000 0000 + #2 \exp_after:wN ;
+    \tex_romannumeral:D -`0
+    \prg_replicate:nn { \c_four - \int_max:nn {#1} { -32 } } { 0 } ;
+  }
+\cs_new:Npn \__fp_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7;
+  {
+    \__fp_pack_eight:wNNNNNNNN
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_ep_to_fixed_auxii:nnnnnnnwn ;
+    #2 #1#3#4#5#6#7 0000 !
+  }
+\cs_new:Npn \__fp_ep_to_fixed_auxii:nnnnnnnwn #1#2#3#4#5#6#7; #8! #9
+  { #9 {#1#2}{#3}{#4}{#5}{#6}{#7}; }
+\cs_new:Npn \__fp_ep_to_ep:wwN #1,#2#3#4#5#6#7; #8
+  {
+    \exp_after:wN #8
+    \int_use:N \__int_eval:w #1 + \c_four
+      \exp_after:wN \use_i:nn
+      \exp_after:wN \__fp_ep_to_ep_loop:N
+      \int_use:N \__int_eval:w 1 0000 0000 + #2 \__int_eval_end:
+      #3#4#5#6#7 ; ; !
+  }
+\cs_new:Npn \__fp_ep_to_ep_loop:N #1
+  {
+    \if_meaning:w 0 #1
+      - \c_one
+    \else:
+      \__fp_ep_to_ep_end:www #1
+    \fi:
+    \__fp_ep_to_ep_loop:N
+  }
+\cs_new:Npn \__fp_ep_to_ep_end:www
+    #1 \fi: \__fp_ep_to_ep_loop:N #2; #3!
+  {
+    \fi:
+    \if_meaning:w ; #1
+      - \c_two * \c__fp_max_exponent_int
+      \__fp_ep_to_ep_zero:ww
+    \fi:
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_pack_twice_four:wNNNNNNNN
+    \__fp_use_i:ww , ;
+    #1 #2 0000 0000 0000 0000 0000 0000 ;
+  }
+\cs_new:Npn \__fp_ep_to_ep_zero:ww \fi: #1; #2; #3;
+  { \fi: , {1000}{0000}{0000}{0000}{0000}{0000} ; }
+\cs_new:Npn \__fp_ep_compare:wwww #1,#2#3#4#5#6#7;
+  { \__fp_ep_compare_aux:wwww {#1}{#2}{#3}{#4}{#5}; #6#7; }
+\cs_new:Npn \__fp_ep_compare_aux:wwww #1;#2;#3,#4#5#6#7#8#9;
+  {
+    \if_case:w
+      \__fp_compare_npos:nwnw #1; {#3}{#4}{#5}{#6}{#7}; \exp_stop_f:
+            \if_int_compare:w #2 = #8#9 \exp_stop_f:
+              0
+            \else:
+              \if_int_compare:w #2 < #8#9 - \fi: 1
+            \fi:
+    \or:    1
+    \else: -1
+    \fi:
+  }
+\cs_new:Npn \__fp_ep_mul:wwwwn #1,#2; #3,#4;
+  {
+    \__fp_ep_to_ep:wwN #3,#4;
+    \__fp_fixed_continue:wn
+    {
+      \__fp_ep_to_ep:wwN #1,#2;
+      \__fp_ep_mul_raw:wwwwN
+    }
+    \__fp_fixed_continue:wn
+  }
+\cs_new:Npn \__fp_ep_mul_raw:wwwwN #1,#2; #3,#4; #5
+  {
+    \__fp_fixed_mul:wwn #2; #4;
+    { \exp_after:wN #5 \int_use:N \__int_eval:w #1 + #3 , }
+  }
+\cs_new:Npn \__fp_ep_div:wwwwn #1,#2; #3,#4;
+  {
+    \__fp_ep_to_ep:wwN #1,#2;
+    \__fp_fixed_continue:wn
+    {
+      \__fp_ep_to_ep:wwN #3,#4;
+      \__fp_ep_div_esti:wwwwn
+    }
+  }
+\cs_new:Npn \__fp_ep_div_esti:wwwwn #1,#2#3; #4,
+  {
+    \exp_after:wN \__fp_ep_div_estii:wwnnwwn
+    \int_use:N \__int_eval:w 10 0000 0000 / ( #2 + \c_one )
+      \exp_after:wN ;
+    \int_use:N \__int_eval:w #4 - #1 + \c_one ,
+    {#2} #3;
+  }
+\cs_new:Npn \__fp_ep_div_estii:wwnnwwn #1; #2,#3#4#5; #6; #7
+  {
+    \exp_after:wN \__fp_ep_div_estiii:NNNNNwwwn
+    \int_use:N \__int_eval:w 10 0000 0000 - 1750
+      + #1 000 + (10 0000 0000 / #3 - #1) * (1000 - #4 / 10) ;
+    {#3}{#4}#5; #6; { #7 #2, }
+  }
+\cs_new:Npn \__fp_ep_div_estiii:NNNNNwwwn 1#1#2#3#4#5#6; #7;
+  {
+    \__fp_fixed_mul_short:wwn #7; {#1}{#2#3#4#5}{#6};
+    \__fp_ep_div_epsi:wnNNNNNn {#1#2#3#4}#5#6
+    \__fp_fixed_mul:wwn
+  }
+\cs_new:Npn \__fp_ep_div_epsi:wnNNNNNn #1#2#3#4#5#6;
+  {
+    \exp_after:wN \__fp_ep_div_epsii:wwnNNNNNn
+    \int_use:N \__int_eval:w 1 9998 - #2
+      \exp_after:wN \__fp_ep_div_eps_pack:NNNNNw
+      \int_use:N \__int_eval:w 1 9999 9998 - #3#4
+        \exp_after:wN \__fp_ep_div_eps_pack:NNNNNw
+        \int_use:N \__int_eval:w 2 0000 0000 - #5#6 ; ;
+  }
+\cs_new:Npn \__fp_ep_div_eps_pack:NNNNNw #1#2#3#4#5#6;
+  { + #1 ; {#2#3#4#5} {#6} }
+\cs_new:Npn \__fp_ep_div_epsii:wwnNNNNNn 1#1; #2; #3#4#5#6#7#8
+  {
+    \__fp_fixed_mul:wwn {0000}{#1}#2; {0000}{#1}#2;
+    \__fp_fixed_add_one:wN
+    \__fp_fixed_mul:wwn {10000} {#1} #2 ;
+    {
+      \__fp_fixed_mul_short:wwn {0000}{#1}#2; {#3}{#4#5#6#7}{#8000};
+      \__fp_fixed_div_myriad:wn
+      \__fp_fixed_mul:wwn
+    }
+    \__fp_fixed_add:wwn {#3}{#4#5#6#7}{#8000}{0000}{0000}{0000};
+  }
+\cs_new:Npn \__fp_ep_isqrt:wwn #1,#2;
+  {
+    \__fp_ep_to_ep:wwN #1,#2;
+    \__fp_ep_isqrt_auxi:wwn
+  }
+\cs_new:Npn \__fp_ep_isqrt_auxi:wwn #1,
+  {
+    \exp_after:wN \__fp_ep_isqrt_auxii:wwnnnwn
+    \int_use:N \__int_eval:w
+      \int_if_odd:nTF {#1}
+        { (\c_one - #1) / \c_two , 535 , { 0 } { } }
+        { \c_one - #1 / \c_two , 168 , { } { 0 } }
+  }
+\cs_new:Npn \__fp_ep_isqrt_auxii:wwnnnwn #1, #2, #3#4 #5#6; #7
+  {
+    \__fp_ep_isqrt_esti:wwwnnwn #2, 0, #5, {#3} {#4}
+      {#5} #6 ; { #7 #1 , }
+  }
+\cs_new:Npn \__fp_ep_isqrt_esti:wwwnnwn #1, #2, #3, #4
+  {
+    \if_int_compare:w #1 = #2 \exp_stop_f:
+      \exp_after:wN \__fp_ep_isqrt_estii:wwwnnwn
+    \fi:
+    \exp_after:wN \__fp_ep_isqrt_esti:wwwnnwn
+    \int_use:N \__int_eval:w
+      (#1 + 1 0050 0000 #4 / (#1 * #3)) / \c_two ,
+    #1, #3, {#4}
+  }
+\cs_new:Npn \__fp_ep_isqrt_estii:wwwnnwn #1, #2, #3, #4#5
+  {
+    \exp_after:wN \__fp_ep_isqrt_estiii:NNNNNwwwn
+    \int_use:N \__int_eval:w 1000 0000 + #2 * #2 #5 * \c_five
+      \exp_after:wN , \int_use:N \__int_eval:w 10000 + #2 ;
+  }
+\cs_new:Npn \__fp_ep_isqrt_estiii:NNNNNwwwn 1#1#2#3#4#5#6, 1#7#8; #9;
+  {
+    \__fp_fixed_mul_short:wwn #9; {#1} {#2#3#4#5} {#600} ;
+    \__fp_ep_isqrt_epsi:wN
+    \__fp_fixed_mul_short:wwn {#7} {#80} {0000} ;
+  }
+\cs_new:Npn \__fp_ep_isqrt_epsi:wN #1;
+  {
+    \__fp_fixed_sub:wwn {15000}{0000}{0000}{0000}{0000}{0000}; #1;
+    \__fp_ep_isqrt_epsii:wwN #1;
+    \__fp_ep_isqrt_epsii:wwN #1;
+    \__fp_ep_isqrt_epsii:wwN #1;
+  }
+\cs_new:Npn \__fp_ep_isqrt_epsii:wwN #1; #2;
+  {
+    \__fp_fixed_mul:wwn #1; #1;
+    \__fp_fixed_mul_sub_back:wwwn #2;
+      {15000}{0000}{0000}{0000}{0000}{0000};
+    \__fp_fixed_mul:wwn #1;
+  }
+\cs_new:Npn \__fp_ep_to_float:wwN #1,
+  { + \__int_eval:w #1 \__fp_fixed_to_float:wN }
+\cs_new:Npn \__fp_ep_inv_to_float:wwN #1,#2;
+  {
+    \__fp_ep_div:wwwwn 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1,#2;
+    \__fp_ep_to_float:wwN
+  }
+\cs_new:Npn \__fp_fixed_inv_to_float:wN
+  { \__fp_ep_inv_to_float:wwN 0, }
+\cs_new:Npn \__fp_fixed_to_float_rad:wN #1;
+  {
+    \__fp_fixed_mul:wwn #1; {5729}{5779}{5130}{8232}{0876}{7981};
+    { \__fp_ep_to_float:wwN 2, }
+  }
 \cs_new:Npn \__fp_fixed_to_float:Nw #1#2; { \__fp_fixed_to_float:wN #2; #1 }
 \cs_new:Npn \__fp_fixed_to_float:wN #1#2#3#4#5#6; #7
   {
-    + \c_four % for the 8-digit-at-the-start thing.
+    + \__int_eval:w \c_four % for the 8-digit-at-the-start thing.
     \exp_after:wN \exp_after:wN
     \exp_after:wN \__fp_fixed_to_loop:N
     \exp_after:wN \use_none:n
@@ -3033,111 +3305,7 @@
       \exp_after:wN \__fp_basics_pack_low:NNNNNw
       \int_use:N \__int_eval:w 1 #3#4 + \c_one ;
   }
-\cs_new:Npn \__fp_fixed_inv_to_float:wN #1#2; #3
-  {
-    + \__int_eval:w % ^^A todo: remove the +?
-        \if_int_compare:w #1 < \c_one_thousand
-          \__fp_fixed_dtf_zeros:wNnnnnnn
-        \fi:
-        \__fp_fixed_dtf_no_zero:Nwn + {#1} #2 \s__fp
-        \__fp_fixed_dtf_approx:n
-        {10000} {0000} {0000} {0000} {0000} {0000} ;
-  }
-\cs_new:Npn \__fp_fixed_div_to_float:ww #1#2; #3#4;
-  {
-    \if_int_compare:w #1 < \c_one_thousand
-      \__fp_fixed_dtf_zeros:wNnnnnnn
-    \fi:
-    \__fp_fixed_dtf_no_zero:Nwn - {#1} #2 \s__fp
-    {
-      \if_int_compare:w #3 < \c_one_thousand
-        \__fp_fixed_dtf_zeros:wNnnnnnn
-      \fi:
-      \__fp_fixed_dtf_no_zero:Nwn + {#3} #4 \s__fp
-      \__fp_fixed_dtf_approx:n
-    }
-  }
-\cs_new:Npn \__fp_fixed_dtf_no_zero:Nwn #1#2 \s__fp #3 { #3 #2; }
-\cs_new:Npn \__fp_fixed_dtf_zeros:wNnnnnnn
-    \fi: \__fp_fixed_dtf_no_zero:Nwn #1#2#3#4#5#6#7
-  {
-    \fi:
-    #1 \c_minus_one
-    \exp_after:wN \use_i_ii:nnn
-    \exp_after:wN \__fp_fixed_dtf_zeros:NN
-    \exp_after:wN #1
-    \int_use:N \__int_eval:w 10 0000 + #2 \__int_eval_end: #3#4#5#6#7
-    ; 1 ;
-  }
-\cs_new:Npn \__fp_fixed_dtf_zeros:NN #1#2
-  {
-    \if_meaning:w 0 #2
-      #1 \c_one
-    \else:
-      \__fp_fixed_dtf_zeros_end:wNww #2
-    \fi:
-    \__fp_fixed_dtf_zeros:NN #1
-  }
-\cs_new:Npn \__fp_fixed_dtf_zeros_end:wNww
-    #1 \fi: \__fp_fixed_dtf_zeros:NN #2 #3; #4 \s__fp
-  {
-    \fi:
-    \if_meaning:w ; #1
-      #2 \c_two * \c__fp_max_exponent_int
-      \use_i_ii:nnn
-    \fi:
-    \__fp_fixed_dtf_zeros_auxi:ww
-    #1#3 0000 0000 0000 0000 0000 0000 ;
-  }
-\cs_new:Npn \__fp_fixed_dtf_zeros_auxi:ww
-  {
-    \__fp_pack_twice_four:wNNNNNNNN
-    \__fp_pack_twice_four:wNNNNNNNN
-    \__fp_pack_twice_four:wNNNNNNNN
-    \__fp_fixed_dtf_zeros_auxii:ww
-    ;
-  }
-\cs_new:Npn \__fp_fixed_dtf_zeros_auxii:ww #1; #2; #3 { #3 #1; }
-\cs_new:Npn \__fp_fixed_dtf_approx:n #1
-  {
-    \exp_after:wN \__fp_fixed_dtf_approx:wnn
-    \int_use:N \__int_eval:w 10 0000 0000 / ( #1 + \c_one ) ;
-    {#1}
-  }
-\cs_new:Npn \__fp_fixed_dtf_approx:wnn #1; #2#3
-  {
-    \exp_after:wN \__fp_fixed_dtf_approx:NNNNNw
-    \int_use:N \__int_eval:w 10 0000 0000 - 1750
-      + #1000 + (10 0000 0000/#2-#1) * (1000-#3/10) ;
-    {#2}{#3}
-  }
-\cs_new:Npn \__fp_fixed_dtf_approx:NNNNNw 1#1#2#3#4#5#6; #7; #8;
-  {
-    + \c_four % because of the line below "dtf_epsilon" here.
-    \__fp_fixed_mul:wwn {000#1}{#2#3#4#5}{#6}{0000}{0000}{0000} ; #7;
-    \__fp_fixed_dtf_epsilon:wN
-    \__fp_fixed_mul:wwn {000#1}{#2#3#4#5}{#6}{0000}{0000}{0000} ;
-    \__fp_fixed_mul:wwn #8;
-    \__fp_fixed_to_float:wN ?
-  }
-\cs_new:Npn \__fp_fixed_dtf_epsilon:wN #1#2#3#4#5#6;
-  {
-    \exp_after:wN \__fp_fixed_dtf_epsilon:NNNNNww
-    \int_use:N \__int_eval:w 1 9999 9998 - #3#4 +
-      \exp_after:wN \__fp_fixed_dtf_epsilon_pack:NNNNNw
-      \int_use:N \__int_eval:w 2 0000 0000 - #5#6 ; {0000} ;
-  }
-\cs_new:Npn \__fp_fixed_dtf_epsilon_pack:NNNNNw #1#2#3#4#5#6;
-  { #1 ; {#2#3#4#5} {#6} }
-\cs_new:Npn \__fp_fixed_dtf_epsilon:NNNNNww #1#2#3#4#5#6; #7;
-  {
-    \__fp_fixed_mul:wwn %^^A todo: optimize to use \__fp_mul_significand.
-      {0000} {#2#3#4#5} {#6} #7 ;
-      {0000} {#2#3#4#5} {#6} #7 ;
-    \__fp_fixed_add_one:wN
-    \__fp_fixed_mul:wwn {10000} {#2#3#4#5} {#6} #7 ;
-  }
-%% File: l3fp-expo.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-expo.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -3179,19 +3347,19 @@
 \tl_const:Nn \c__fp_ln_viii_fixed_tl{{20794}{4154}{1679}{8359}{2825}{1696} }
 \tl_const:Nn \c__fp_ln_ix_fixed_tl  {{21972}{2457}{7336}{2193}{8279}{0490} }
 \tl_const:Nn \c__fp_ln_x_fixed_tl   {{23025}{8509}{2994}{0456}{8401}{7991} }
-\cs_new:Npn \__fp_ln_o:w \s__fp \__fp_chk:w #1 #2
+\cs_new:Npn \__fp_ln_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_meaning:w 2 #2
+    \if_meaning:w 2 #3
       \__fp_case_use:nw { \__fp_invalid_operation_o:nw { ln } }
     \fi:
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
       \__fp_case_use:nw
         { \__fp_division_by_zero_o:Nnw \c_minus_inf_fp { ln } }
     \or:
     \else:
       \__fp_case_return_same_o:w
     \fi:
-    \__fp_ln_npos_o:w \s__fp \__fp_chk:w #1#2
+    \__fp_ln_npos_o:w \s__fp \__fp_chk:w #2#3#4;
   }
 \cs_new:Npn \__fp_ln_npos_o:w \s__fp \__fp_chk:w 10#1#2#3;
   { %^^A todo: ln(1) should be "exact zero", not "underflow"
@@ -3400,14 +3568,14 @@
       {0000}{#4}{#5}{#6}{#7}{#8};
     \__fp_fixed_to_float:wN #1
   }
-\cs_new:Npn \__fp_exp_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_exp_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
       \__fp_case_return_o:Nw \c_one_fp
     \or:
       \exp_after:wN \__fp_exp_normal:w
     \or:
-      \if_meaning:w 0 #2
+      \if_meaning:w 0 #3
         \exp_after:wN \__fp_case_return_o:Nw
         \exp_after:wN \c_inf_fp
       \else:
@@ -3417,7 +3585,7 @@
     \or:
       \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2#3#4;
   }
 \cs_new:Npn \__fp_exp_normal:w \s__fp \__fp_chk:w 1#1
   {
@@ -3783,7 +3951,7 @@
 \cs_new:Npn \__fp_pow_neg:www \s__fp \__fp_chk:w #1#2; #3; #4;
   {
     \if_case:w \__fp_pow_neg_case:w #4 ;
-      \cs:w __fp_-_o:w \exp_after:wN \cs_end:
+      \exp_after:wN \__fp_pow_neg_aux:wNN
     \or:
       \if_int_compare:w \__int_eval:w #1 / \c_two = \c_one
         \__fp_invalid_operation_o:Nww ^ #3; #4;
@@ -3795,6 +3963,14 @@
     \__fp_exp_after_o:w
     \s__fp \__fp_chk:w #1#2;
   }
+\cs_new:Npn \__fp_pow_neg_aux:wNN #1 \s__fp \__fp_chk:w #2#3
+  {
+    \exp_after:wN \__fp_exp_after_o:w
+    \exp_after:wN \s__fp
+    \exp_after:wN \__fp_chk:w
+    \exp_after:wN #2
+    \int_use:N \__int_eval:w \c_two - #3 \__int_eval_end:
+  }
 \cs_new:Npn \__fp_pow_neg_case:w \s__fp \__fp_chk:w #1#2#3;
   {
     \if_case:w #1 \exp_stop_f:
@@ -3839,7 +4015,7 @@
       \c_one
     \fi:
   }
-%% File: l3fp-trig.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-trig.dtx Copyright (C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -3872,203 +4048,418 @@
 %%
 %% -----------------------------------------------------------------------
 %%
-\cs_new:Npn \__fp_sin_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_sin_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
            \__fp_case_return_same_o:w
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_o:w
-            \__fp_sin_series:NNwww \__fp_fixed_to_float:wN #2 \c_zero
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sin } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
+               \__fp_ep_to_float:wwN #3 \c_zero
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { sin } { sind } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3 #4;
   }
-\cs_new:Npn \__fp_cos_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_cos_o:w #1 \s__fp \__fp_chk:w #2#3; @
   {
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
            \__fp_case_return_o:Nw \c_one_fp
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_one_o:w
-            \__fp_sin_series:NNwww \__fp_fixed_to_float:wN 0 \c_two
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cos } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
+               \__fp_ep_to_float:wwN 0 \c_two
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { cos } { cosd } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3;
   }
-\cs_new:Npn \__fp_csc_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_csc_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_case:w #1 \exp_stop_f:
-           \__fp_cot_zero_o:Nnw #2 { csc }
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_inv_o:w
-            \__fp_sin_series:NNwww \__fp_fixed_inv_to_float:wN #2 \c_zero
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { csc } }
+    \if_case:w #2 \exp_stop_f:
+           \__fp_cot_zero_o:Nfw #3 { #1 { csc } { cscd } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
+               \__fp_ep_inv_to_float:wwN #3 \c_zero
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { csc } { cscd } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3 #4;
   }
-\cs_new:Npn \__fp_sec_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_sec_o:w #1 \s__fp \__fp_chk:w #2#3; @
   {
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
            \__fp_case_return_o:Nw \c_one_fp
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_one_o:w
-            \__fp_sin_series:NNwww \__fp_fixed_inv_to_float:wN 0 \c_two
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sec } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
+               \__fp_ep_inv_to_float:wwN 0 \c_two
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { sec } { secd } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3;
   }
-\cs_new:Npn \__fp_tan_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_tan_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_case:w #1 \exp_stop_f:
+    \if_case:w #2 \exp_stop_f:
            \__fp_case_return_same_o:w
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_o:w
-            \__fp_tan_series_o:NNwww 0 #2 \c_one
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { tan } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1
+                 \__fp_tan_series_o:NNwwww 0 #3 \c_one
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { tan } { tand } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3 #4;
   }
-\cs_new:Npn \__fp_cot_o:w \s__fp \__fp_chk:w #1#2
+\cs_new:Npn \__fp_cot_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
   {
-    \if_case:w #1 \exp_stop_f:
-           \__fp_cot_zero_o:Nnw #2 { cot }
-    \or:
-      \__fp_case_use:nw
-        {
-          \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_inv_o:w
-            \__fp_tan_series_o:NNwww 2 #2 \c_three
-        }
-    \or:   \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cot } }
+    \if_case:w #2 \exp_stop_f:
+           \__fp_cot_zero_o:Nfw #3 { #1 { cot } { cotd } }
+    \or:   \__fp_case_use:nw
+             {
+               \__fp_trig:NNNNNwn #1
+                 \__fp_tan_series_o:NNwwww 2 #3 \c_three
+             }
+    \or:   \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { cot } { cotd } } }
     \else: \__fp_case_return_same_o:w
     \fi:
-    \s__fp \__fp_chk:w #1#2
+    \s__fp \__fp_chk:w #2 #3 #4;
   }
-\cs_new:Npn \__fp_cot_zero_o:Nnw #1 #2 #3 \fi:
+\cs_new:Npn \__fp_cot_zero_o:Nfw #1#2#3 \fi:
   {
     \fi:
-    \if_meaning:w 0 #1
-      \exp_after:wN \__fp_division_by_zero_o:Nnw \exp_after:wN \c_inf_fp
-    \else:
-      \exp_after:wN \__fp_division_by_zero_o:Nnw \exp_after:wN \c_minus_inf_fp
-    \fi:
+    \token_if_eq_meaning:NNTF 0 #1
+      { \exp_args:NNf \__fp_division_by_zero_o:Nnw \c_inf_fp }
+      { \exp_args:NNf \__fp_division_by_zero_o:Nnw \c_minus_inf_fp }
     {#2}
   }
-\cs_new:Npn \__fp_trig_exponent:NNNNNwn #1#2#3#4#5 \s__fp \__fp_chk:w 1#6#7
+\cs_new:Npn \__fp_trig:NNNNNwn #1#2#3#4#5 \s__fp \__fp_chk:w 1#6#7#8;
   {
-    \if_int_compare:w #7 > - \c_eight
-      \exp_after:wN #2
-      \exp_after:wN #3
-      \exp_after:wN #4
-      \int_use:N \__int_eval:w #5
-        \if_int_compare:w #7 > \c_zero
-          \exp_after:wN \__fp_trig_large:ww \__int_value:w
-        \else:
-          \exp_after:wN \__fp_trig_small:ww \__int_value:w
-        \fi:
-    \else:
-      \exp_after:wN #1
-      \exp_after:wN #6
-    \fi:
-    #7 ;
+    \exp_after:wN #2
+    \exp_after:wN #3
+    \exp_after:wN #4
+    \int_use:N \__int_eval:w #5
+      \exp_after:wN \exp_after:wN \exp_after:wN \exp_after:wN
+      \if_int_compare:w #7 > #1 \c_zero \c_one
+        #1 \__fp_trig_large:ww \__fp_trigd_large:ww
+      \else:
+        #1 \__fp_trig_small:ww \__fp_trigd_small:ww
+      \fi:
+    #7,#8{0000}{0000};
   }
-\cs_new:Npn \__fp_trig_epsilon_o:w #1 #2 ;
-  { \__fp_exp_after_o:w \s__fp \__fp_chk:w 1 #1 {#2} }
-\cs_new:Npn \__fp_trig_epsilon_one_o:w #1 ; #2 ;
-  { \exp_after:wN \c_one_fp }
-\group_begin:
-  \char_set_catcode_letter:N /
-  \cs_new:Npn \__fp_trig_epsilon_inv_o:w #1 #2 ;
-    {
-      \exp_after:wN \__fp_/_o:ww
-        \c_one_fp
-        \s__fp \__fp_chk:w 1 #1 {#2}
-    }
-\group_end:
-\cs_new:Npn \__fp_trig_small:ww #1; #2#3#4#5;
+\cs_new:Npn \__fp_trig_small:ww #1,#2;
+  { \__fp_ep_to_fixed:wwn #1,#2; . #1,#2; }
+\cs_new:Npn \__fp_trigd_small:ww #1,#2;
   {
+    \__fp_ep_mul_raw:wwwwN
+      -1,{1745}{3292}{5199}{4329}{5769}{2369}; #1,#2;
+    \__fp_trig_small:ww
+  }
+\cs_new:Npn \__fp_trigd_large:ww #1, #2#3#4#5#6#7;
+  {
+    \exp_after:wN \__fp_pack_eight:wNNNNNNNN
+    \exp_after:wN \__fp_pack_eight:wNNNNNNNN
     \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
     \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
-    \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
-    \exp_after:wN .
+    \exp_after:wN \__fp_trigd_large_auxi:nnnnwNNNN
     \exp_after:wN ;
     \tex_romannumeral:D -`0
-      \prg_replicate:nn { - #1 } { 0 } #2#3#4#5 0000 0000 ;
+    \prg_replicate:nn { \int_max:nn { 22 - #1 } { 0 } } { 0 }
+    #2#3#4#5#6#7 0000 0000 0000 !
   }
-\cs_new:Npn \__fp_trig_large:ww #1; #2#3;
-  { \__fp_trig_large:www #2; #3 ;  #1; }
-\cs_new:Npn \__fp_trig_large:www #1; #2; #3;
+\cs_new:Npn \__fp_trigd_large_auxi:nnnnwNNNN #1#2#3#4#5; #6#7#8#9
   {
-    \if_meaning:w 0 #3 \__fp_trig_large_break:w \fi:
-    \exp_after:wN \__fp_trig_large_o:wnnnn
-    \int_use:N \__int_eval:w ( #10 - 31416 ) / 62833 ;
-    {#1} #2
-    \exp_after:wN ;
-    \int_use:N \__int_eval:w \c_minus_one + #3;
-  }
-\cs_new:Npn \__fp_trig_large_o:wnnnn #1; #2#3#4#5
-  {
-    \exp_after:wN \__fp_trig_large:www
-    \int_use:N \__int_eval:w \c__fp_leading_shift_int + #20 - #1*62831
-      \exp_after:wN \__fp_pack:NNNNNw
-      \int_use:N \__int_eval:w \c__fp_middle_shift_int + #30 - #1*8530
-        \exp_after:wN \__fp_pack:NNNNNw
-        \int_use:N \__int_eval:w \c__fp_middle_shift_int + #40 - #1*7179
-          \exp_after:wN \__fp_pack:NNNNNw
-          \int_use:N \__int_eval:w \c__fp_trailing_shift_int + #50 - #1*5880
-    \exp_after:wN ;
+    \exp_after:wN \__fp_trigd_large_auxii:wNw
+    \int_use:N \__int_eval:w #1 + #2
+      - (#1 + #2 - \c_four) / \c_nine * \c_nine \__int_eval_end:
+    #3;
+    #4; #5{#6#7#8#9};
   }
-\cs_new:Npn \__fp_trig_large_break:w \fi: #1; #2;
-  { \fi: \__fp_trig_octant_loop:nnnnnw #2 {0000} {0000} ; }
-\cs_new:Npn \__fp_trig_octant_loop:nnnnnw #1#2#3#4#5#6;
+\cs_new:Npn \__fp_trigd_large_auxii:wNw #1; #2#3;
   {
-    \if_int_compare:w #1#2 < 157079633 \exp_stop_f:
-      \if_int_compare:w #1#2 = 157079632 \exp_stop_f:
-        \if_int_compare:w #3#4 > 67948969 \exp_stop_f:
-          \use_i_ii:nnn
-        \fi:
-      \fi:
-      \__fp_trig_octant_break:w
-    \fi:
-    + \c_two
-    \__fp_fixed_sub:wwn
-      {#1} {#2} {#3} {#4} {0000} {0000} ;
-      {15707} {9632} {6794} {8970} {0000} {0000} ;
-    \__fp_trig_octant_loop:nnnnnw
+    + (#1#2 - \c_four) / \c_nine * \c_two
+    \exp_after:wN \__fp_trigd_large_auxiii:www
+    \int_use:N \__int_eval:w #1#2
+      - (#1#2 - \c_four) / \c_nine * \c_nine \__int_eval_end: #3 ;
   }
-\cs_new:Npn \__fp_trig_octant_break:w #1 \fi: + #2#3 #4#5; #6; #7;
+\cs_new:Npn \__fp_trigd_large_auxiii:www #1; #2; #3!
   {
-    \fi:
-    \if_int_compare:w #4 < 7854 \exp_stop_f:
+    \if_int_compare:w #1 < 4500 \exp_stop_f:
       \exp_after:wN \__fp_use_i_until_s:nw
-      \exp_after:wN .
+      \exp_after:wN \__fp_fixed_continue:wn
+    \else:
+      + \c_one
     \fi:
-    + \c_one
-    \__fp_fixed_sub:wwn #6 ; {#4} #5 ; . ;
+    \__fp_fixed_sub:wwn {9000}{0000}{0000}{0000}{0000}{0000};
+      {#1}#2{0000}{0000};
+    { \__fp_trigd_small:ww 2, }
+  }
+\cs_new_nopar:Npx \__fp_trig_inverse_two_pi:
+  {
+    \exp_not:n { \exp_after:wN \use_none:n \token_to_str:N }
+    \cs:w , , !
+    0000000000000000159154943091895335768883763372514362034459645740 ~
+    4564487476673440588967976342265350901138027662530859560728427267 ~
+    5795803689291184611457865287796741073169983922923996693740907757 ~
+    3077746396925307688717392896217397661693362390241723629011832380 ~
+    1142226997557159404618900869026739561204894109369378440855287230 ~
+    9994644340024867234773945961089832309678307490616698646280469944 ~
+    8652187881574786566964241038995874139348609983868099199962442875 ~
+    5851711788584311175187671605465475369880097394603647593337680593 ~
+    0249449663530532715677550322032477781639716602294674811959816584 ~
+    0606016803035998133911987498832786654435279755070016240677564388 ~
+    8495713108801221993761476813777647378906330680464579784817613124 ~
+    2731406996077502450029775985708905690279678513152521001631774602 ~
+    0924811606240561456203146484089248459191435211575407556200871526 ~
+    6068022171591407574745827225977462853998751553293908139817724093 ~
+    5825479707332871904069997590765770784934703935898280871734256403 ~
+    6689511662545705943327631268650026122717971153211259950438667945 ~
+    0376255608363171169525975812822494162333431451061235368785631136 ~
+    3669216714206974696012925057833605311960859450983955671870995474 ~
+    6510431623815517580839442979970999505254387566129445883306846050 ~
+    7852915151410404892988506388160776196993073410389995786918905980 ~
+    9373777206187543222718930136625526123878038753888110681406765434 ~
+    0828278526933426799556070790386060352738996245125995749276297023 ~
+    5940955843011648296411855777124057544494570217897697924094903272 ~
+    9477021664960356531815354400384068987471769158876319096650696440 ~
+    4776970687683656778104779795450353395758301881838687937766124814 ~
+    9530599655802190835987510351271290432315804987196868777594656634 ~
+    6221034204440855497850379273869429353661937782928735937843470323 ~
+    0237145837923557118636341929460183182291964165008783079331353497 ~
+    7909974586492902674506098936890945883050337030538054731232158094 ~
+    3197676032283131418980974982243833517435698984750103950068388003 ~
+    9786723599608024002739010874954854787923568261139948903268997427 ~
+    0834961149208289037767847430355045684560836714793084567233270354 ~
+    8539255620208683932409956221175331839402097079357077496549880868 ~
+    6066360968661967037474542102831219251846224834991161149566556037 ~
+    9696761399312829960776082779901007830360023382729879085402387615 ~
+    5744543092601191005433799838904654921248295160707285300522721023 ~
+    6017523313173179759311050328155109373913639645305792607180083617 ~
+    9548767246459804739772924481092009371257869183328958862839904358 ~
+    6866663975673445140950363732719174311388066383072592302759734506 ~
+    0548212778037065337783032170987734966568490800326988506741791464 ~
+    6835082816168533143361607309951498531198197337584442098416559541 ~
+    5225064339431286444038388356150879771645017064706751877456059160 ~
+    8716857857939226234756331711132998655941596890719850688744230057 ~
+    5191977056900382183925622033874235362568083541565172971088117217 ~
+    9593683256488518749974870855311659830610139214454460161488452770 ~
+    2511411070248521739745103866736403872860099674893173561812071174 ~
+    0478899368886556923078485023057057144063638632023685201074100574 ~
+    8592281115721968003978247595300166958522123034641877365043546764 ~
+    6456565971901123084767099309708591283646669191776938791433315566 ~
+    5066981321641521008957117286238426070678451760111345080069947684 ~
+    2235698962488051577598095339708085475059753626564903439445420581 ~
+    7886435683042000315095594743439252544850674914290864751442303321 ~
+    3324569511634945677539394240360905438335528292434220349484366151 ~
+    4663228602477666660495314065734357553014090827988091478669343492 ~
+    2737602634997829957018161964321233140475762897484082891174097478 ~
+    2637899181699939487497715198981872666294601830539583275209236350 ~
+    6853889228468247259972528300766856937583659722919824429747406163 ~
+    8183113958306744348516928597383237392662402434501997809940402189 ~
+    6134834273613676449913827154166063424829363741850612261086132119 ~
+    9863346284709941839942742955915628333990480382117501161211667205 ~
+    1912579303552929241134403116134112495318385926958490443846807849 ~
+    0973982808855297045153053991400988698840883654836652224668624087 ~
+    2540140400911787421220452307533473972538149403884190586842311594 ~
+    6322744339066125162393106283195323883392131534556381511752035108 ~
+    7459558201123754359768155340187407394340363397803881721004531691 ~
+    8295194879591767395417787924352761740724605939160273228287946819 ~
+    3649128949714953432552723591659298072479985806126900733218844526 ~
+    7943350455801952492566306204876616134365339920287545208555344144 ~
+    0990512982727454659118132223284051166615650709837557433729548631 ~
+    2041121716380915606161165732000083306114606181280326258695951602 ~
+    4632166138576614804719932707771316441201594960110632830520759583 ~
+    4850305079095584982982186740289838551383239570208076397550429225 ~
+    9847647071016426974384504309165864528360324933604354657237557916 ~
+    1366324120457809969715663402215880545794313282780055246132088901 ~
+    8742121092448910410052154968097113720754005710963406643135745439 ~
+    9159769435788920793425617783022237011486424925239248728713132021 ~
+    7667360756645598272609574156602343787436291321097485897150713073 ~
+    9104072643541417970572226547980381512759579124002534468048220261 ~
+    7342299001020483062463033796474678190501811830375153802879523433 ~
+    4195502135689770912905614317878792086205744999257897569018492103 ~
+    2420647138519113881475640209760554895793785141404145305151583964 ~
+    2823265406020603311891586570272086250269916393751527887360608114 ~
+    5569484210322407772727421651364234366992716340309405307480652685 ~
+    0930165892136921414312937134106157153714062039784761842650297807 ~
+    8606266969960809184223476335047746719017450451446166382846208240 ~
+    8673595102371302904443779408535034454426334130626307459513830310 ~
+    2293146934466832851766328241515210179422644395718121717021756492 ~
+    1964449396532222187658488244511909401340504432139858628621083179 ~
+    3939608443898019147873897723310286310131486955212620518278063494 ~
+    5711866277825659883100535155231665984394090221806314454521212978 ~
+    9734471488741258268223860236027109981191520568823472398358013366 ~
+    0683786328867928619732367253606685216856320119489780733958419190 ~
+    6659583867852941241871821727987506103946064819585745620060892122 ~
+    8416394373846549589932028481236433466119707324309545859073361878 ~
+    6290631850165106267576851216357588696307451999220010776676830946 ~
+    9814975622682434793671310841210219520899481912444048751171059184 ~
+    4139907889455775184621619041530934543802808938628073237578615267 ~
+    7971143323241969857805637630180884386640607175368321362629671224 ~
+    2609428540110963218262765120117022552929289655594608204938409069 ~
+    0760692003954646191640021567336017909631872891998634341086903200 ~
+    5796637103128612356988817640364252540837098108148351903121318624 ~
+    7228181050845123690190646632235938872454630737272808789830041018 ~
+    9485913673742589418124056729191238003306344998219631580386381054 ~
+    2457893450084553280313511884341007373060595654437362488771292628 ~
+    9807423539074061786905784443105274262641767830058221486462289361 ~
+    9296692992033046693328438158053564864073184440599549689353773183 ~
+    6726613130108623588021288043289344562140479789454233736058506327 ~
+    0439981932635916687341943656783901281912202816229500333012236091 ~
+    8587559201959081224153679499095448881099758919890811581163538891 ~
+    6339402923722049848375224236209100834097566791710084167957022331 ~
+    7897107102928884897013099533995424415335060625843921452433864640 ~
+    3432440657317477553405404481006177612569084746461432976543900008 ~
+    3826521145210162366431119798731902751191441213616962045693602633 ~
+    6102355962140467029012156796418735746835873172331004745963339773 ~
+    2477044918885134415363760091537564267438450166221393719306748706 ~
+    2881595464819775192207710236743289062690709117919412776212245117 ~
+    2354677115640433357720616661564674474627305622913332030953340551 ~
+    3841718194605321501426328000879551813296754972846701883657425342 ~
+    5016994231069156343106626043412205213831587971115075454063290657 ~
+    0248488648697402872037259869281149360627403842332874942332178578 ~
+    7750735571857043787379693402336902911446961448649769719434527467 ~
+    4429603089437192540526658890710662062575509930379976658367936112 ~
+    8137451104971506153783743579555867972129358764463093757203221320 ~
+    2460565661129971310275869112846043251843432691552928458573495971 ~
+    5042565399302112184947232132380516549802909919676815118022483192 ~
+    5127372199792134331067642187484426215985121676396779352982985195 ~
+    8545392106957880586853123277545433229161989053189053725391582222 ~
+    9232597278133427818256064882333760719681014481453198336237910767 ~
+    1255017528826351836492103572587410356573894694875444694018175923 ~
+    0609370828146501857425324969212764624247832210765473750568198834 ~
+    5641035458027261252285503154325039591848918982630498759115406321 ~
+    0354263890012837426155187877318375862355175378506956599570028011 ~
+    5841258870150030170259167463020842412449128392380525772514737141 ~
+    2310230172563968305553583262840383638157686828464330456805994018 ~
+    7001071952092970177990583216417579868116586547147748964716547948 ~
+    8312140431836079844314055731179349677763739898930227765607058530 ~
+    4083747752640947435070395214524701683884070908706147194437225650 ~
+    2823145872995869738316897126851939042297110721350756978037262545 ~
+    8141095038270388987364516284820180468288205829135339013835649144 ~
+    3004015706509887926715417450706686888783438055583501196745862340 ~
+    8059532724727843829259395771584036885940989939255241688378793572 ~
+    7967951654076673927031256418760962190243046993485989199060012977 ~
+    7469214532970421677817261517850653008552559997940209969455431545 ~
+    2745856704403686680428648404512881182309793496962721836492935516 ~
+    2029872469583299481932978335803459023227052612542114437084359584 ~
+    9443383638388317751841160881711251279233374577219339820819005406 ~
+    3292937775306906607415304997682647124407768817248673421685881509 ~
+    9133422075930947173855159340808957124410634720893194912880783576 ~
+    3115829400549708918023366596077070927599010527028150868897828549 ~
+    4340372642729262103487013992868853550062061514343078665396085995 ~
+    0058714939141652065302070085265624074703660736605333805263766757 ~
+    2018839497277047222153633851135483463624619855425993871933367482 ~
+    0422097449956672702505446423243957506869591330193746919142980999 ~
+    3424230550172665212092414559625960554427590951996824313084279693 ~
+    7113207021049823238195747175985519501864630940297594363194450091 ~
+    9150616049228764323192129703446093584259267276386814363309856853 ~
+    2786024332141052330760658841495858718197071242995959226781172796 ~
+    4438853796763139274314227953114500064922126500133268623021550837
+    \cs_end:
+  }
+\cs_new:Npn \__fp_trig_large:ww #1, #2#3#4#5#6;
+  {
+    \exp_after:wN \__fp_trig_large_auxi:wwwwww
+    \int_use:N \__int_eval:w (#1 - 32) / 64 \exp_after:wN ,
+    \int_use:N \__int_eval:w (#1 - 4) / 8 \exp_after:wN ,
+    \__int_value:w #1 \__fp_trig_inverse_two_pi: ;
+    {#2}{#3}{#4}{#5} ;
+  }
+\cs_new:Npn \__fp_trig_large_auxi:wwwwww #1, #2, #3, #4!
+  {
+    \prg_replicate:nn {#1} { \__fp_trig_large_auxii:ww }
+    \prg_replicate:nn { #2 - #1 * \c_eight }
+      { \__fp_trig_large_auxiii:wNNNNNNNN }
+    \prg_replicate:nn { #3 - #2 * \c_eight }
+      { \__fp_trig_large_auxiv:wN }
+    \prg_replicate:nn { \c_eight } { \__fp_pack_twice_four:wNNNNNNNN }
+    \__fp_trig_large_auxv:www
+    ;
+  }
+\cs_new:Npn \__fp_trig_large_auxii:ww #1; #2 ~ { #1; }
+\cs_new:Npn \__fp_trig_large_auxiii:wNNNNNNNN
+  #1; #2#3#4#5#6#7#8#9 { #1; }
+\cs_new:Npn \__fp_trig_large_auxiv:wN #1; #2 { #1; }
+\cs_new:Npn \__fp_trig_large_auxv:www #1; #2; #3;
+  {
+    \exp_after:wN \__fp_use_i_until_s:nw
+    \exp_after:wN \__fp_trig_large_auxvii:w
+    \int_use:N \__int_eval:w \c__fp_leading_shift_int
+      \prg_replicate:nn { \c_thirteen }
+        { \__fp_trig_large_auxvi:wnnnnnnnn }
+      + \c__fp_trailing_shift_int - \c__fp_middle_shift_int
+      \__fp_use_i_until_s:nw
+      ; #3 #1 ; ;
+  }
+\cs_new:Npn \__fp_trig_large_auxvi:wnnnnnnnn #1; #2#3#4#5#6#7#8#9
+  {
+    \exp_after:wN \__fp_trig_large_pack:NNNNNw
+    \int_use:N \__int_eval:w \c__fp_middle_shift_int
+      + #2*#9 + #3*#8 + #4*#7 + #5*#6
+      #1; {#2}{#3}{#4}{#5} {#7}{#8}{#9}
+  }
+\cs_new:Npn \__fp_trig_large_pack:NNNNNw #1#2#3#4#5#6;
+  { + #1#2#3#4#5 ; #6 }
+\cs_new:Npn \__fp_trig_large_auxvii:w #1#2#3
+  {
+    \exp_after:wN \__fp_trig_large_auxviii:ww
+    \int_use:N \__int_eval:w (#1#2#3 - 62) / 125 ;
+    #1#2#3
+  }
+\cs_new:Npn \__fp_trig_large_auxviii:ww #1;
+  {
+    + #1
+    \if_int_odd:w #1 \exp_stop_f:
+      \exp_after:wN \__fp_trig_large_auxix:Nw
+      \exp_after:wN -
+    \else:
+      \exp_after:wN \__fp_trig_large_auxix:Nw
+      \exp_after:wN +
+    \fi:
+  }
+\cs_new_nopar:Npn \__fp_trig_large_auxix:Nw
+  {
+    \exp_after:wN \__fp_use_i_until_s:nw
+    \exp_after:wN \__fp_trig_large_auxxi:w
+    \int_use:N \__int_eval:w \c__fp_leading_shift_int
+      \prg_replicate:nn { \c_thirteen }
+        { \__fp_trig_large_auxx:wNNNNN }
+      + \c__fp_trailing_shift_int - \c__fp_middle_shift_int
+      ;
   }
-\cs_new:Npn \__fp_sin_series:NNwww #1#2#3 . #4; #5;
+\cs_new:Npn \__fp_trig_large_auxx:wNNNNN #1; #2 #3#4#5#6
+  {
+    \exp_after:wN \__fp_trig_large_pack:NNNNNw
+    \int_use:N \__int_eval:w \c__fp_middle_shift_int
+      #2 \c_eight * #3#4#5#6
+      #1; #2
+  }
+\cs_new:Npn \__fp_trig_large_auxxi:w #1;
+  {
+    \exp_after:wN \__fp_ep_mul_raw:wwwwN
+    \int_use:N \__int_eval:w \c_zero \__fp_ep_to_ep_loop:N #1 ; ; !
+    0,{7853}{9816}{3397}{4483}{0961}{5661};
+    \__fp_trig_small:ww
+  }
+\cs_new:Npn \__fp_sin_series_o:NNwwww #1#2#3. #4;
   {
     \__fp_fixed_mul:wwn #4; #4;
     {
-      \exp_after:wN \__fp_sin_series_aux:NNnww
+      \exp_after:wN \__fp_sin_series_aux_o:NNnwww
       \exp_after:wN #1
       \__int_value:w
         \if_int_odd:w \__int_eval:w ( #3 + \c_two ) / \c_four \__int_eval_end:
@@ -4078,9 +4469,8 @@
         \fi:
       {#3}
     }
-    #4 ;
   }
-\cs_new:Npn \__fp_sin_series_aux:NNnww #1#2#3 #4; #5;
+\cs_new:Npn \__fp_sin_series_aux_o:NNnwww #1#2#3 #4; #5,#6;
   {
     \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end:
       \exp_after:wN \use_i:nn
@@ -4098,6 +4488,7 @@
       \__fp_fixed_mul_sub_back:wwwn #4; {0416}{6666}{6666}{6666}{6666}{6667};
       \__fp_fixed_mul_sub_back:wwwn #4; {5000}{0000}{0000}{0000}{0000}{0000};
       \__fp_fixed_mul_sub_back:wwwn #4;{10000}{0000}{0000}{0000}{0000}{0000};
+      { \__fp_fixed_continue:wn 0, }
     }
     { % 1/17!
       \__fp_fixed_mul_sub_back:wwwn     {0000}{0000}{0000}{0028}{1145}{7254};
@@ -4109,7 +4500,7 @@
       \__fp_fixed_mul_sub_back:wwwn #4; {0083}{3333}{3333}{3333}{3333}{3333};
       \__fp_fixed_mul_sub_back:wwwn #4; {1666}{6666}{6666}{6666}{6666}{6667};
       \__fp_fixed_mul_sub_back:wwwn #4;{10000}{0000}{0000}{0000}{0000}{0000};
-      \__fp_fixed_mul:wwn #5;
+      { \__fp_ep_mul:wwwwn 0, } #5,#6;
     }
     {
       \exp_after:wN \__fp_sanitize:Nw
@@ -4118,11 +4509,11 @@
     }
     #2
   }
-\cs_new:Npn \__fp_tan_series_o:NNwww #1#2#3. #4; #5;
+\cs_new:Npn \__fp_tan_series_o:NNwwww #1#2#3. #4;
   {
     \__fp_fixed_mul:wwn #4; #4;
     {
-      \exp_after:wN \__fp_tan_series_aux_o:Nnww
+      \exp_after:wN \__fp_tan_series_aux_o:Nnwww
       \__int_value:w
         \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end:
           \exp_after:wN \reverse_if:N
@@ -4130,9 +4521,8 @@
         \if_meaning:w #1#2 2 \else: 0 \fi:
       {#3}
     }
-    #4 ;
   }
-\cs_new:Npn \__fp_tan_series_aux_o:Nnww #1 #2 #3; #4;
+\cs_new:Npn \__fp_tan_series_aux_o:Nnwww #1 #2 #3; #4,#5;
   {
     \__fp_fixed_mul_sub_back:wwwn     {0000}{0000}{1527}{3493}{0856}{7059};
                                 #3; {0000}{0159}{6080}{0274}{5257}{6472};
@@ -4140,27 +4530,302 @@
     \__fp_fixed_mul_sub_back:wwwn #3; {0115}{5830}{7533}{5397}{3168}{2147};
     \__fp_fixed_mul_sub_back:wwwn #3; {1929}{8245}{6140}{3508}{7719}{2982};
     \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000};
-    \__fp_fixed_mul:wwn #4;
+    { \__fp_ep_mul:wwwwn 0, } #4,#5;
+    {
+      \__fp_fixed_mul_sub_back:wwwn     {0000}{0007}{0258}{0681}{9408}{4706};
+                                  #3; {0000}{2343}{7175}{1399}{6151}{7670};
+      \__fp_fixed_mul_sub_back:wwwn #3; {0019}{2638}{4588}{9232}{8861}{3691};
+      \__fp_fixed_mul_sub_back:wwwn #3; {0536}{6357}{0691}{4344}{6852}{4252};
+      \__fp_fixed_mul_sub_back:wwwn #3; {5263}{1578}{9473}{6842}{1052}{6315};
+      \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000};
       {
-        \__fp_fixed_mul_sub_back:wwwn     {0000}{0007}{0258}{0681}{9408}{4706};
-                                    #3; {0000}{2343}{7175}{1399}{6151}{7670};
-        \__fp_fixed_mul_sub_back:wwwn #3; {0019}{2638}{4588}{9232}{8861}{3691};
-        \__fp_fixed_mul_sub_back:wwwn #3; {0536}{6357}{0691}{4344}{6852}{4252};
-        \__fp_fixed_mul_sub_back:wwwn #3; {5263}{1578}{9473}{6842}{1052}{6315};
-        \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000};
-          {
-            \exp_after:wN \__fp_sanitize:Nw
-            \exp_after:wN #1
-            \int_use:N \__int_eval:w
-              \reverse_if:N \if_int_odd:w
-                  \__int_eval:w (#2 - \c_one) / \c_two \__int_eval_end:
-                \exp_after:wN \__fp_reverse_args:Nww
-              \fi:
-              \__fp_fixed_div_to_float:ww
-          }
+        \reverse_if:N \if_int_odd:w
+            \__int_eval:w (#2 - \c_one) / \c_two \__int_eval_end:
+          \exp_after:wN \__fp_reverse_args:Nww
+        \fi:
+        \__fp_ep_div:wwwwn 0,
+      }
+    }
+    {
+      \exp_after:wN \__fp_sanitize:Nw
+      \exp_after:wN #1
+      \int_use:N \__int_eval:w \__fp_ep_to_float:wwN
+    }
+    #1
+  }
+\cs_new_nopar:Npn \__fp_atan_o:Nw
+  {
+    \__fp_atan_dispatch_o:NNnNw
+      \__fp_acotii_o:Nww \__fp_atanii_o:Nww { atan }
+  }
+\cs_new_nopar:Npn \__fp_acot_o:Nw
+  {
+    \__fp_atan_dispatch_o:NNnNw
+      \__fp_atanii_o:Nww \__fp_acotii_o:Nww { acot }
+  }
+\cs_new:Npn \__fp_atan_dispatch_o:NNnNw #1#2#3#4#5@
+  {
+    \if_case:w
+      \__int_eval:w \__fp_array_count:n {#5} - \c_one \__int_eval_end:
+         \exp_after:wN #1 \exp_after:wN #4 \c_one_fp #5
+         \tex_romannumeral:D
+    \or: #2 #4 #5 \tex_romannumeral:D
+    \else:
+      \__msg_kernel_expandable_error:nnnnn
+        { kernel } { fp-num-args } { #3() } { 1 } { 2 }
+      \exp_after:wN \c_nan_fp \tex_romannumeral:D
+    \fi:
+    \exp_after:wN \c_zero
+  }
+\cs_new:Npn \__fp_atanii_o:Nww
+    #1 \s__fp \__fp_chk:w #2#3#4; \s__fp \__fp_chk:w #5
+  {
+    \if_meaning:w 3 #2 \__fp_case_return_i_o:ww \fi:
+    \if_meaning:w 3 #5 \__fp_case_return_ii_o:ww \fi:
+    \if_case:w
+      \if_meaning:w #2 #5
+        \if_meaning:w 1 #2 \c_ten \else: \c_zero \fi:
+      \else:
+        \if_int_compare:w #2 > #5 \c_one \else: \c_two \fi:
+      \fi:
+         \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_two }
+    \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_four }
+    \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_zero }
+    \fi:
+    \__fp_atan_normal_o:NNnwNnw #1
+    \s__fp \__fp_chk:w #2#3#4;
+    \s__fp \__fp_chk:w #5
+  }
+\cs_new:Npn \__fp_acotii_o:Nww #1#2; #3;
+  { \__fp_atanii_o:Nww #1#3; #2; }
+\cs_new:Npn \__fp_atan_inf_o:NNNw #1#2#3 \s__fp \__fp_chk:w #4#5#6;
+  {
+    \exp_after:wN \__fp_atan_combine_o:NwwwwwN
+    \exp_after:wN #2
+    \int_use:N \__int_eval:w
+      \if_meaning:w 2 #5 \c_seven - \fi: #3 \exp_after:wN ;
+    \c__fp_one_fixed_tl ;
+    {0000}{0000}{0000}{0000}{0000}{0000};
+    0,{0000}{0000}{0000}{0000}{0000}{0000}; #1
+  }
+\cs_new_protected:Npn \__fp_atan_normal_o:NNnwNnw
+    #1 \s__fp \__fp_chk:w 1#2#3#4; \s__fp \__fp_chk:w 1#5#6#7;
+  {
+    \__fp_atan_test_o:NwwNwwN
+      #2 #3, #4{0000}{0000};
+      #5 #6, #7{0000}{0000}; #1
+  }
+\cs_new:Npn \__fp_atan_test_o:NwwNwwN #1#2,#3; #4#5,#6;
+  {
+    \exp_after:wN \__fp_atan_combine_o:NwwwwwN
+    \exp_after:wN #1
+    \int_use:N \__int_eval:w
+      \if_meaning:w 2 #4
+        \c_seven - \__int_eval:w
+      \fi:
+      \if_int_compare:w
+          \__fp_ep_compare:wwww #2,#3; #5,#6; > \c_zero
+        \c_three -
+        \exp_after:wN \__fp_reverse_args:Nww
+      \fi:
+      \__fp_atan_div:wnwwnw #2,#3; #5,#6;
+  }
+\cs_new:Npn \__fp_atan_div:wnwwnw #1,#2#3; #4,#5#6;
+  {
+    \if_int_compare:w
+      \__int_eval:w 41421 * #5 < #2 000
+        \if_case:w \__int_eval:w #4 - #1 \__int_eval_end: 00 \or: 0 \fi:
+      \exp_stop_f:
+      \exp_after:wN \__fp_atan_near:wwwn
+    \fi:
+    \c_zero
+    \__fp_ep_div:wwwwn #1,{#2}#3; #4,{#5}#6;
+    \__fp_atan_auxi:ww
+  }
+\cs_new:Npn \__fp_atan_near:wwwn
+    \c_zero \__fp_ep_div:wwwwn #1,#2; #3,
+  {
+    \c_one
+    \__fp_ep_to_fixed:wwn #1 - #3, #2;
+    \__fp_atan_near_aux:wwn
+  }
+\cs_new:Npn \__fp_atan_near_aux:wwn #1; #2;
+  {
+    \__fp_fixed_add:wwn #1; #2;
+    { \__fp_fixed_sub:wwn #2; #1; { \__fp_ep_div:wwwwn 0, } 0, }
+  }
+\cs_new:Npn \__fp_atan_auxi:ww #1,#2;
+  { \__fp_ep_to_fixed:wwn #1,#2; \__fp_atan_auxii:w #1,#2; }
+\cs_new:Npn \__fp_atan_auxii:w #1;
+  {
+    \__fp_fixed_mul:wwn #1; #1;
+    {
+      \__fp_atan_Taylor_loop:www 39 ;
+        {0000}{0000}{0000}{0000}{0000}{0000} ;
+    }
+    ! #1;
+  }
+\cs_new:Npn \__fp_atan_Taylor_loop:www #1; #2; #3;
+  {
+    \if_int_compare:w #1 = \c_minus_one
+      \__fp_atan_Taylor_break:w
+    \fi:
+    \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl ; #1;
+    \__fp_rrot:www \__fp_fixed_mul_sub_back:wwwn #2; #3;
+    {
+      \exp_after:wN \__fp_atan_Taylor_loop:www
+      \int_use:N \__int_eval:w #1 - \c_two ;
+    }
+    #3;
+  }
+\cs_new:Npn \__fp_atan_Taylor_break:w
+    \fi: #1 \__fp_fixed_mul_sub_back:wwwn #2; #3 !
+  { \fi: ; #2 ; }
+\cs_new:Npn \__fp_atan_combine_o:NwwwwwN #1 #2; #3; #4; #5,#6; #7
+  {
+    \exp_after:wN \__fp_sanitize:Nw
+    \exp_after:wN #1
+    \int_use:N \__int_eval:w
+      \if_meaning:w 0 #2
+        \exp_after:wN \use_i:nn
+      \else:
+        \exp_after:wN \use_ii:nn
+      \fi:
+      { #5 \__fp_fixed_mul:wwn #3; #6; }
+      {
+        \__fp_fixed_mul:wwn #3; #4;
+        {
+          \exp_after:wN \__fp_atan_combine_aux:ww
+          \int_use:N \__int_eval:w #2 / \c_two ; #2;
+        }
+      }
+      { #7 \__fp_fixed_to_float:wN \__fp_fixed_to_float_rad:wN }
+      #1
+  }
+\cs_new:Npn \__fp_atan_combine_aux:ww #1; #2;
+  {
+    \__fp_fixed_mul_short:wwn
+      {7853}{9816}{3397}{4483}{0961}{5661};
+      {#1}{0000}{0000};
+    {
+      \if_int_odd:w #2 \exp_stop_f:
+        \exp_after:wN \__fp_fixed_sub:wwn
+      \else:
+        \exp_after:wN \__fp_fixed_add:wwn
+      \fi:
+    }
+  }
+\cs_new:Npn \__fp_asin_o:w #1 \s__fp \__fp_chk:w #2#3; @
+  {
+    \if_case:w #2 \exp_stop_f:
+      \__fp_case_return_same_o:w
+    \or:
+      \__fp_case_use:nw
+        { \__fp_asin_normal_o:NfwNnnnnw #1 { #1 { asin } { asind } } }
+    \or:
+      \__fp_case_use:nw
+        { \__fp_invalid_operation_o:fw { #1 { asin } { asind } } }
+    \else:
+      \__fp_case_return_same_o:w
+    \fi:
+    \s__fp \__fp_chk:w #2 #3;
+  }
+\cs_new:Npn \__fp_acos_o:w #1 \s__fp \__fp_chk:w #2#3; @
+  {
+    \if_case:w #2 \exp_stop_f:
+      \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 \c_four }
+    \or:
+      \__fp_case_use:nw
+        {
+          \__fp_asin_normal_o:NfwNnnnnw #1 { #1 { acos } { acosd } }
+            \__fp_reverse_args:Nww
+        }
+    \or:
+      \__fp_case_use:nw
+        { \__fp_invalid_operation_o:fw { #1 { acos } { acosd } } }
+    \else:
+      \__fp_case_return_same_o:w
+    \fi:
+    \s__fp \__fp_chk:w #2 #3;
+  }
+\cs_new:Npn \__fp_asin_normal_o:NfwNnnnnw
+    #1#2#3 \s__fp \__fp_chk:w 1#4#5#6#7#8#9;
+  {
+    \if_int_compare:w #5 < \c_one
+      \exp_after:wN \__fp_use_none_until_s:w
+    \fi:
+    \if_int_compare:w \__int_eval:w #5 + #6#7 + #8#9 = 1000 0001 ~
+      \exp_after:wN \__fp_use_none_until_s:w
+    \fi:
+    \__fp_use_i:ww
+    \__fp_invalid_operation_o:fw {#2}
+      \s__fp \__fp_chk:w 1#4{#5}{#6}{#7}{#8}{#9};
+    \__fp_asin_auxi_o:NnNww
+      #1 {#3} #4 #5,{#6}{#7}{#8}{#9}{0000}{0000};
+  }
+\cs_new:Npn \__fp_asin_auxi_o:NnNww #1#2#3#4,#5;
+  {
+    \__fp_ep_to_fixed:wwn #4,#5;
+    \__fp_asin_isqrt:wn
+    \__fp_ep_mul:wwwwn #4,#5;
+    \__fp_ep_to_ep:wwN
+    \__fp_fixed_continue:wn
+    { #2 \__fp_atan_test_o:NwwNwwN #3 }
+    0 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1
+  }
+\cs_new:Npn \__fp_asin_isqrt:wn #1;
+  {
+    \exp_after:wN \__fp_fixed_sub:wwn \c__fp_one_fixed_tl ; #1;
+    {
+      \__fp_fixed_add_one:wN #1;
+      \__fp_fixed_continue:wn { \__fp_ep_mul:wwwwn 0, } 0,
+    }
+    \__fp_ep_isqrt:wwn
+  }
+\cs_new:Npn \__fp_acsc_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
+  {
+    \if_case:w \if_meaning:w 2 #2 #3 \fi: #2 \exp_stop_f:
+           \__fp_case_use:nw
+             { \__fp_invalid_operation_o:fw { #1 { acsc } { acscd } } }
+    \or:   \__fp_case_use:nw
+             { \__fp_acsc_normal_o:NfwNnw #1 { #1 { acsc } { acscd } } }
+    \or:   \__fp_case_return_o:Nw \c_zero_fp
+    \or:   \__fp_case_return_same_o:w
+    \else: \__fp_case_return_o:Nw \c_minus_zero_fp
+    \fi:
+    \s__fp \__fp_chk:w #2 #3 #4;
+  }
+\cs_new:Npn \__fp_asec_o:w #1 \s__fp \__fp_chk:w #2#3; @
+  {
+    \if_case:w #2 \exp_stop_f:
+      \__fp_case_use:nw
+        { \__fp_invalid_operation_o:fw { #1 { asec } { asecd } } }
+    \or:
+      \__fp_case_use:nw
+        {
+          \__fp_acsc_normal_o:NfwNnw #1 { #1 { asec } { asecd } }
+            \__fp_reverse_args:Nww
+        }
+    \or:   \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 \c_four }
+    \else: \__fp_case_return_same_o:w
+    \fi:
+    \s__fp \__fp_chk:w #2 #3;
+  }
+\cs_new:Npn \__fp_acsc_normal_o:NfwNnw #1#2#3 \s__fp \__fp_chk:w 1#4#5#6;
+  {
+    \int_compare:nNnTF {#5} < \c_one
+      {
+        \__fp_invalid_operation_o:fw {#2}
+          \s__fp \__fp_chk:w 1#4{#5}#6;
+      }
+      {
+        \__fp_ep_div:wwwwn
+          1,{1000}{0000}{0000}{0000}{0000}{0000};
+          #5,#6{0000}{0000};
+        { \__fp_asin_auxi_o:NnNww #1 {#3} #4 }
       }
   }
-%% File: l3fp-convert.dtx Copyright(C) 2011-2012 The LaTeX3 Project
+%% File: l3fp-convert.dtx Copyright(C) 2011-2013 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -4376,37 +5041,38 @@
   }
 \cs_new:Npn \dim_to_fp:n #1
   {
-    \exp_after:wN \__fp_from_dim_test:N
+    \exp_after:wN \__fp_from_dim_test:ww
+    \exp_after:wN 0
+    \exp_after:wN ,
     \__int_value:w \etex_glueexpr:D #1 ;
   }
-\cs_new:Npn \__fp_from_dim_test:N #1
+\cs_new:Npn \__fp_from_dim_test:ww #1, #2
   {
-    \if_meaning:w 0 #1
-      \__fp_case_return:nw \c_zero_fp
+    \if_meaning:w 0 #2
+      \__fp_case_return:nw { \exp_after:wN \c_zero_fp }
     \else:
-      \if_meaning:w - #1
-        \exp_after:wN \__fp_from_dim:Nw
-        \exp_after:wN 2
-        \__int_value:w
-      \else:
-        \exp_after:wN \__fp_from_dim:Nw
-        \exp_after:wN 0
-        \__int_value:w #1
-      \fi:
+      \exp_after:wN \__fp_from_dim:wNw
+      \int_use:N \__int_eval:w #1 - \c_four
+        \if_meaning:w - #2
+          \exp_after:wN , \exp_after:wN 2 \__int_value:w
+        \else:
+          \exp_after:wN , \exp_after:wN 0 \__int_value:w #2
+        \fi:
     \fi:
   }
-\cs_new:Npn \__fp_from_dim:Nw #1 #2;
+\cs_new:Npn \__fp_from_dim:wNw #1,#2#3;
   {
     \__fp_pack_twice_four:wNNNNNNNN \__fp_from_dim:wNNnnnnnn ;
-    #2 000 0000 00 {10}987654321; #1
+    #3 000 0000 00 {10}987654321; #2 {#1}
   }
 \cs_new:Npn \__fp_from_dim:wNNnnnnnn #1; #2#3#4#5#6#7#8#9
-  { \__fp_from_dim:wnnnnwN #1 {#2#300} {0000} ; }
-\cs_new:Npn \__fp_from_dim:wnnnnwN #1; #2#3#4#5#6; #7
+  { \__fp_from_dim:wnnnnwNn #1 {#2#300} {0000} ; }
+\cs_new:Npn \__fp_from_dim:wnnnnwNn #1; #2#3#4#5#6; #7#8
   {
     \__fp_mul_npos_o:Nww #7
       \s__fp \__fp_chk:w 1 #7 {#5} #1 ;
-      \s__fp \__fp_chk:w 1 0 {-4} {1525} {8789} {0625} {0000} ;
+      \s__fp \__fp_chk:w 1 0 {#8} {1525} {8789} {0625} {0000} ;
+      \prg_do_nothing:
   }
 \cs_new_eq:NN \fp_use:N \fp_to_decimal:N
 \cs_generate_variant:Nn \fp_use:N { c }
@@ -4442,7 +5108,7 @@
     \exp_not:N \__fp_array_to_clist_loop:Nw
   }
 %%
-%% File: l3fp-assign.dtx Copyright (C) 2011-2012 The LaTeX3 project
+%% File: l3fp-assign.dtx Copyright (C) 2011-2013 The LaTeX3 project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -4479,11 +5145,11 @@
   { \cs_new_eq:NN #1 \c_zero_fp }
 \cs_generate_variant:Nn \fp_new:N {c}
 \cs_new_protected:Npn \fp_set:Nn   #1#2
-  { \tl_set:Nx #1 { \__fp_parse:n {#2} } }
+  { \tl_set:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
 \cs_new_protected:Npn \fp_gset:Nn  #1#2
-  { \tl_gset:Nx #1 { \__fp_parse:n {#2} } }
+  { \tl_gset:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
 \cs_new_protected:Npn \fp_const:Nn #1#2
-  { \tl_const:Nx #1 { \__fp_parse:n {#2} } }
+  { \tl_const:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
 \cs_generate_variant:Nn \fp_set:Nn {c}
 \cs_generate_variant:Nn \fp_gset:Nn {c}
 \cs_generate_variant:Nn \fp_const:Nn {c}
@@ -4525,7 +5191,7 @@
 \cs_generate_variant:Nn \fp_show:N { c }
 \fp_const:Nn \c_e_fp          { 2.718 2818 2845 9045 }
 \fp_const:Nn \c_one_fp        { 1 }
-\fp_const:Nn \c_pi_fp         { 3.141 5926 5358 9794 }
+\fp_const:Nn \c_pi_fp         { 3.141 5926 5358 9793 }
 \fp_const:Nn \c_one_degree_fp { 0.0 1745 3292 5199 4330 }
 \fp_new:N \l_tmpa_fp
 \fp_new:N \l_tmpb_fp
-- 
cgit v1.2.3

