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 How fast is zero? was: Find nth term of a List
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
 
Sam Tobin-Hochstadt  
View profile  
 More options Sep 27 2012, 12:26 pm
From: Sam Tobin-Hochstadt <sa...@ccs.neu.edu>
Date: Thu, 27 Sep 2012 12:25:30 -0400
Local: Thurs, Sep 27 2012 12:25 pm
Subject: Re: [racket] How fast is zero? was: Find nth term of a List

On Thu, Sep 27, 2012 at 12:10 PM, Tim Brown <tim.br...@cityc.co.uk> wrote:
> What is the difference in correctness between "(= x 0)" vs. "(zero? x)"?

There is none: http://docs.racket-lang.org/reference/number-types.html?q=zero%3F#%28...

> And given a choice of (eq? 0 x), (= 0 x) and (zero? x), which
> would, and which should take the shortest time to perform 10^12 times?

(= 0 x) and (zero? x) should compile to the same code.

(eq? 0 x) produces simpler code, because:

(= 0 0.0) => #t, but (eq? 0 0.0) => #f.

For actual performance numbers, as opposed to reasoning from
instructions sequences, Robby's advice about benchmarking is very
wise.
--
sam th
sa...@ccs.neu.edu
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
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.