[cfaussie] Re: Strange FIX() behaviour

2007-08-13 Thread Simon Haddon
Floating point maths is a pain in any language as there are limitations to
representing floating points in todays CPU designs.  The problem is that
floats don't fit nicely into 32 or 64 bit systems and floats are represented
as approximations.  I had this problem last year in calculating rainfall
percentiles and wondered why the results where never exactly the same.  Near
enough is good enough it appears.  Having said that IBM did do something in
their hardware to minimize the problem back in 1968.  I don't know of Intel
or AMD used the same nearest number technique.

If you need to be 100% accurate with your cents then I would remove an
decimals by treating your cents as whole numbers separate to your dollars ,
and possibly store as complete cents units.  ie:  (9 * 100) + 95 would be
fine.  You could tokenize the dollars and cents to split it up prior to
turning it into a pure cents value.

I guess most banks have used the slight rounding errors to their advantage.

Cheers
Simon

On 13/08/07, Brett Payne-Rhodes [EMAIL PROTECTED] wrote:



 This works in terms of what you are trying to achieve Steve...

 cfset cents = (dollar * 1000)/10 /

 Floating point maths in scripted languages has always been a pain...


 Brett
 B)


 AJ Mercer wrote:
  If you do a NumberFormat of cents you get 994.9
  #NumberFormat(cents), '999.999')#
 
 
 
  On 8/13/07, *Steve Onnis*  [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
  Its from a shopping cart form
 
  Basically what I wanted to do was stop people sending decimal values
  more
  than 2 points.  The examples of the implementation I was sent from
 the
  provider showed that they were just removing the decimal point from
 the
  number value and sending that as the cents value.
 
  Problem is if for some reason the person implementing the credit
 card
  processing passed in 9.995 or something.  Then instead of billing
  the card
  9.99 they would be billed 99.95.
 
  So I figured I would move the point rather than remove it and make
 it a
  whole number which is why I was doing this.
 
  I have changed it from FIX() to ROUND() anyway
 
  Steve
 
  -Original Message-
  From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com
  [mailto: cfaussie@googlegroups.com
  mailto:cfaussie@googlegroups.com] On Behalf
  Of Haikal Saadh
  Sent: Monday, 13 August 2007 12:19 PM
  To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com
  Subject: [cfaussie] Re: Strange FIX() behaviour
 
 
  I remember a thread from here a while back discussing the various
  idiosyncrasies of floating point arithmetic, and that you should be
  really
  storing money in cent amounts.
 
  I've got no first hand experience in this, but have a flip thru the
  archives.
 
  David Harris wrote:
Something odd is happening there
   
If you do this:
   
cfset cents = 995 
cfoutput
 #FIX(cents)#
/cfoutput
   
you get the expected result. eg: 995
   
The only thing that springs to mind is that maybe:
   
9.95 * 100 = 994. ?
   
not sure how to prove this theory tho...
   
   
   
Steve Onnis wrote:
   
Has anyone come across this before?
   
cfset dollar = 9.95 /
cfset cents = dollar * 100 /
cfoutput
#FIX(cents)#
/cfoutput
   
outputs 994
   
I could maybe understand this is i had more decimal places but
 it is
a plain
2 point decimal value.
   
Any ideas?
   
   
   
   
   
  
 http://www.inevative.com.au/images/email-stationary/inevativeLogo_sm
  
 http://www.inevative.com.au/images/email-stationary/inevativeLogo_sm
all.jpg
   
Steve Onnis
   
   
Director / Head Developer
   
   
  
 http://www.inevative.com.au/images/email-stationary/email.jpg
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
   
  
  http://www.inevative.com.au/images/email-stationary/phone.jpg +61
3 9001
2258
   
   
  http://www.inevative.com.au/images/email-stationary/mobile.jpg
  http://www.inevative.com.au/images/email-stationary/mobile.jpg
0401 667
996
   
  http://www.inevative.com.au/images/email-stationary/web.jpg
www.inevative.com.au http://www.inevative.com.au
   
 http://www.novahost.com.au   http://www.threesquares.com.au
  http://www.threesquares.com.au
http://www.smsonline.com.au
   
   
   

   
   
 
 
 
 
 
 
  


 



-- 
Cheers
Simon Haddon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send 

[cfaussie] Re: CFCAMP Australia Is GO

2007-08-13 Thread Dale Fraser

Geoff,

That Sounds Really Good,

What's the deal with Melbourne being skipped in these things. First Mark
Blair the other night at the UG hook up said Adobe will tour, but no
Melbourne. Now this.

Surely Melbourne would have more or just as much interest as Canberra.

PS: The wiki does say to petition you. So anyone else who thinks Melbourne
should get a stop, say so.

Regards
Dale Fraser

http://dalefraser.blogspot.com

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Geoff Bowers
Sent: Monday, 13 August 2007 8:39 PM
To: cfaussie
Subject: [cfaussie] CFCAMP Australia Is GO


Quick heads up for CFAUSSIE... more official marketing to follow.

CFCAMP Australia is a free, mini-conference for coldfusion developers
by coldfusion developers. We're celebrating the release of Coldfusion
8 -- and there is a lot to celebrate.

Help us build the agenda for your city:
  http://cfcamp.pbwiki.com/

Suggest your own sessions, petition existing sessions, help organise!

Brisbane on the 11th of September at the Rydges
Canberra on the 12th of September at the UCU Conference Centre
Sydney on the 13th of September at the Wesley Centre

Enjoy!

-- geoff
http://www.daemon.com.au/





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Storing PDF files as blobs in a database

2007-08-13 Thread Scott Thornton

Hi,

I wonder if CFX_PUTIMAGE could be of assistance? or maybe

cffile action = readbinary file = c:\xxx\\scan005659.jpg 
variable=image_var_blob

I know they are image type manipulation... but it may help.

 Steve Onnis [EMAIL PROTECTED] 13/08/2007 11:04 pm 
I am trying to generate PDF files and store them in a database for future
reference instead of writing them to the file system

Can anyone point me in the right direction on doing this?  I have tried a
few things but I cant seem to get it to work,

 
http://www.inevative.com.au/images/email-stationary/inevativeLogo_small.jpg 
 


Steve Onnis


Director / Head Developer


  http://www.inevative.com.au/images/email-stationary/email.jpg
[EMAIL PROTECTED] 

  http://www.inevative.com.au/images/email-stationary/phone.jpg +61 3 9001
2258

  http://www.inevative.com.au/images/email-stationary/mobile.jpg 0401 667
996

  http://www.inevative.com.au/images/email-stationary/web.jpg
www.inevative.com.au 

 http://www.novahost.com.au   http://www.threesquares.com.au
http://www.smsonline.com.au  




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFCAMP Australia Is GO

2007-08-13 Thread Adam Chapman

CFCAMP.. Sounds like a new tag to make your requests slightly more gay?

-Original Message-
From: Geoff Bowers [mailto:[EMAIL PROTECTED] 
Sent: Monday, 13 August 2007 8:39 PM
To: cfaussie
Subject: [cfaussie] CFCAMP Australia Is GO


Quick heads up for CFAUSSIE... more official marketing to follow.

CFCAMP Australia is a free, mini-conference for coldfusion developers
by coldfusion developers. We're celebrating the release of Coldfusion
8 -- and there is a lot to celebrate.

Help us build the agenda for your city:
  http://cfcamp.pbwiki.com/

Suggest your own sessions, petition existing sessions, help organise!

Brisbane on the 11th of September at the Rydges
Canberra on the 12th of September at the UCU Conference Centre
Sydney on the 13th of September at the Wesley Centre

Enjoy!

-- geoff
http://www.daemon.com.au/




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFCAMP Australia Is GO

2007-08-13 Thread Paul Kukiel

I'd also definatly go if it was in Melbourne.

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Monday, 13 August 2007 8:59 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: CFCAMP Australia Is GO


Geoff,

That Sounds Really Good,

What's the deal with Melbourne being skipped in these things. First Mark
Blair the other night at the UG hook up said Adobe will tour, but no
Melbourne. Now this.

Surely Melbourne would have more or just as much interest as Canberra.

PS: The wiki does say to petition you. So anyone else who thinks Melbourne
should get a stop, say so.

Regards
Dale Fraser

http://dalefraser.blogspot.com

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Geoff Bowers
Sent: Monday, 13 August 2007 8:39 PM
To: cfaussie
Subject: [cfaussie] CFCAMP Australia Is GO


Quick heads up for CFAUSSIE... more official marketing to follow.

CFCAMP Australia is a free, mini-conference for coldfusion developers
by coldfusion developers. We're celebrating the release of Coldfusion
8 -- and there is a lot to celebrate.

Help us build the agenda for your city:
  http://cfcamp.pbwiki.com/

Suggest your own sessions, petition existing sessions, help organise!

Brisbane on the 11th of September at the Rydges
Canberra on the 12th of September at the UCU Conference Centre
Sydney on the 13th of September at the Wesley Centre

Enjoy!

-- geoff
http://www.daemon.com.au/








--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---