On Wed, May 2, 2012 6:11 am, Bo Jacoby wrote:
> Hello J'ers
>
> Even if a complex number is actually real it may display nonzero imaginary
> part because of round-off errors. Adding and subtracting 1e6j1e6 removes
> the round-off error, but is there a better or more general solution?

J uses the APL definition of complex floor, so normal rounding works.

   <.1j0.00000001+0.5
1
   _1+<.1j0.00000001+0.5
0

-- 
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks


-- 
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to