02
To: Neil Toronto
Cc: users@racket-lang.org
Subject: Re: [racket] Decimal rounding problem
On Thu, Nov 29, 2012 at 7:42 PM, Neil Toronto
wrote:
> On 11/29/2012 10:53 AM, Greg Graham wrote:
>> Now, the unanswered question is why do Crystal Reports and Excel round
>> 4.225 to 4.23? I d
On Thu, Nov 29, 2012 at 7:42 PM, Neil Toronto wrote:
> On 11/29/2012 10:53 AM, Greg Graham wrote:
>> Now, the unanswered question is why do Crystal Reports and Excel round
>> 4.225 to 4.23? I don't think I'll find as helpful of a forum to answer that
>> question as I have found for Racket. Thanks
But you don't have the problem of misrounding because of a conversion
from octal to beinary before you start.
-- hendrik
On Thu, Nov 29, 2012 at 08:28:33PM +0100, Stephan Houben wrote:
> In octal you have the same issue, how do you round octal 0.4 ?
>
> No, we should be using an odd base, say
In octal you have the same issue, how do you round octal 0.4 ?
No, we should be using an odd base, say base-5. Fingers and thumb of one
hand. No central digit to cause rounding ambiguity.
Stephan
Stephan Houben
Op 29 nov. 2012 20:02 schreef "Hendrik Boom" het
volgende:
> All these problems tha
All these problems that would have been avoided if we had just started
out counting on our fingers instead of out fingers and thumbs!
-- hendrik
k
Racket Users list:
http://lists.racket-lang.org/users
Excel is infamous for its incorrect roundings. Google "excel roundings quirks".
I don't know about crystal rep.
2012/11/29, Greg Graham :
> Thank you to everyone who weighed in on the topic; the discussion has been
> very informative and interesting.
>
> I've decided to not do the rounding in Ra
On 11/29/2012 10:53 AM, Greg Graham wrote:
Thank you to everyone who weighed in on the topic; the discussion has been very
informative and interesting.
I've decided to not do the rounding in Racket, but to store all of the digits
in the database. The rounding will occur at the time of display
Thank you to everyone who weighed in on the topic; the discussion has been very
informative and interesting.
I've decided to not do the rounding in Racket, but to store all of the digits
in the database. The rounding will occur at the time of display by either
Crystal Reports or Excel, which is
On 11/29/2012 11:06 AM, Stephen Bloch wrote:
On Nov 29, 2012, at 9:44 AM, Greg Graham wrote:
I am trying to report GPA calculation results to 2 decimal places, so I thought
real->decimal-string would do the trick. However, the following behavior
surprised me:
(real->decimal-string 3.225 2)
Oh, of course! Thank you!
Robby
On Thu, Nov 29, 2012 at 10:01 AM, Neil Toronto wrote:
> This is because numbers in [4.0,8.0) have one fewer bit with which to
> represent the fractional part than numbers in [2.0,4.0). That bit is needed
> to represent the larger integer part.
>
> Alternatively, y
On Nov 29, 2012, at 11:01 AM, Neil Toronto wrote:
> This is because numbers in [4.0,8.0) have one fewer bit with which to
> represent the fractional part than numbers in [2.0,4.0). That bit is needed
> to represent the larger integer part.
I'm trying to replicate this in Java, using the Decima
On Thu, Nov 29, 2012 at 4:48 PM, Robby Findler
wrote:
> But why does 3.225 round differently than 4.225?
Neither 3.225 nor 4.225 can be represented exactly in binary floating-point.
The numbers actually parsed are:
> (write-rational-expansion (inexact->exact 4.225))
4.22464472863211
On Nov 29, 2012, at 11:01 AM, Neil Toronto wrote:
> This is because numbers in [4.0,8.0) have one fewer bit with which to
> represent the fractional part than numbers in [2.0,4.0). That bit is needed
> to represent the larger integer part.
Cute! I want to assign this as an exam problem for my
On Nov 29, 2012, at 9:44 AM, Greg Graham wrote:
> I am trying to report GPA calculation results to 2 decimal places, so I
> thought real->decimal-string would do the trick. However, the following
> behavior surprised me:
>
>> (real->decimal-string 3.225 2)
> "3.23"
>> (real->decimal-string 4.2
This is because numbers in [4.0,8.0) have one fewer bit with which to
represent the fractional part than numbers in [2.0,4.0). That bit is
needed to represent the larger integer part.
Alternatively, you can understand it in terms of how many flonums there
are between each integer. That number
On 11/29/2012 07:55 AM, Matthew Flatt wrote:
At Thu, 29 Nov 2012 14:44:38 +, Greg Graham wrote:
There are a couple of issues here.
First, the inexact number 4.225 is actually slightly smaller than the
exact value 4.225:
[...]
Even if you use the exact number 4.225, though, you get a "2" as
But why does 3.225 round differently than 4.225?
I see that this is different:
> (> 3.225 #e3.225)
#t
but I would have thought that the integer part wouldn't affect
anything here since floats have those parts separate? I thought?
Robby
On Thu, Nov 29, 2012 at 8:55 AM, Matthew Flatt wrote:
> A
At Thu, 29 Nov 2012 14:44:38 +, Greg Graham wrote:
> I am trying to report GPA calculation results to 2 decimal places, so I
> thought
> real->decimal-string would do the trick. However, the following behavior
> surprised me:
>
> > (real->decimal-string 3.225 2)
> "3.23"
> > (real->decimal-
18 matches
Mail list logo