Skip to content

[cmath.syn] LWG 2847: C functions show five overloads; those from [sf.math] only three #1247

Description

@jensmaurer

The synopsis for <cmath> shows five overloads for "traditional" C math functions, e.g.

  • float sin(float);
  • double sin(double);
  • long double sin(long double);
  • float sinf(float);
  • long double sinl(long double);

In contrast, for the mathematical special functions described in [sf.math], the synopsis (and the descriptions in [sf.math]) only show three overloads:

  • double beta(double);
  • float betaf(float);
  • long double betal(long double);

This is inconsistent.

In [cmath.syn] p2, we have the "sufficient additional overloads" provision. (As a side note, the provision doesn't talk about adjusting the return type, which seems an oversight.) This provision requires overloads for sin(float) and sin(double). Next, at least one additional overload (possibly a template) is required to handle integer types (and convert them to double), since [conv.fpint] and [over.ics.rank] do not differentiate a conversion from int to float vs. a conversion from int to double, thereby making overload resolution for integer arguments ambiguous.

(Source: Dawn's list of issues discovered during review/integration of the math special functions.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lwgIssue must be reviewed by LWG.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions