It may be a dumb thing that I didn't saw but I've got the a really strange behavior on my program.
Here's my code
#include <stdio.h>
void spectral_color(double r,double g,double b,double l); //https://stackoverflow.com/a/22681410
int main(int argc, char **argv)
{
    double r,g,b;
    spectral_color(r,g,b,600);
    //printf("%lf,%lf,%lf",r,g,b);
}
void spectral_color(double r,double g,double b,double l) // RGB <0,1> <- lambda l <400,700> [nm]
    {
    double t;  r=0.0; g=0.0; b=0.0;
    if ((l>=595.0)&&(l<650.0)) { 
        t=(l-595.0)/(650.0-595.0); 
        r=(double)0.98+(0.06*t)-(0.40*t*t); 
    }
    printf("%lf,%lf,%lf",r,g,b);
}
It prints 0.000000,0.000000,0.000000 and I tried this in the gdb
15          t=(l-595.0)/(650.0-595.0); 
(gdb) p l
$8 = 600
(gdb) p r
$9 = 1.7802772279180279e-307
(gdb) p t
$10 = 2.4846118548532686e+264
(gdb) n
16          r=(double)0.98+(0.06*t)-(0.40*t*t); 
(gdb) p t
$11 = 0.090909090909090912
(gdb) p r
$12 = 1.7802772279180279e-307
(gdb) n
18      printf("%lf,%lf,%lf",r,g,b);
(gdb) p t
$13 = 0.090909090909090912
(gdb) p r
$14 = 1.7802772279180279e-307
Here, r do not take the value it should and I have no idea why it would do that.
Do someone have an explanation ?
Thanks in advance
edit:
I passed the value of r to another variable and changed the %lf to %f,
the result is that r is never equal to the new variable but the correct value ends up in this new variable
double d = r; //this is line 18
printf("%f,%f,%f",d,g,b);
gdb result:
20  }
(gdb) p d
$1 = 0.98214876033057852
(gdb) p r
$2 = 1.7802772279180279e-307
(gdb)
