Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion floating problem of eval()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
oversky  
View profile  
 More options Nov 13 2012, 1:01 am
From: oversky <mail...@gmail.com>
Date: Mon, 12 Nov 2012 22:00:46 -0800 (PST)
Local: Tues, Nov 13 2012 1:00 am
Subject: Re: floating problem of eval()
Thanks for replying.
The eval() is used in a inline calculator function.
It's annoy that I have to remember not to input integer in an
equation,
especially when the equation is pasted from somewhere else.
Is there anyway to force floating calculation?

On 11月13日, 下午1時46分, Danny Gratzer <danny.grat...@gmail.com> wrote:

> These look correct to me, when you do eval("1/2") you are doing integer
> division, so it should return 0. In every other case you have a floating
> point so you will be doing floating point division, so you should get .5.
> Why is this strange?

> On Mon, Nov 12, 2012 at 11:43 PM, oversky <mail...@gmail.com> wrote:
> > I use eval function to do some simple calculations.
> > Today I found that some calculations do not return correct answers.
> > For example,

> > :echo eval('1/2')
> > 0

> > :echo eval('1/2.0')
> > 0.5

> > :echo eval('1.0/2')
> > 0.5

> > :echo eval('1.0/2.0')
> > 0.5

> > I use vim fromhttp://portableapps.com.
> > This version is compiled with +float.
> > Can anyone confirm this with your vim?

> > --
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visithttp://www.vim.org/maillist.php

> --
> Danny Gratzer


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.