[prev in list] [next in list] [prev in thread] [next in thread]
List: ast-users
Subject: [ast-users] Fwd: Floating point oddities with pow()? Accuracy problem?
From: Lionel Cons <lionelcons1972 () googlemail ! com>
Date: 2013-01-29 16:06:04
Message-ID: CAPJSo4UHSgH075yZ2byxgrZ2JM0eg2nNXYNwooiKNZUo=V4RQw () mail ! gmail ! com
[Download RAW message or body]
2nd try to post
---------- Forwarded message ----------
From: Lionel Cons <lionelcons1972@googlemail.com>
Date: 29 January 2013 10:50
Subject: Floating point oddities with pow()? Accuracy problem?
To: ast-users <ast-users@research.att.com>, ast-developers@research.att.com
Can someone explain why the the examples below yield a difference? IMO
pow() should deliver the same result as a x*x*x*... sequence. Or not?
ksh -c 'float x y ; ((x=y=.1 , y=pow(y,4.) , x=x*x*x*x)) ; printf
"%30.30f\n" x-y'
-0.000000000000000000000006617444
ksh -c 'float x y ; ((x=y=.1 , y=pow(y,6.) , x=x*x*x*x*x*x)) ; printf
"%30.30f\n" x-y'
-0.000000000000000000000000103397
ksh -c 'float x y ; ((x=y=.1 , y=pow(y,8.) , x=x*x*x*x*x*x*x*x)) ;
printf "%30.30f\n" x-y'
-0.000000000000000000000000001615
Platform is Suse 12.1 on AMD64.
Lionel
--
Lionel
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic