Prev: NETWORK MARKETING
Next: cl-who html output
From: sg2008 on 9 May 2010 06:06 Hello, When I let "lisp system" evaluate 1e-7, it evaluates it to 0, I was expecting it to evaluate and return 1e-7 or .0000001 However, 1e-6 gets evaluated correctly, Is there any limit/precision setting in lisp system to get evaluation of 1e-7 right? Thanks, :)
From: Tamas K Papp on 9 May 2010 07:04 On Sun, 09 May 2010 03:06:00 -0700, sg2008 wrote: > Hello, > > When I let "lisp system" evaluate 1e-7, it evaluates it to 0, I was > expecting it to evaluate and return 1e-7 or .0000001 > > However, 1e-6 gets evaluated correctly, > > Is there any limit/precision setting in lisp system to get evaluation of > 1e-7 right? > > Thanks, :) What is "lisp system"? Is it a Common Lisp? In the latter, you should be able to represent 1e-7, or even much smaller numbers. See http://www.lispworks.com/documentation/HyperSpec/Body/v_most_1.htm Please be more specific (lisp dialect/implementation, etc) if you need further help. Tamas
From: D Herring on 9 May 2010 07:07 On 05/09/2010 06:06 AM, sg2008 wrote: > Hello, > > When I let "lisp system" evaluate 1e-7, it evaluates it to 0, I was > expecting it to evaluate and return 1e-7 or .0000001 > > However, 1e-6 gets evaluated correctly, > > Is there any limit/precision setting in lisp system to get evaluation > of 1e-7 right? Well, on my box 1e-7 returns as 1e-7 for every lisp I tried. Whatever the cause of your issue, you can improve the default precision used for reading numbers by setting (setf *read-default-float-format* 'double-float) - Daniel
From: sg2008 on 10 May 2010 06:25 On May 9, 4:04 am, Tamas K Papp <tkp...(a)gmail.com> wrote: > On Sun, 09 May 2010 03:06:00 -0700, sg2008 wrote: > > Hello, > > > When I let "lisp system" evaluate 1e-7, it evaluates it to 0, I was > > expecting it to evaluate and return 1e-7 or .0000001 > > > However, 1e-6 gets evaluated correctly, > > > Is there any limit/precision setting in lisp system to get evaluation of > > 1e-7 right? > > > Thanks, :) > > What is "lisp system"? Is it a Common Lisp? In the latter, you > should be able to represent 1e-7, or even much smaller numbers. Seehttp://www.lispworks.com/documentation/HyperSpec/Body/v_most_1.htm > > Please be more specific (lisp dialect/implementation, etc) if you need > further help. > > Tamas Thank u, I am using/compiling/building following version of common lisp Allegro CL Enterprise Edition 8.1 [64-bit Linux (x86-64)] (May 10, 2010 2:41) Copyright (C) 1985-2007, Franz Inc., Oakland, CA, USA. All Rights Reserved. ==== I debugged my problem further, it turns out that read-from-string is outputting 0. input to read-from string is "1.000000000e-07\n" output from read-from-string routine is is 0.000000 here is code snap-shot: ==== (setf *read-default-float-format* 'double-float) (setq *read-default-float-format* 'double-float) (oail:warn "read-from-string is %L" (read-from-string input)) ==== I wonder if there is something wrong with read-from-string? when I input 1e-6, output is dumped out as follows: === input to read-from-string is "1.000000000e-06\n" output from read-from-string is 0.000001 ==== :)
From: sg2008 on 10 May 2010 06:31
On May 9, 4:07 am, D Herring <dherr...(a)at.tentpost.dot.com> wrote: > On 05/09/2010 06:06 AM, sg2008 wrote: > > > Hello, > > > When I let "lisp system" evaluate 1e-7, it evaluates it to 0, I was > > expecting it to evaluate and return 1e-7 or .0000001 > > > However, 1e-6 gets evaluated correctly, > > > Is there any limit/precision setting in lisp system to get evaluation > > of 1e-7 right? > > Well, on my box 1e-7 returns as 1e-7 for every lisp I tried. Whatever > the cause of your issue, you can improve the default precision used > for reading numbers by setting > > (setf *read-default-float-format* 'double-float) > > - Daniel Hello, thank u. I tried, however, read-from-string returns 0 for 1e-7, and, I am using allegro CL 8.1 lisp system, as I described in my last append. :) |