There is a similar question on Stack Exchange (Is two-thirds plural?). I am not sure that any of the answers to that is definitive. In Quora, there is a reasonable answer, which says:
"As an abstract number, it's singular: “0.5 is larger than 0.4.” As a quantifier of a unit, it's usually plural (at least in technical writing): “0.5 V” is pronounced “0.5 volts” (cf. “1 volt”). (Basically everything except “a”, “an”, “1” or “one” is plural in this context. Even “1.0” is plural.)" In a way this seems counter-intuitive. Surely a fraction of a gram, or volt, or whatever, cannot be plural when we are talking about less that one. Well, yes it can.
One way of looking at it is to think of the question you would ask to find out some measurement of something:
"How many grams/metres/litres/degrees IS it?" And the answer will be: "it weighs 0.4 grams"; or "it is 0.452 metres long"; or "it contains 0.4 litres of wine"; or "it is 0.4 degrees celsius below freezing." The only exception to this rule is the number '1'. Then and only then is the measure expressed in the singular.
So your problem is about what happens when you have both fraction and single whole together? My answer is that this is one of those cases where you reach a limit point and where, therefore, you can legitimately take your pick.
A: ... from 0.4 to 1 gram: this can be read as "... from 0.4 to 1 gram" where the plural measure in angled brackets is left to be understood.
B ...from 0.4 to 1 grams: this can be read as a price range 'from
nought-point-four-to-one grams', where plural wins.
My suspicion is that there will be a significant enough proportion of speakers feeling 'uncomfortable' about either of the two. So if you want to be really sure to leave nobody uncomfortable, you need to use the combination you don't want: "from 0.4 grams to 1 gram." Sorry, but there it is.