Skip to content

Doesnt work for inverted arrays #1

Description

@sharp-trickster

I've tried this function in C++ and tested 2 arrays a, and b, being:

double a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double b[10] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };

Say, for N from -2 to 11

When I run interp(N, a, b) it works:

i=-2 t=10 i=-1 t=10 i=0 t=10 i=1 t=10 i=2 t=9 i=3 t=8 i=4 t=7 i=5 t=6 i=6 t=5 i=7 t=4 i=8 t=3 i=9 t=2 i=10 t=1 i=11 t=1

When I run interp(N, b, a) it doesnt work:

i=-2 t=1 i=-1 t=1 i=0 t=1 i=1 t=1 i=2 t=1 i=3 t=1 i=4 t=1 i=5 t=1 i=6 t=1 i=7 t=1 i=8 t=1 i=9 t=10 i=10 t=10 i=11 t=10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions