How about adding suffix like 50lf and 60lf ?
Oh yeah. Also you can do
50.0 and 60.0
And more
For example
double(50) and double(60)
And more
#define D(a) (double)(a)
D(50) and D(60)
And more
static inline double GetDouble(const int a){
return (double)a;
}
And how about library?
main.cpp:
#include "doubles.hpp"
#include <iostream>
int main(int argc, char **argv){
double x,a,b;
a=50;
b=60;
x = GetDouble(11) / GetDouble(100) * a;
std::cout << x;
return 0;
}
doubles.hpp:
#ifndef _DOUBLES_HPP
#define _DOUBLES_HPP
#define DBL(a) (double)(a)
double GetDouble(const int);
#endif
doubles.cpp:
#include "doubles.hpp"
double GetDouble(const int arg){
return DBL(arg);
}
Makefile:
CC = g++
CFLAGS = -O0 -Wall -ggdb
PE = main
default: $(PE).out
$(PE).out: main.cpp doubles.o
$(CC) $(CFLAGS) -o $@ $^
doubles.o: doubles.cpp doubles.hpp
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm *.o
rm *.out
And here you go.
$: make
$: ./main.out
5.5
$: