You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2014/01/07 12:35:50 UTC

[jira] [Commented] (DERBY-6447) Use StrictMath for more functions in SYSFUN

    [ https://issues.apache.org/jira/browse/DERBY-6447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13864125#comment-13864125 ] 

Knut Anders Hatlen commented on DERBY-6447:
-------------------------------------------

Using StrictMath would not only make the code simpler, it would also make the functions return more accurate results.

For example, the current implementation of LOG10 returns approximations in some cases where it's possible to return an exact answer:

{noformat}
ij> values log10(1000), log10(1000000);
1                       
------------------------
2.9999999999999996      
5.999999999999999       

2 rows selected
{noformat}

If it had used StrictMath.log10(), it would have returned 3 and 6.

> Use StrictMath for more functions in SYSFUN
> -------------------------------------------
>
>                 Key: DERBY-6447
>                 URL: https://issues.apache.org/jira/browse/DERBY-6447
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> Most of the functions in the SYSFUN schema use methods in java.lang.StrictMath directly. A few of them use methods in SystemProcedures instead. Java 1.5 added more methods to StrictMath, so it is now possible to make more of the functions use StrictMath and drop the implementation in SystemProcedures:
> - LOG10 could use StrictMath.log10()
> - COSH could use StrictMath.cosh()
> - SINH could use StrictMath.sinh()
> - TANH could use StrictMath.tanh()



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)