ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent
@ 2012-08-13  8:58 karatedog (Földes László)
  2012-08-13 14:38 ` [ruby-core:47151] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: karatedog (Földes László) @ 2012-08-13  8:58 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been reported by karatedog (Földes László).

----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862

Author: karatedog (Földes László)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:47151] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
@ 2012-08-13 14:38 ` phasis68 (Heesob Park)
  2012-08-20  7:54 ` [ruby-core:47245] [ruby-trunk - Bug #6862][Assigned] " naruse (Yui NARUSE)
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: phasis68 (Heesob Park) @ 2012-08-13 14:38 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by phasis68 (Heesob Park).


BigMath.exp cannot handle floating point value too.

C:\Users\phasis>ruby -rbigdecimal -e 'p BigMath.exp(3.0,10)'
-e:1:in `exp': Float can't be coerced into BigDecimal without a precision (ArgumentError)
        from -e:1:in `<main>'

And Here is a patch.


diff --git a/bigdecimal.c b/bigdecimal.c.new
index 866ce34..f0dc9bd 100644
--- a/bigdecimal.c
+++ b/bigdecimal.c.new
@@ -2546,6 +2546,7 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
     if (negative) {
        VpSetSign(vx, 1);
     }
+    x = ToValue(vx);

     RB_GC_GUARD(one) = ToValue(VpCreateRbObject(1, "1"));
     RB_GC_GUARD(x1) = one;

----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-28832

Author: karatedog (Földes László)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [ruby-core:47245] [ruby-trunk - Bug #6862][Assigned] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
  2012-08-13 14:38 ` [ruby-core:47151] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
@ 2012-08-20  7:54 ` naruse (Yui NARUSE)
  2013-06-25 13:13 ` [ruby-core:55649] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: naruse (Yui NARUSE) @ 2012-08-20  7:54 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by naruse (Yui NARUSE).

Status changed from Open to Assigned
Assignee set to mrkn (Kenta Murata)


----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-28937

Author: karatedog (Földes László)
Status: Assigned
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55649] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
  2012-08-13 14:38 ` [ruby-core:47151] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
  2012-08-20  7:54 ` [ruby-core:47245] [ruby-trunk - Bug #6862][Assigned] " naruse (Yui NARUSE)
@ 2013-06-25 13:13 ` phasis68 (Heesob Park)
  2013-06-25 17:24 ` [ruby-core:55651] " nagachika (Tomoyuki Chikanaga)
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: phasis68 (Heesob Park) @ 2013-06-25 13:13 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by phasis68 (Heesob Park).


This issue was solved with changeset r41623.
BTW, my patch is same to Garth Snyder's and it is 11 months old.

----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40133

Author: karatedog (Földes László)
Status: Assigned
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55651] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (2 preceding siblings ...)
  2013-06-25 13:13 ` [ruby-core:55649] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
@ 2013-06-25 17:24 ` nagachika (Tomoyuki Chikanaga)
  2013-07-01  6:38 ` [ruby-core:55726] " mrkn (Kenta Murata)
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2013-06-25 17:24 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by nagachika (Tomoyuki Chikanaga).

Backport set to 1.9.3: REQUIRED, 2.0.0: REQUIRED


----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40136

Author: karatedog (Földes László)
Status: Assigned
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55726] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (3 preceding siblings ...)
  2013-06-25 17:24 ` [ruby-core:55651] " nagachika (Tomoyuki Chikanaga)
@ 2013-07-01  6:38 ` mrkn (Kenta Murata)
  2013-07-01  7:10 ` [ruby-core:55727] " mame (Yusuke Endoh)
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mrkn (Kenta Murata) @ 2013-07-01  6:38 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by mrkn (Kenta Murata).


phasis68 (Heesob Park) wrote:
> This issue was solved with changeset r41623.
> BTW, my patch is same to Garth Snyder's and it is 11 months old.

I'm sorry I missed this issue and your patch.
I added your name in ChangeLog at r41723.

----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40225

Author: karatedog (Földes László)
Status: Closed
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55727] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (4 preceding siblings ...)
  2013-07-01  6:38 ` [ruby-core:55726] " mrkn (Kenta Murata)
@ 2013-07-01  7:10 ` mame (Yusuke Endoh)
  2013-07-01 18:10 ` [ruby-core:55742] " nagachika (Tomoyuki Chikanaga)
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mame (Yusuke Endoh) @ 2013-07-01  7:10 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by mame (Yusuke Endoh).


So phasis68 should have a commit bit, as I said. ;-)

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40227

Author: karatedog (Földes László)
Status: Closed
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55742] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (5 preceding siblings ...)
  2013-07-01  7:10 ` [ruby-core:55727] " mame (Yusuke Endoh)
@ 2013-07-01 18:10 ` nagachika (Tomoyuki Chikanaga)
  2013-07-03 14:44 ` [ruby-core:55781] " mrkn (Kenta Murata)
  2013-08-02 11:53 ` [ruby-core:56336] " usa (Usaku NAKAMURA)
  8 siblings, 0 replies; 10+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2013-07-01 18:10 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED to 1.9.3: REQUIRED, 2.0.0: DONE


----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40240

Author: karatedog (Földes László)
Status: Closed
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: REQUIRED, 2.0.0: DONE


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:55781] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (6 preceding siblings ...)
  2013-07-01 18:10 ` [ruby-core:55742] " nagachika (Tomoyuki Chikanaga)
@ 2013-07-03 14:44 ` mrkn (Kenta Murata)
  2013-08-02 11:53 ` [ruby-core:56336] " usa (Usaku NAKAMURA)
  8 siblings, 0 replies; 10+ messages in thread
From: mrkn (Kenta Murata) @ 2013-07-03 14:44 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by mrkn (Kenta Murata).


mame (Yusuke Endoh) wrote:
> So phasis68 should have a commit bit, as I said. ;-)

+1
----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40276

Author: karatedog (Földes László)
Status: Closed
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: REQUIRED, 2.0.0: DONE


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ruby-core:56336] [ruby-trunk - Bug #6862] BigMath.exp negative exponent
  2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
                   ` (7 preceding siblings ...)
  2013-07-03 14:44 ` [ruby-core:55781] " mrkn (Kenta Murata)
@ 2013-08-02 11:53 ` usa (Usaku NAKAMURA)
  8 siblings, 0 replies; 10+ messages in thread
From: usa (Usaku NAKAMURA) @ 2013-08-02 11:53 UTC (permalink / raw
  To: ruby-core


Issue #6862 has been updated by usa (Usaku NAKAMURA).

Backport changed from 1.9.3: REQUIRED, 2.0.0: DONE to 1.9.3: DONE, 2.0.0: DONE


----------------------------------------
Bug #6862: BigMath.exp negative exponent
https://bugs.ruby-lang.org/issues/6862#change-40829

Author: karatedog (Földes László)
Status: Closed
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: 
Target version: next minor
ruby -v: ruby 1.9.3p260 (2012-08-09 revision 36669) [i686-linux]
Backport: 1.9.3: DONE, 2.0.0: DONE


Ruby 1.9.3 BigMath.exp accepts Fixnum for exponent but silently treats negative exponents as positive:
1.9.3p260 :009 > BigMath.exp(3, 10)
 => #<BigDecimal:9be2ce8,'0.2008553692E2',18(72)> 
1.9.3p260 :010 > BigMath.exp(-3, 10)
 => #<BigDecimal:9bd8e50,'0.2008553692E2',18(45)>

Converting the exponent parameter to BigDecimal solves the problem:
1.9.3p260 :011 > BigMath.exp(BigDecimal(-3), 10)
 => #<BigDecimal:9bd1420,'0.4978706837E-1',18(45)> 





-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-02 12:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13  8:58 [ruby-core:47145] [ruby-trunk - Bug #6862][Open] BigMath.exp negative exponent karatedog (Földes László)
2012-08-13 14:38 ` [ruby-core:47151] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
2012-08-20  7:54 ` [ruby-core:47245] [ruby-trunk - Bug #6862][Assigned] " naruse (Yui NARUSE)
2013-06-25 13:13 ` [ruby-core:55649] [ruby-trunk - Bug #6862] " phasis68 (Heesob Park)
2013-06-25 17:24 ` [ruby-core:55651] " nagachika (Tomoyuki Chikanaga)
2013-07-01  6:38 ` [ruby-core:55726] " mrkn (Kenta Murata)
2013-07-01  7:10 ` [ruby-core:55727] " mame (Yusuke Endoh)
2013-07-01 18:10 ` [ruby-core:55742] " nagachika (Tomoyuki Chikanaga)
2013-07-03 14:44 ` [ruby-core:55781] " mrkn (Kenta Murata)
2013-08-02 11:53 ` [ruby-core:56336] " usa (Usaku NAKAMURA)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).