Menu

#37 Base conversion for doubles and negatives

0.6.4
open
nobody
None
2015-02-19
2015-02-13
user23013
No

Currently b doesn't support doubles, and use the the absolute value for negatives when converting an array back to a number. If they are supported it can be a generic polynomial evaluation operator.

[1 2 3] 1.5b

should return:

8.25

Discussion

  • aditsu

    aditsu - 2015-02-17

    How would that work for converting a number to that base?

     
  • user23013

    user23013 - 2015-02-19

    For real bases, one way is to find the maximum power of the base which is less than the number, and set that digit accodingly. This leaves only the rightmost digit a real number.

    For negative bases, find the maximum (k^(2k+2)-1)/(k^2-1) for even k instead, for positive numbers, and do it similarly for negative numbers. This makes the result all positive. See also: http://en.wikipedia.org/wiki/Negative_base

    APL seemed just using mod everywhere, and returns an all negative array for negative bases, which makes less sense to me.

    Or to make it simpler: just leave it unimplemented.

    Installed the form recovery addon for posting on sourceforge...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.