Consider the following example:



  \cs_new_eq:NN \calc \fp_eval:n



  \multido{\iA = 2+1, \iB = 1+1}{16}{%
    \psRelLine[angle = \Angle{\iA}](0,0)(2,0){\SideLength{\iB}}{A}}


When compiling, I get the error

! Number too big.
<argument> 7853981633
l.17 ...ngle{\iA}](0,0)(2,0){\SideLength{\iB}}{A}}

How do I fix this?


You are passing the full set of digits from l3fp back to pstricks, but that's too many! (The LaTeX3 FPU is IEEE-compliant so works at 16 digit precision.) In common with many TeX packages, pstricks is expecting a number here with no more digits than TeX will accept as a \number. Probably the easiest fix is to round within the FPU:



  \cs_new:Npn \calc #1 { \fp_eval:n { round ( #1 , 5 ) } }

depending on your use cases. (Five decimal digits is probably enough to pass back to most TeX end-uses.)

  • 2
    "5 digits should be enough for anyone." You may live to rue those words! – Loop Space Jan 20 '14 at 22:31
  • @AndrewStacey I did say 'probably' :-) Depending on the internal set up of what you send data back to, you may loose additional places in any case. (Picking up as a dimen is not uncommon, and that limits you to 5 d.p.) – Joseph Wright Jan 20 '14 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.