Light meter programming problem in cycle.

Hi! I am new to Arduino, so I decided to look for some help. I have a project which consists of an OLED module (Купить OLED-дисплей (Troyka-модуль) в Москве / Амперка) with two buttons based on Adafruit ssd1306. I also have a light meter module (Датчик освещённости (Troyka-модуль) / Купить в Москве и СПБ с доставкой по России / Амперка) based on photoresistor GL5528. The board I am using is Arduino Uno.
Now, to the project: it should take current luminosity and count the right aperture and shutter speed for film photography. Everything’s working fine except displaying shutter speed in fractions (1/500, 1/250, etc). My code is 500+ lines, so I am including only the setup and loop parts which interact with shutter speed and a snippet of functions for shutter speed used there.

So, everything worked kinda okay when I made a big function “print_scaled” before splitting it to functions “print_scaled_d” and “print_scaled_d_sm”. (I implemented d_sm because I needed to work with small floats like 0.002 for 1/500, and I couldn’t come across a better solution.) The only thing that didn’t work was first two “print to display” functions for 1/500 and 1/250. When I commented them (//), everything else showed up perfectly. When I didn’t, my program didn’t even load to the display and was stuck. I decided to split my big function in two smaller ones. And that’s the fun: suddenly print_scaled_d decided not to work at all. Print_scaled_dsm works only with first two “ifs” (1/500 and 1/250) commented. What I really don’t understand is how these two lines just break my project to the point of not showing up on the screen? (The loader works fine though, I always see L, TX and RX lighting up when I upload my code to UNO).

P.S. I tried to write everything in detail and I’m really sorry if something sounds funny or weird. English is not my native language.

 // libraries
#include <TroykaLight.h> // photoresistor library for converting to lux
#include <AnalogKey.h> 
#include <GyverButton.h> // button library for smoother state checks
#include <Wire.h> // oled library 
#include <Adafruit_SSD1306.h> // oled library 
#include <splash.h>
// parameters
#define SCREEN_WIDTH 128 // oled width
#define SCREEN_HEIGHT 64 // oled length
#define OLED_RESET     -1 // oled reset pin shared with board

GButton ok(3, HIGH_PULL); // s2 button (left)
GButton down(2, HIGH_PULL); // s1 button (right)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); // display initializing

TroykaLight sensorLight(A0); // photoresistor

static int8_t t = 0; // for moving between form options 

void setup() {
  Serial.begin(9600); // debug
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // display init
  display.clearDisplay();
  // setContrast(0);     
  display.setTextColor(WHITE);
}

void loop() {
  // variables 
    static int pointer = 10; // main menu pointer
    static float f = 2; // f start value
    static float d = 30; // d start value
    static float lux = 0; // lux start value
    static int iso = 100;
    static int pointer_F; // pointer in settings for f
    static int pointer_D = 10; // pointer in settings for d
    static int pointer_iso = 10; // pointer in settings for iso
    static int var = 0;
    switch (t){ // case for t (form number)
          ......
        case 2: // calculating d form
        draw_countd(f, iso); 
        askB(); // check buttons' state
        if (ok.isPress()) { // ok moves us back to main menu
           t = 0;
        }  
          ............
        }
    } // switch end
} // loop end

// ----------CUSTOM --------- FUNCTIONS --------

// check buttons state
void askB(void){
  down.tick();
  ok.tick();
}

// counting f form
void draw_countF(float d, float iso){
......
}
// counting d form
void draw_countd(float f, float iso){
  float d = 0; // set d to zero
  float ev;
  float d_sm = 0;
  static float _lux; // lux is static because we check it the moment we draw this form
  display.clearDisplay(); // get display ready
  display.setTextSize(2);
  sensorLight.read(); // check photoresistor
  _lux = sensorLight.getLightLux(); // write lux
  //Serial.println("LUX IN D"); // debug
  //Serial.println(_lux);// debug 
  if (iso > 100) { // calibrating for iso more than 100
    ev = lux2ev(_lux) + 1;
  }
  else {
    ev = lux2ev(_lux);
  }
  d = countd(f, ev, iso); // counting d = F^2 * 100 / (2^EV * ISO) where 2^EV = lux / 2.5
  d_sm = d * 100;
  d_sm = scale_d_sm(d_sm);
  d = scale_d(d);
  display.setCursor(16, 20);
  display.println("d EQUALS:"); // graphic layout
  display.setCursor(30, 40);
  d_sm = int(d_sm * 10);
  if (d_sm < 40){
    print_scaled_d_sm(d_sm);
  }
  else{
    print_scaled_d(d);
  };
  display.display(); // redraw
  delay(1000);
 }
// scaling for d smaller
float scale_d_sm(float d_sm){
  if (d_sm >= 0.2 && d_sm < 0.4) { // for shutter speed 1/250 - 1/500
    d_sm = getInterval(d_sm, 0.2, 0.4); 
  } else if (d_sm >= 0.4 && d_sm < 0.8) { // for shutter speed 1/125 - 1/250
    d_sm = getInterval(d_sm, 0.4, 0.8);
  } else if (d_sm >= 0.8 && d_sm < 1.71) { // for shutter speed 1/60 - 1/125
    d_sm = getInterval(d_sm, 0.8, 1.71); 
  } else if (d_sm >= 1.71 && d_sm < 3.4) { // for shutter speed 1/30- 1/60   
    d_sm = getInterval(d_sm, 1.71, 3.4);
  } 
  return d_sm;
}
// scaling for d normal
float scale_d(float d){
    if (d >= 0.03 && d < 0.04) { // for shutter speed 1/25 - 1/30
      d = getInterval(d, 0.03, 0.04); 
  } else if (d >= 0.04 && d < 0.05) { // for shutter speed 1/20 - 1/25
      d = getInterval(d, 0.04, 0.05);
  } else if (d >= 0.05 && d < 0.1) {  // for shutter speed 1/10 - 1/20
      d = getInterval(d, 0.05, 0.1);
  } else if (d >= 0.1 && d < 0.125) {  // for shutter speed 1/8 - 1/10
      d = getInterval(d, 0.1, 0.125); 
  } else if (d >= 0.125 && d < 0.18) {  // for shutter speed 1/6 - 1/8
      d = getInterval(d, 0.125, 0.18);
  } else if (d >= 0.18 && d < 0.25) {  // for shutter speed 1/4 - 1/6
      d = getInterval(d, 0.18, 0.25);
  } else if (d >= 0.25 && d < 0.5) {  // for shutter speed 1/2 - 1/4
      d = getInterval(d, 0.25, 0.5); 
  } else if (d >= 0.5 && d < 1) {  // for shutter speed 1 - 1/2
      d = getInterval(d, 0.5, 1);
  } else if (d >= 1.0 && d < 2.0) {  // for shutter speed 2 - 1
      d = getInterval(d, 1.0, 2.0);
  } else if (d >= 2.0 && d < 4.0) {  // for shutter speed 4 - 2
      d = getInterval(d, 2.0, 4.0);
  }           
  return d;
}

void print_scaled_d_sm(int d_sm){
     /* if (d_sm == 2){
        display.print("1/500");
    } else if (d_sm == 4){
        display.print("1/250");
    }  else */ if (d_sm == 8){
        display.print("1/125");
    } else if (d_sm == 17) {
        display.print("1/60");
    } else if (d_sm == 34){
        display.print("1/30");
    }
}

void print_scaled_d (float d){
    if ((d - 0.03) == 0){
      display.print("1/30");
  } else if ((d - 0.04) == 0){
      display.print("1/25");
  } else if ((d - 0.05) ==  0){
      display.print("1/20");
  } else if ((d - 0.1) == 0){
      display.print("1/10");
  } else if ((d - 0.125) == 0){
      display.print("1/8");
  } else if ((d - 0.18) == 0){
      display.print("1/6");
  } else if ((d - 0.25) == 0){
      display.print("1/4");
  } else if ((d - 0.5) == 0){
      display.print("1/2");
  } else if (d >= 1){
      display.print(d);
  }
}

//d maths
float countd(float F, float ev, float iso){ // counting d in d = F^2 * 100 / (2^EV * ISO) where 2^EV = lux / 2.5
  return ((pow(F, 2) * 100) / (iso * (pow(2, ev))));
 }

// log base 2 maths  
float log2(float x) {
  return log(x) / log(2);
}
// lux converting to ev => L = 2.5 * 2^EV
float lux2ev(float lux) {
  return log2(lux / 2.5);
}
// find the closest value
float getInterval(float x, float v1, float v2) {
  if (x - v1 > v2 - x) {
    return v2;
  }
 return v1;
}